Pawel Laszczak | 118b2a3 | 2020-12-07 11:32:25 +0100 | [diff] [blame] | 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 <pawell@cadence.com> |
| 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, pep->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->state, __entry->stream_id, |
| 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( |
Joe Perches | 78c14b3 | 2021-06-12 08:42:27 -0700 | [diff] [blame] | 141 | __assign_str(text, msg); |
Pawel Laszczak | 118b2a3 | 2020-12-07 11:32:25 +0100 | [diff] [blame] | 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 | |
Pawel Laszczak | 118b2a3 | 2020-12-07 11:32:25 +0100 | [diff] [blame] | 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 | |
Pawel Laszczak | 118b2a3 | 2020-12-07 11:32:25 +0100 | [diff] [blame] | 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_ep0_halted, |
| 182 | TP_PROTO(char *msg), |
| 183 | TP_ARGS(msg) |
| 184 | ); |
| 185 | |
| 186 | DEFINE_EVENT(cdnsp_log_simple, cdnsp_ep_halt, |
| 187 | TP_PROTO(char *msg), |
| 188 | TP_ARGS(msg) |
| 189 | ); |
| 190 | |
| 191 | TRACE_EVENT(cdnsp_looking_trb_in_td, |
| 192 | TP_PROTO(dma_addr_t suspect, dma_addr_t trb_start, dma_addr_t trb_end, |
| 193 | dma_addr_t curr_seg, dma_addr_t end_seg), |
| 194 | TP_ARGS(suspect, trb_start, trb_end, curr_seg, end_seg), |
| 195 | TP_STRUCT__entry( |
| 196 | __field(dma_addr_t, suspect) |
| 197 | __field(dma_addr_t, trb_start) |
| 198 | __field(dma_addr_t, trb_end) |
| 199 | __field(dma_addr_t, curr_seg) |
| 200 | __field(dma_addr_t, end_seg) |
| 201 | ), |
| 202 | TP_fast_assign( |
| 203 | __entry->suspect = suspect; |
| 204 | __entry->trb_start = trb_start; |
| 205 | __entry->trb_end = trb_end; |
| 206 | __entry->curr_seg = curr_seg; |
| 207 | __entry->end_seg = end_seg; |
| 208 | ), |
| 209 | TP_printk("DMA: suspect event: %pad, trb-start: %pad, trb-end %pad, " |
| 210 | "seg-start %pad, seg-end %pad", |
| 211 | &__entry->suspect, &__entry->trb_start, &__entry->trb_end, |
| 212 | &__entry->curr_seg, &__entry->end_seg) |
| 213 | ); |
| 214 | |
| 215 | TRACE_EVENT(cdnsp_port_info, |
| 216 | TP_PROTO(__le32 __iomem *addr, u32 offset, u32 count, u32 rev), |
| 217 | TP_ARGS(addr, offset, count, rev), |
| 218 | TP_STRUCT__entry( |
| 219 | __field(__le32 __iomem *, addr) |
| 220 | __field(u32, offset) |
| 221 | __field(u32, count) |
| 222 | __field(u32, rev) |
| 223 | ), |
| 224 | TP_fast_assign( |
| 225 | __entry->addr = addr; |
| 226 | __entry->offset = offset; |
| 227 | __entry->count = count; |
| 228 | __entry->rev = rev; |
| 229 | ), |
| 230 | TP_printk("Ext Cap %p, port offset = %u, count = %u, rev = 0x%x", |
| 231 | __entry->addr, __entry->offset, __entry->count, __entry->rev) |
| 232 | ); |
| 233 | |
| 234 | DECLARE_EVENT_CLASS(cdnsp_log_deq_state, |
| 235 | TP_PROTO(struct cdnsp_dequeue_state *state), |
| 236 | TP_ARGS(state), |
| 237 | TP_STRUCT__entry( |
| 238 | __field(int, new_cycle_state) |
| 239 | __field(struct cdnsp_segment *, new_deq_seg) |
| 240 | __field(dma_addr_t, deq_seg_dma) |
| 241 | __field(union cdnsp_trb *, new_deq_ptr) |
| 242 | __field(dma_addr_t, deq_ptr_dma) |
| 243 | ), |
| 244 | TP_fast_assign( |
| 245 | __entry->new_cycle_state = state->new_cycle_state; |
| 246 | __entry->new_deq_seg = state->new_deq_seg; |
| 247 | __entry->deq_seg_dma = state->new_deq_seg->dma; |
| 248 | __entry->new_deq_ptr = state->new_deq_ptr, |
| 249 | __entry->deq_ptr_dma = cdnsp_trb_virt_to_dma(state->new_deq_seg, |
| 250 | state->new_deq_ptr); |
| 251 | ), |
| 252 | TP_printk("New cycle state = 0x%x, New dequeue segment = %p (0x%pad dma), " |
| 253 | "New dequeue pointer = %p (0x%pad dma)", |
| 254 | __entry->new_cycle_state, __entry->new_deq_seg, |
| 255 | &__entry->deq_seg_dma, __entry->new_deq_ptr, |
| 256 | &__entry->deq_ptr_dma |
| 257 | ) |
| 258 | ); |
| 259 | |
| 260 | DEFINE_EVENT(cdnsp_log_deq_state, cdnsp_new_deq_state, |
| 261 | TP_PROTO(struct cdnsp_dequeue_state *state), |
| 262 | TP_ARGS(state) |
| 263 | ); |
| 264 | |
| 265 | DECLARE_EVENT_CLASS(cdnsp_log_ctrl, |
| 266 | TP_PROTO(struct usb_ctrlrequest *ctrl), |
| 267 | TP_ARGS(ctrl), |
| 268 | TP_STRUCT__entry( |
| 269 | __field(u8, bRequestType) |
| 270 | __field(u8, bRequest) |
| 271 | __field(u16, wValue) |
| 272 | __field(u16, wIndex) |
| 273 | __field(u16, wLength) |
| 274 | __dynamic_array(char, str, CDNSP_MSG_MAX) |
| 275 | ), |
| 276 | TP_fast_assign( |
| 277 | __entry->bRequestType = ctrl->bRequestType; |
| 278 | __entry->bRequest = ctrl->bRequest; |
| 279 | __entry->wValue = le16_to_cpu(ctrl->wValue); |
| 280 | __entry->wIndex = le16_to_cpu(ctrl->wIndex); |
| 281 | __entry->wLength = le16_to_cpu(ctrl->wLength); |
| 282 | ), |
| 283 | TP_printk("%s", usb_decode_ctrl(__get_str(str), CDNSP_MSG_MAX, |
| 284 | __entry->bRequestType, |
| 285 | __entry->bRequest, __entry->wValue, |
| 286 | __entry->wIndex, __entry->wLength) |
| 287 | ) |
| 288 | ); |
| 289 | |
| 290 | DEFINE_EVENT(cdnsp_log_ctrl, cdnsp_ctrl_req, |
| 291 | TP_PROTO(struct usb_ctrlrequest *ctrl), |
| 292 | TP_ARGS(ctrl) |
| 293 | ); |
| 294 | |
| 295 | DECLARE_EVENT_CLASS(cdnsp_log_bounce, |
| 296 | TP_PROTO(struct cdnsp_request *preq, u32 new_buf_len, u32 offset, |
| 297 | dma_addr_t dma, unsigned int unalign), |
| 298 | TP_ARGS(preq, new_buf_len, offset, dma, unalign), |
| 299 | TP_STRUCT__entry( |
| 300 | __string(name, preq->pep->name) |
| 301 | __field(u32, new_buf_len) |
| 302 | __field(u32, offset) |
| 303 | __field(dma_addr_t, dma) |
| 304 | __field(unsigned int, unalign) |
| 305 | ), |
| 306 | TP_fast_assign( |
| 307 | __assign_str(name, preq->pep->name); |
| 308 | __entry->new_buf_len = new_buf_len; |
| 309 | __entry->offset = offset; |
| 310 | __entry->dma = dma; |
| 311 | __entry->unalign = unalign; |
| 312 | ), |
| 313 | TP_printk("%s buf len %d, offset %d, dma %pad, unalign %d", |
| 314 | __get_str(name), __entry->new_buf_len, |
| 315 | __entry->offset, &__entry->dma, __entry->unalign |
| 316 | ) |
| 317 | ); |
| 318 | |
| 319 | DEFINE_EVENT(cdnsp_log_bounce, cdnsp_bounce_align_td_split, |
| 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_map, |
| 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 | DEFINE_EVENT(cdnsp_log_bounce, cdnsp_bounce_unmap, |
| 332 | TP_PROTO(struct cdnsp_request *preq, u32 new_buf_len, u32 offset, |
| 333 | dma_addr_t dma, unsigned int unalign), |
| 334 | TP_ARGS(preq, new_buf_len, offset, dma, unalign) |
| 335 | ); |
| 336 | |
| 337 | DECLARE_EVENT_CLASS(cdnsp_log_trb, |
| 338 | TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb), |
| 339 | TP_ARGS(ring, trb), |
| 340 | TP_STRUCT__entry( |
| 341 | __field(u32, type) |
| 342 | __field(u32, field0) |
| 343 | __field(u32, field1) |
| 344 | __field(u32, field2) |
| 345 | __field(u32, field3) |
| 346 | __field(union cdnsp_trb *, trb) |
| 347 | __field(dma_addr_t, trb_dma) |
| 348 | __dynamic_array(char, str, CDNSP_MSG_MAX) |
| 349 | ), |
| 350 | TP_fast_assign( |
| 351 | __entry->type = ring->type; |
| 352 | __entry->field0 = le32_to_cpu(trb->field[0]); |
| 353 | __entry->field1 = le32_to_cpu(trb->field[1]); |
| 354 | __entry->field2 = le32_to_cpu(trb->field[2]); |
| 355 | __entry->field3 = le32_to_cpu(trb->field[3]); |
| 356 | __entry->trb = (union cdnsp_trb *)trb; |
| 357 | __entry->trb_dma = cdnsp_trb_virt_to_dma(ring->deq_seg, |
| 358 | (union cdnsp_trb *)trb); |
| 359 | |
| 360 | ), |
| 361 | TP_printk("%s: %s trb: %p(%pad)", cdnsp_ring_type_string(__entry->type), |
| 362 | cdnsp_decode_trb(__get_str(str), CDNSP_MSG_MAX, |
| 363 | __entry->field0, __entry->field1, |
| 364 | __entry->field2, __entry->field3), |
| 365 | __entry->trb, &__entry->trb_dma |
| 366 | ) |
| 367 | ); |
| 368 | |
| 369 | DEFINE_EVENT(cdnsp_log_trb, cdnsp_handle_event, |
| 370 | TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb), |
| 371 | TP_ARGS(ring, trb) |
| 372 | ); |
| 373 | |
| 374 | DEFINE_EVENT(cdnsp_log_trb, cdnsp_trb_without_td, |
| 375 | TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb), |
| 376 | TP_ARGS(ring, trb) |
| 377 | ); |
| 378 | |
| 379 | DEFINE_EVENT(cdnsp_log_trb, cdnsp_handle_command, |
| 380 | TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb), |
| 381 | TP_ARGS(ring, trb) |
| 382 | ); |
| 383 | |
| 384 | DEFINE_EVENT(cdnsp_log_trb, cdnsp_handle_transfer, |
| 385 | TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb), |
| 386 | TP_ARGS(ring, trb) |
| 387 | ); |
| 388 | |
| 389 | DEFINE_EVENT(cdnsp_log_trb, cdnsp_queue_trb, |
| 390 | TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb), |
| 391 | TP_ARGS(ring, trb) |
| 392 | ); |
| 393 | |
| 394 | DEFINE_EVENT(cdnsp_log_trb, cdnsp_cmd_wait_for_compl, |
| 395 | TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb), |
| 396 | TP_ARGS(ring, trb) |
| 397 | ); |
| 398 | |
| 399 | DEFINE_EVENT(cdnsp_log_trb, cdnsp_cmd_timeout, |
| 400 | TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb), |
| 401 | TP_ARGS(ring, trb) |
| 402 | ); |
| 403 | |
| 404 | DEFINE_EVENT(cdnsp_log_trb, cdnsp_defered_event, |
| 405 | TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb), |
| 406 | TP_ARGS(ring, trb) |
| 407 | ); |
| 408 | |
| 409 | DECLARE_EVENT_CLASS(cdnsp_log_pdev, |
| 410 | TP_PROTO(struct cdnsp_device *pdev), |
| 411 | TP_ARGS(pdev), |
| 412 | TP_STRUCT__entry( |
| 413 | __field(struct cdnsp_device *, pdev) |
| 414 | __field(struct usb_gadget *, gadget) |
| 415 | __field(dma_addr_t, out_ctx) |
| 416 | __field(dma_addr_t, in_ctx) |
| 417 | __field(u8, port_num) |
| 418 | ), |
| 419 | TP_fast_assign( |
| 420 | __entry->pdev = pdev; |
| 421 | __entry->gadget = &pdev->gadget; |
| 422 | __entry->in_ctx = pdev->in_ctx.dma; |
| 423 | __entry->out_ctx = pdev->out_ctx.dma; |
| 424 | __entry->port_num = pdev->active_port ? |
| 425 | pdev->active_port->port_num : 0xFF; |
| 426 | ), |
| 427 | TP_printk("pdev %p gadget %p ctx %pad | %pad, port %d ", |
| 428 | __entry->pdev, __entry->gadget, &__entry->in_ctx, |
| 429 | &__entry->out_ctx, __entry->port_num |
| 430 | ) |
| 431 | ); |
| 432 | |
| 433 | DEFINE_EVENT(cdnsp_log_pdev, cdnsp_alloc_priv_device, |
| 434 | TP_PROTO(struct cdnsp_device *vdev), |
| 435 | TP_ARGS(vdev) |
| 436 | ); |
| 437 | |
| 438 | DEFINE_EVENT(cdnsp_log_pdev, cdnsp_free_priv_device, |
| 439 | TP_PROTO(struct cdnsp_device *vdev), |
| 440 | TP_ARGS(vdev) |
| 441 | ); |
| 442 | |
| 443 | DEFINE_EVENT(cdnsp_log_pdev, cdnsp_setup_device, |
| 444 | TP_PROTO(struct cdnsp_device *vdev), |
| 445 | TP_ARGS(vdev) |
| 446 | ); |
| 447 | |
| 448 | DEFINE_EVENT(cdnsp_log_pdev, cdnsp_setup_addressable_priv_device, |
| 449 | TP_PROTO(struct cdnsp_device *vdev), |
| 450 | TP_ARGS(vdev) |
| 451 | ); |
| 452 | |
| 453 | DECLARE_EVENT_CLASS(cdnsp_log_request, |
| 454 | TP_PROTO(struct cdnsp_request *req), |
| 455 | TP_ARGS(req), |
| 456 | TP_STRUCT__entry( |
| 457 | __string(name, req->pep->name) |
| 458 | __field(struct usb_request *, request) |
| 459 | __field(struct cdnsp_request *, preq) |
| 460 | __field(void *, buf) |
| 461 | __field(unsigned int, actual) |
| 462 | __field(unsigned int, length) |
| 463 | __field(int, status) |
| 464 | __field(dma_addr_t, dma) |
| 465 | __field(unsigned int, stream_id) |
| 466 | __field(unsigned int, zero) |
| 467 | __field(unsigned int, short_not_ok) |
| 468 | __field(unsigned int, no_interrupt) |
| 469 | __field(struct scatterlist*, sg) |
| 470 | __field(unsigned int, num_sgs) |
| 471 | __field(unsigned int, num_mapped_sgs) |
| 472 | |
| 473 | ), |
| 474 | TP_fast_assign( |
| 475 | __assign_str(name, req->pep->name); |
| 476 | __entry->request = &req->request; |
| 477 | __entry->preq = req; |
| 478 | __entry->buf = req->request.buf; |
| 479 | __entry->actual = req->request.actual; |
| 480 | __entry->length = req->request.length; |
| 481 | __entry->status = req->request.status; |
| 482 | __entry->dma = req->request.dma; |
| 483 | __entry->stream_id = req->request.stream_id; |
| 484 | __entry->zero = req->request.zero; |
| 485 | __entry->short_not_ok = req->request.short_not_ok; |
| 486 | __entry->no_interrupt = req->request.no_interrupt; |
| 487 | __entry->sg = req->request.sg; |
| 488 | __entry->num_sgs = req->request.num_sgs; |
| 489 | __entry->num_mapped_sgs = req->request.num_mapped_sgs; |
| 490 | ), |
| 491 | TP_printk("%s; req U:%p/P:%p, req buf %p, length %u/%u, status %d, " |
| 492 | "buf dma (%pad), SID %u, %s%s%s, sg %p, num_sg %d," |
| 493 | " num_m_sg %d", |
| 494 | __get_str(name), __entry->request, __entry->preq, |
| 495 | __entry->buf, __entry->actual, __entry->length, |
| 496 | __entry->status, &__entry->dma, |
| 497 | __entry->stream_id, __entry->zero ? "Z" : "z", |
| 498 | __entry->short_not_ok ? "S" : "s", |
| 499 | __entry->no_interrupt ? "I" : "i", |
| 500 | __entry->sg, __entry->num_sgs, __entry->num_mapped_sgs |
| 501 | ) |
| 502 | ); |
| 503 | |
| 504 | DEFINE_EVENT(cdnsp_log_request, cdnsp_request_enqueue, |
| 505 | TP_PROTO(struct cdnsp_request *req), |
| 506 | TP_ARGS(req) |
| 507 | ); |
| 508 | |
| 509 | DEFINE_EVENT(cdnsp_log_request, cdnsp_request_enqueue_busy, |
| 510 | TP_PROTO(struct cdnsp_request *req), |
| 511 | TP_ARGS(req) |
| 512 | ); |
| 513 | |
| 514 | DEFINE_EVENT(cdnsp_log_request, cdnsp_request_enqueue_error, |
| 515 | TP_PROTO(struct cdnsp_request *req), |
| 516 | TP_ARGS(req) |
| 517 | ); |
| 518 | |
| 519 | DEFINE_EVENT(cdnsp_log_request, cdnsp_request_dequeue, |
| 520 | TP_PROTO(struct cdnsp_request *req), |
| 521 | TP_ARGS(req) |
| 522 | ); |
| 523 | |
| 524 | DEFINE_EVENT(cdnsp_log_request, cdnsp_request_giveback, |
| 525 | TP_PROTO(struct cdnsp_request *req), |
| 526 | TP_ARGS(req) |
| 527 | ); |
| 528 | |
| 529 | DEFINE_EVENT(cdnsp_log_request, cdnsp_alloc_request, |
| 530 | TP_PROTO(struct cdnsp_request *req), |
| 531 | TP_ARGS(req) |
| 532 | ); |
| 533 | |
| 534 | DEFINE_EVENT(cdnsp_log_request, cdnsp_free_request, |
| 535 | TP_PROTO(struct cdnsp_request *req), |
| 536 | TP_ARGS(req) |
| 537 | ); |
| 538 | |
| 539 | DECLARE_EVENT_CLASS(cdnsp_log_ep_ctx, |
| 540 | TP_PROTO(struct cdnsp_ep_ctx *ctx), |
| 541 | TP_ARGS(ctx), |
| 542 | TP_STRUCT__entry( |
| 543 | __field(u32, info) |
| 544 | __field(u32, info2) |
| 545 | __field(u64, deq) |
| 546 | __field(u32, tx_info) |
| 547 | __dynamic_array(char, str, CDNSP_MSG_MAX) |
| 548 | ), |
| 549 | TP_fast_assign( |
| 550 | __entry->info = le32_to_cpu(ctx->ep_info); |
| 551 | __entry->info2 = le32_to_cpu(ctx->ep_info2); |
| 552 | __entry->deq = le64_to_cpu(ctx->deq); |
| 553 | __entry->tx_info = le32_to_cpu(ctx->tx_info); |
| 554 | ), |
| 555 | TP_printk("%s", cdnsp_decode_ep_context(__get_str(str), CDNSP_MSG_MAX, |
| 556 | __entry->info, __entry->info2, |
| 557 | __entry->deq, __entry->tx_info) |
| 558 | ) |
| 559 | ); |
| 560 | |
| 561 | DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_ep_disabled, |
| 562 | TP_PROTO(struct cdnsp_ep_ctx *ctx), |
| 563 | TP_ARGS(ctx) |
| 564 | ); |
| 565 | |
| 566 | DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_ep_stopped_or_disabled, |
| 567 | TP_PROTO(struct cdnsp_ep_ctx *ctx), |
| 568 | TP_ARGS(ctx) |
| 569 | ); |
| 570 | |
| 571 | DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_remove_request, |
| 572 | TP_PROTO(struct cdnsp_ep_ctx *ctx), |
| 573 | TP_ARGS(ctx) |
| 574 | ); |
| 575 | |
| 576 | DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_stop_ep, |
| 577 | TP_PROTO(struct cdnsp_ep_ctx *ctx), |
| 578 | TP_ARGS(ctx) |
| 579 | ); |
| 580 | |
| 581 | DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_flush_ep, |
| 582 | TP_PROTO(struct cdnsp_ep_ctx *ctx), |
| 583 | TP_ARGS(ctx) |
| 584 | ); |
| 585 | |
| 586 | DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_set_deq_ep, |
| 587 | TP_PROTO(struct cdnsp_ep_ctx *ctx), |
| 588 | TP_ARGS(ctx) |
| 589 | ); |
| 590 | |
| 591 | DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_reset_ep, |
| 592 | TP_PROTO(struct cdnsp_ep_ctx *ctx), |
| 593 | TP_ARGS(ctx) |
| 594 | ); |
| 595 | |
| 596 | DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_config_ep, |
| 597 | TP_PROTO(struct cdnsp_ep_ctx *ctx), |
| 598 | TP_ARGS(ctx) |
| 599 | ); |
| 600 | |
| 601 | DECLARE_EVENT_CLASS(cdnsp_log_slot_ctx, |
| 602 | TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 603 | TP_ARGS(ctx), |
| 604 | TP_STRUCT__entry( |
| 605 | __field(u32, info) |
| 606 | __field(u32, info2) |
| 607 | __field(u32, int_target) |
| 608 | __field(u32, state) |
| 609 | ), |
| 610 | TP_fast_assign( |
| 611 | __entry->info = le32_to_cpu(ctx->dev_info); |
| 612 | __entry->info2 = le32_to_cpu(ctx->dev_port); |
Pawel Laszczak | 16e3610 | 2020-12-14 13:03:44 +0100 | [diff] [blame] | 613 | __entry->int_target = le32_to_cpu(ctx->int_target); |
Pawel Laszczak | 118b2a3 | 2020-12-07 11:32:25 +0100 | [diff] [blame] | 614 | __entry->state = le32_to_cpu(ctx->dev_state); |
| 615 | ), |
| 616 | TP_printk("%s", cdnsp_decode_slot_context(__entry->info, |
| 617 | __entry->info2, |
| 618 | __entry->int_target, |
| 619 | __entry->state) |
| 620 | ) |
| 621 | ); |
| 622 | |
| 623 | DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_slot_already_in_default, |
| 624 | TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 625 | TP_ARGS(ctx) |
| 626 | ); |
| 627 | |
| 628 | DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_enable_slot, |
| 629 | TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 630 | TP_ARGS(ctx) |
| 631 | ); |
| 632 | |
| 633 | DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_disable_slot, |
| 634 | TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 635 | TP_ARGS(ctx) |
| 636 | ); |
| 637 | |
| 638 | DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_reset_device, |
| 639 | TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 640 | TP_ARGS(ctx) |
| 641 | ); |
| 642 | |
| 643 | DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_setup_device_slot, |
| 644 | TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 645 | TP_ARGS(ctx) |
| 646 | ); |
| 647 | |
| 648 | DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_addr_dev, |
| 649 | TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 650 | TP_ARGS(ctx) |
| 651 | ); |
| 652 | |
| 653 | DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_reset_dev, |
| 654 | TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 655 | TP_ARGS(ctx) |
| 656 | ); |
| 657 | |
| 658 | DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_set_deq, |
| 659 | TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 660 | TP_ARGS(ctx) |
| 661 | ); |
| 662 | |
| 663 | DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_configure_endpoint, |
| 664 | TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 665 | TP_ARGS(ctx) |
| 666 | ); |
| 667 | |
| 668 | DECLARE_EVENT_CLASS(cdnsp_log_td_info, |
| 669 | TP_PROTO(struct cdnsp_request *preq), |
| 670 | TP_ARGS(preq), |
| 671 | TP_STRUCT__entry( |
| 672 | __string(name, preq->pep->name) |
| 673 | __field(struct usb_request *, request) |
| 674 | __field(struct cdnsp_request *, preq) |
| 675 | __field(union cdnsp_trb *, first_trb) |
| 676 | __field(union cdnsp_trb *, last_trb) |
| 677 | __field(dma_addr_t, trb_dma) |
| 678 | ), |
| 679 | TP_fast_assign( |
| 680 | __assign_str(name, preq->pep->name); |
| 681 | __entry->request = &preq->request; |
| 682 | __entry->preq = preq; |
| 683 | __entry->first_trb = preq->td.first_trb; |
| 684 | __entry->last_trb = preq->td.last_trb; |
| 685 | __entry->trb_dma = cdnsp_trb_virt_to_dma(preq->td.start_seg, |
| 686 | preq->td.first_trb) |
| 687 | ), |
| 688 | TP_printk("%s req/preq: %p/%p, first trb %p[vir]/%pad(dma), last trb %p", |
| 689 | __get_str(name), __entry->request, __entry->preq, |
| 690 | __entry->first_trb, &__entry->trb_dma, |
| 691 | __entry->last_trb |
| 692 | ) |
| 693 | ); |
| 694 | |
| 695 | DEFINE_EVENT(cdnsp_log_td_info, cdnsp_remove_request_td, |
| 696 | TP_PROTO(struct cdnsp_request *preq), |
| 697 | TP_ARGS(preq) |
| 698 | ); |
| 699 | |
| 700 | DECLARE_EVENT_CLASS(cdnsp_log_ring, |
| 701 | TP_PROTO(struct cdnsp_ring *ring), |
| 702 | TP_ARGS(ring), |
| 703 | TP_STRUCT__entry( |
| 704 | __field(u32, type) |
| 705 | __field(void *, ring) |
| 706 | __field(dma_addr_t, enq) |
| 707 | __field(dma_addr_t, deq) |
| 708 | __field(dma_addr_t, enq_seg) |
| 709 | __field(dma_addr_t, deq_seg) |
| 710 | __field(unsigned int, num_segs) |
| 711 | __field(unsigned int, stream_id) |
| 712 | __field(unsigned int, cycle_state) |
| 713 | __field(unsigned int, num_trbs_free) |
| 714 | __field(unsigned int, bounce_buf_len) |
| 715 | ), |
| 716 | TP_fast_assign( |
| 717 | __entry->ring = ring; |
| 718 | __entry->type = ring->type; |
| 719 | __entry->num_segs = ring->num_segs; |
| 720 | __entry->stream_id = ring->stream_id; |
| 721 | __entry->enq_seg = ring->enq_seg->dma; |
| 722 | __entry->deq_seg = ring->deq_seg->dma; |
| 723 | __entry->cycle_state = ring->cycle_state; |
| 724 | __entry->num_trbs_free = ring->num_trbs_free; |
| 725 | __entry->bounce_buf_len = ring->bounce_buf_len; |
| 726 | __entry->enq = cdnsp_trb_virt_to_dma(ring->enq_seg, |
| 727 | ring->enqueue); |
| 728 | __entry->deq = cdnsp_trb_virt_to_dma(ring->deq_seg, |
| 729 | ring->dequeue); |
| 730 | ), |
| 731 | TP_printk("%s %p: enq %pad(%pad) deq %pad(%pad) segs %d stream %d" |
| 732 | " free_trbs %d bounce %d cycle %d", |
| 733 | cdnsp_ring_type_string(__entry->type), __entry->ring, |
| 734 | &__entry->enq, &__entry->enq_seg, |
| 735 | &__entry->deq, &__entry->deq_seg, |
| 736 | __entry->num_segs, |
| 737 | __entry->stream_id, |
| 738 | __entry->num_trbs_free, |
| 739 | __entry->bounce_buf_len, |
| 740 | __entry->cycle_state |
| 741 | ) |
| 742 | ); |
| 743 | |
| 744 | DEFINE_EVENT(cdnsp_log_ring, cdnsp_ring_alloc, |
| 745 | TP_PROTO(struct cdnsp_ring *ring), |
| 746 | TP_ARGS(ring) |
| 747 | ); |
| 748 | |
| 749 | DEFINE_EVENT(cdnsp_log_ring, cdnsp_ring_free, |
| 750 | TP_PROTO(struct cdnsp_ring *ring), |
| 751 | TP_ARGS(ring) |
| 752 | ); |
| 753 | |
| 754 | DEFINE_EVENT(cdnsp_log_ring, cdnsp_set_stream_ring, |
| 755 | TP_PROTO(struct cdnsp_ring *ring), |
| 756 | TP_ARGS(ring) |
| 757 | ); |
| 758 | |
| 759 | DEFINE_EVENT(cdnsp_log_ring, cdnsp_ring_expansion, |
| 760 | TP_PROTO(struct cdnsp_ring *ring), |
| 761 | TP_ARGS(ring) |
| 762 | ); |
| 763 | |
| 764 | DEFINE_EVENT(cdnsp_log_ring, cdnsp_inc_enq, |
| 765 | TP_PROTO(struct cdnsp_ring *ring), |
| 766 | TP_ARGS(ring) |
| 767 | ); |
| 768 | |
| 769 | DEFINE_EVENT(cdnsp_log_ring, cdnsp_inc_deq, |
| 770 | TP_PROTO(struct cdnsp_ring *ring), |
| 771 | TP_ARGS(ring) |
| 772 | ); |
| 773 | |
| 774 | DECLARE_EVENT_CLASS(cdnsp_log_portsc, |
| 775 | TP_PROTO(u32 portnum, u32 portsc), |
| 776 | TP_ARGS(portnum, portsc), |
| 777 | TP_STRUCT__entry( |
| 778 | __field(u32, portnum) |
| 779 | __field(u32, portsc) |
| 780 | __dynamic_array(char, str, CDNSP_MSG_MAX) |
| 781 | ), |
| 782 | TP_fast_assign( |
| 783 | __entry->portnum = portnum; |
| 784 | __entry->portsc = portsc; |
| 785 | ), |
| 786 | TP_printk("port-%d: %s", |
| 787 | __entry->portnum, |
| 788 | cdnsp_decode_portsc(__get_str(str), CDNSP_MSG_MAX, |
| 789 | __entry->portsc) |
| 790 | ) |
| 791 | ); |
| 792 | |
| 793 | DEFINE_EVENT(cdnsp_log_portsc, cdnsp_handle_port_status, |
| 794 | TP_PROTO(u32 portnum, u32 portsc), |
| 795 | TP_ARGS(portnum, portsc) |
| 796 | ); |
| 797 | |
| 798 | DEFINE_EVENT(cdnsp_log_portsc, cdnsp_link_state_changed, |
| 799 | TP_PROTO(u32 portnum, u32 portsc), |
| 800 | TP_ARGS(portnum, portsc) |
| 801 | ); |
| 802 | |
| 803 | TRACE_EVENT(cdnsp_stream_number, |
| 804 | TP_PROTO(struct cdnsp_ep *pep, int num_stream_ctxs, int num_streams), |
| 805 | TP_ARGS(pep, num_stream_ctxs, num_streams), |
| 806 | TP_STRUCT__entry( |
| 807 | __string(name, pep->name) |
| 808 | __field(int, num_stream_ctxs) |
| 809 | __field(int, num_streams) |
| 810 | ), |
| 811 | TP_fast_assign( |
| 812 | __entry->num_stream_ctxs = num_stream_ctxs; |
| 813 | __entry->num_streams = num_streams; |
| 814 | ), |
| 815 | TP_printk("%s Need %u stream ctx entries for %u stream IDs.", |
| 816 | __get_str(name), __entry->num_stream_ctxs, |
| 817 | __entry->num_streams) |
| 818 | ); |
| 819 | |
| 820 | #endif /* __CDNSP_TRACE_H */ |
| 821 | |
| 822 | /* this part must be outside header guard */ |
| 823 | |
| 824 | #undef TRACE_INCLUDE_PATH |
| 825 | #define TRACE_INCLUDE_PATH . |
| 826 | |
| 827 | #undef TRACE_INCLUDE_FILE |
| 828 | #define TRACE_INCLUDE_FILE cdnsp-trace |
| 829 | |
| 830 | #include <trace/define_trace.h> |