Greg Kroah-Hartman | 5fd54ac | 2017-11-03 11:28:30 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Xenia Ragiadakou | 84a99f6 | 2013-08-06 00:22:15 +0300 | [diff] [blame] | 2 | /* |
| 3 | * xHCI host controller driver |
| 4 | * |
| 5 | * Copyright (C) 2013 Xenia Ragiadakou |
| 6 | * |
| 7 | * Author: Xenia Ragiadakou |
| 8 | * Email : burzalodowa@gmail.com |
Xenia Ragiadakou | 84a99f6 | 2013-08-06 00:22:15 +0300 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #undef TRACE_SYSTEM |
| 12 | #define TRACE_SYSTEM xhci-hcd |
| 13 | |
Steven Rostedt (Red Hat) | 7267b23 | 2015-04-01 14:22:01 -0400 | [diff] [blame] | 14 | /* |
| 15 | * The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a |
| 16 | * legitimate C variable. It is not exported to user space. |
| 17 | */ |
| 18 | #undef TRACE_SYSTEM_VAR |
| 19 | #define TRACE_SYSTEM_VAR xhci_hcd |
| 20 | |
Xenia Ragiadakou | 84a99f6 | 2013-08-06 00:22:15 +0300 | [diff] [blame] | 21 | #if !defined(__XHCI_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) |
| 22 | #define __XHCI_TRACE_H |
| 23 | |
| 24 | #include <linux/tracepoint.h> |
Xenia Ragiadakou | 1d27fab | 2013-08-06 07:52:47 +0300 | [diff] [blame] | 25 | #include "xhci.h" |
Xenia Ragiadakou | 84a99f6 | 2013-08-06 00:22:15 +0300 | [diff] [blame] | 26 | |
| 27 | #define XHCI_MSG_MAX 500 |
| 28 | |
| 29 | DECLARE_EVENT_CLASS(xhci_log_msg, |
| 30 | TP_PROTO(struct va_format *vaf), |
| 31 | TP_ARGS(vaf), |
| 32 | TP_STRUCT__entry(__dynamic_array(char, msg, XHCI_MSG_MAX)), |
| 33 | TP_fast_assign( |
| 34 | vsnprintf(__get_str(msg), XHCI_MSG_MAX, vaf->fmt, *vaf->va); |
| 35 | ), |
| 36 | TP_printk("%s", __get_str(msg)) |
| 37 | ); |
| 38 | |
| 39 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_address, |
| 40 | TP_PROTO(struct va_format *vaf), |
| 41 | TP_ARGS(vaf) |
| 42 | ); |
| 43 | |
Xenia Ragiadakou | 3a7fa5b | 2013-07-31 07:35:27 +0300 | [diff] [blame] | 44 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_context_change, |
| 45 | TP_PROTO(struct va_format *vaf), |
| 46 | TP_ARGS(vaf) |
| 47 | ); |
| 48 | |
Xenia Ragiadakou | 4bdfe4c | 2013-08-06 07:52:45 +0300 | [diff] [blame] | 49 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_quirks, |
| 50 | TP_PROTO(struct va_format *vaf), |
| 51 | TP_ARGS(vaf) |
| 52 | ); |
| 53 | |
Xenia Ragiadakou | a025432 | 2013-08-06 07:52:46 +0300 | [diff] [blame] | 54 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_reset_ep, |
| 55 | TP_PROTO(struct va_format *vaf), |
| 56 | TP_ARGS(vaf) |
| 57 | ); |
| 58 | |
Xenia Ragiadakou | aa50b29 | 2013-08-14 06:33:54 +0300 | [diff] [blame] | 59 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_cancel_urb, |
| 60 | TP_PROTO(struct va_format *vaf), |
| 61 | TP_ARGS(vaf) |
| 62 | ); |
| 63 | |
Xenia Ragiadakou | d195fcf | 2013-08-14 06:33:55 +0300 | [diff] [blame] | 64 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_init, |
| 65 | TP_PROTO(struct va_format *vaf), |
| 66 | TP_ARGS(vaf) |
| 67 | ); |
| 68 | |
Xenia Ragiadakou | 68ffb01 | 2013-08-14 06:33:56 +0300 | [diff] [blame] | 69 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_ring_expansion, |
| 70 | TP_PROTO(struct va_format *vaf), |
| 71 | TP_ARGS(vaf) |
| 72 | ); |
| 73 | |
Xenia Ragiadakou | 1d27fab | 2013-08-06 07:52:47 +0300 | [diff] [blame] | 74 | DECLARE_EVENT_CLASS(xhci_log_ctx, |
| 75 | TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, |
| 76 | unsigned int ep_num), |
| 77 | TP_ARGS(xhci, ctx, ep_num), |
| 78 | TP_STRUCT__entry( |
| 79 | __field(int, ctx_64) |
| 80 | __field(unsigned, ctx_type) |
| 81 | __field(dma_addr_t, ctx_dma) |
| 82 | __field(u8 *, ctx_va) |
| 83 | __field(unsigned, ctx_ep_num) |
| 84 | __field(int, slot_id) |
| 85 | __dynamic_array(u32, ctx_data, |
| 86 | ((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 8) * |
| 87 | ((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1)) |
| 88 | ), |
| 89 | TP_fast_assign( |
| 90 | struct usb_device *udev; |
| 91 | |
| 92 | udev = to_usb_device(xhci_to_hcd(xhci)->self.controller); |
| 93 | __entry->ctx_64 = HCC_64BYTE_CONTEXT(xhci->hcc_params); |
| 94 | __entry->ctx_type = ctx->type; |
| 95 | __entry->ctx_dma = ctx->dma; |
| 96 | __entry->ctx_va = ctx->bytes; |
| 97 | __entry->slot_id = udev->slot_id; |
| 98 | __entry->ctx_ep_num = ep_num; |
| 99 | memcpy(__get_dynamic_array(ctx_data), ctx->bytes, |
| 100 | ((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 32) * |
| 101 | ((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1)); |
| 102 | ), |
Felipe Balbi | d4d93e6 | 2017-01-23 14:20:22 +0200 | [diff] [blame] | 103 | TP_printk("ctx_64=%d, ctx_type=%u, ctx_dma=@%llx, ctx_va=@%p", |
Xenia Ragiadakou | 1d27fab | 2013-08-06 07:52:47 +0300 | [diff] [blame] | 104 | __entry->ctx_64, __entry->ctx_type, |
| 105 | (unsigned long long) __entry->ctx_dma, __entry->ctx_va |
| 106 | ) |
| 107 | ); |
| 108 | |
| 109 | DEFINE_EVENT(xhci_log_ctx, xhci_address_ctx, |
| 110 | TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, |
| 111 | unsigned int ep_num), |
| 112 | TP_ARGS(xhci, ctx, ep_num) |
| 113 | ); |
| 114 | |
Felipe Balbi | a37c3f7 | 2017-01-23 14:20:19 +0200 | [diff] [blame] | 115 | DECLARE_EVENT_CLASS(xhci_log_trb, |
| 116 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), |
| 117 | TP_ARGS(ring, trb), |
Xenia Ragiadakou | 63a23b9a | 2013-08-06 07:52:48 +0300 | [diff] [blame] | 118 | TP_STRUCT__entry( |
Felipe Balbi | a37c3f7 | 2017-01-23 14:20:19 +0200 | [diff] [blame] | 119 | __field(u32, type) |
| 120 | __field(u32, field0) |
| 121 | __field(u32, field1) |
| 122 | __field(u32, field2) |
| 123 | __field(u32, field3) |
Xenia Ragiadakou | 63a23b9a | 2013-08-06 07:52:48 +0300 | [diff] [blame] | 124 | ), |
| 125 | TP_fast_assign( |
Felipe Balbi | a37c3f7 | 2017-01-23 14:20:19 +0200 | [diff] [blame] | 126 | __entry->type = ring->type; |
| 127 | __entry->field0 = le32_to_cpu(trb->field[0]); |
| 128 | __entry->field1 = le32_to_cpu(trb->field[1]); |
| 129 | __entry->field2 = le32_to_cpu(trb->field[2]); |
| 130 | __entry->field3 = le32_to_cpu(trb->field[3]); |
Xenia Ragiadakou | 63a23b9a | 2013-08-06 07:52:48 +0300 | [diff] [blame] | 131 | ), |
Felipe Balbi | a37c3f7 | 2017-01-23 14:20:19 +0200 | [diff] [blame] | 132 | TP_printk("%s: %s", xhci_ring_type_string(__entry->type), |
| 133 | xhci_decode_trb(__entry->field0, __entry->field1, |
| 134 | __entry->field2, __entry->field3) |
Xenia Ragiadakou | 63a23b9a | 2013-08-06 07:52:48 +0300 | [diff] [blame] | 135 | ) |
| 136 | ); |
| 137 | |
Felipe Balbi | a37c3f7 | 2017-01-23 14:20:19 +0200 | [diff] [blame] | 138 | DEFINE_EVENT(xhci_log_trb, xhci_handle_event, |
| 139 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), |
| 140 | TP_ARGS(ring, trb) |
| 141 | ); |
| 142 | |
| 143 | DEFINE_EVENT(xhci_log_trb, xhci_handle_command, |
| 144 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), |
| 145 | TP_ARGS(ring, trb) |
| 146 | ); |
| 147 | |
| 148 | DEFINE_EVENT(xhci_log_trb, xhci_handle_transfer, |
| 149 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), |
| 150 | TP_ARGS(ring, trb) |
| 151 | ); |
| 152 | |
| 153 | DEFINE_EVENT(xhci_log_trb, xhci_queue_trb, |
| 154 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), |
| 155 | TP_ARGS(ring, trb) |
Xenia Ragiadakou | 63a23b9a | 2013-08-06 07:52:48 +0300 | [diff] [blame] | 156 | ); |
| 157 | |
Felipe Balbi | a711ede | 2017-01-23 14:20:23 +0200 | [diff] [blame] | 158 | DECLARE_EVENT_CLASS(xhci_log_virt_dev, |
| 159 | TP_PROTO(struct xhci_virt_device *vdev), |
| 160 | TP_ARGS(vdev), |
| 161 | TP_STRUCT__entry( |
| 162 | __field(void *, vdev) |
| 163 | __field(unsigned long long, out_ctx) |
| 164 | __field(unsigned long long, in_ctx) |
| 165 | __field(int, devnum) |
| 166 | __field(int, state) |
| 167 | __field(int, speed) |
| 168 | __field(u8, portnum) |
| 169 | __field(u8, level) |
| 170 | __field(int, slot_id) |
| 171 | ), |
| 172 | TP_fast_assign( |
| 173 | __entry->vdev = vdev; |
| 174 | __entry->in_ctx = (unsigned long long) vdev->in_ctx->dma; |
| 175 | __entry->out_ctx = (unsigned long long) vdev->out_ctx->dma; |
| 176 | __entry->devnum = vdev->udev->devnum; |
| 177 | __entry->state = vdev->udev->state; |
| 178 | __entry->speed = vdev->udev->speed; |
| 179 | __entry->portnum = vdev->udev->portnum; |
| 180 | __entry->level = vdev->udev->level; |
| 181 | __entry->slot_id = vdev->udev->slot_id; |
| 182 | ), |
| 183 | TP_printk("vdev %p ctx %llx | %llx num %d state %d speed %d port %d level %d slot %d", |
| 184 | __entry->vdev, __entry->in_ctx, __entry->out_ctx, |
| 185 | __entry->devnum, __entry->state, __entry->speed, |
| 186 | __entry->portnum, __entry->level, __entry->slot_id |
| 187 | ) |
| 188 | ); |
| 189 | |
| 190 | DEFINE_EVENT(xhci_log_virt_dev, xhci_alloc_virt_device, |
| 191 | TP_PROTO(struct xhci_virt_device *vdev), |
| 192 | TP_ARGS(vdev) |
| 193 | ); |
| 194 | |
| 195 | DEFINE_EVENT(xhci_log_virt_dev, xhci_free_virt_device, |
| 196 | TP_PROTO(struct xhci_virt_device *vdev), |
| 197 | TP_ARGS(vdev) |
| 198 | ); |
| 199 | |
| 200 | DEFINE_EVENT(xhci_log_virt_dev, xhci_setup_device, |
| 201 | TP_PROTO(struct xhci_virt_device *vdev), |
| 202 | TP_ARGS(vdev) |
| 203 | ); |
| 204 | |
| 205 | DEFINE_EVENT(xhci_log_virt_dev, xhci_setup_addressable_virt_device, |
| 206 | TP_PROTO(struct xhci_virt_device *vdev), |
| 207 | TP_ARGS(vdev) |
| 208 | ); |
| 209 | |
| 210 | DEFINE_EVENT(xhci_log_virt_dev, xhci_stop_device, |
| 211 | TP_PROTO(struct xhci_virt_device *vdev), |
| 212 | TP_ARGS(vdev) |
| 213 | ); |
| 214 | |
Felipe Balbi | 5abdc2e | 2017-01-23 14:20:20 +0200 | [diff] [blame] | 215 | DECLARE_EVENT_CLASS(xhci_log_urb, |
| 216 | TP_PROTO(struct urb *urb), |
| 217 | TP_ARGS(urb), |
| 218 | TP_STRUCT__entry( |
| 219 | __field(void *, urb) |
| 220 | __field(unsigned int, pipe) |
| 221 | __field(unsigned int, stream) |
| 222 | __field(int, status) |
| 223 | __field(unsigned int, flags) |
| 224 | __field(int, num_mapped_sgs) |
| 225 | __field(int, num_sgs) |
| 226 | __field(int, length) |
| 227 | __field(int, actual) |
| 228 | __field(int, epnum) |
| 229 | __field(int, dir_in) |
| 230 | __field(int, type) |
Felipe Balbi | eaa9eb7 | 2017-04-07 17:56:55 +0300 | [diff] [blame] | 231 | __field(int, slot_id) |
Felipe Balbi | 5abdc2e | 2017-01-23 14:20:20 +0200 | [diff] [blame] | 232 | ), |
| 233 | TP_fast_assign( |
| 234 | __entry->urb = urb; |
| 235 | __entry->pipe = urb->pipe; |
| 236 | __entry->stream = urb->stream_id; |
| 237 | __entry->status = urb->status; |
| 238 | __entry->flags = urb->transfer_flags; |
| 239 | __entry->num_mapped_sgs = urb->num_mapped_sgs; |
| 240 | __entry->num_sgs = urb->num_sgs; |
| 241 | __entry->length = urb->transfer_buffer_length; |
| 242 | __entry->actual = urb->actual_length; |
| 243 | __entry->epnum = usb_endpoint_num(&urb->ep->desc); |
| 244 | __entry->dir_in = usb_endpoint_dir_in(&urb->ep->desc); |
| 245 | __entry->type = usb_endpoint_type(&urb->ep->desc); |
Felipe Balbi | eaa9eb7 | 2017-04-07 17:56:55 +0300 | [diff] [blame] | 246 | __entry->slot_id = urb->dev->slot_id; |
Felipe Balbi | 5abdc2e | 2017-01-23 14:20:20 +0200 | [diff] [blame] | 247 | ), |
Felipe Balbi | eaa9eb7 | 2017-04-07 17:56:55 +0300 | [diff] [blame] | 248 | TP_printk("ep%d%s-%s: urb %p pipe %u slot %d length %d/%d sgs %d/%d stream %d flags %08x", |
Felipe Balbi | 5abdc2e | 2017-01-23 14:20:20 +0200 | [diff] [blame] | 249 | __entry->epnum, __entry->dir_in ? "in" : "out", |
| 250 | ({ char *s; |
| 251 | switch (__entry->type) { |
| 252 | case USB_ENDPOINT_XFER_INT: |
| 253 | s = "intr"; |
| 254 | break; |
| 255 | case USB_ENDPOINT_XFER_CONTROL: |
| 256 | s = "control"; |
| 257 | break; |
| 258 | case USB_ENDPOINT_XFER_BULK: |
| 259 | s = "bulk"; |
| 260 | break; |
| 261 | case USB_ENDPOINT_XFER_ISOC: |
| 262 | s = "isoc"; |
| 263 | break; |
| 264 | default: |
| 265 | s = "UNKNOWN"; |
Felipe Balbi | eaa9eb7 | 2017-04-07 17:56:55 +0300 | [diff] [blame] | 266 | } s; }), __entry->urb, __entry->pipe, __entry->slot_id, |
| 267 | __entry->actual, __entry->length, __entry->num_mapped_sgs, |
Felipe Balbi | 5abdc2e | 2017-01-23 14:20:20 +0200 | [diff] [blame] | 268 | __entry->num_sgs, __entry->stream, __entry->flags |
| 269 | ) |
| 270 | ); |
| 271 | |
| 272 | DEFINE_EVENT(xhci_log_urb, xhci_urb_enqueue, |
| 273 | TP_PROTO(struct urb *urb), |
| 274 | TP_ARGS(urb) |
| 275 | ); |
| 276 | |
| 277 | DEFINE_EVENT(xhci_log_urb, xhci_urb_giveback, |
| 278 | TP_PROTO(struct urb *urb), |
| 279 | TP_ARGS(urb) |
| 280 | ); |
| 281 | |
| 282 | DEFINE_EVENT(xhci_log_urb, xhci_urb_dequeue, |
| 283 | TP_PROTO(struct urb *urb), |
| 284 | TP_ARGS(urb) |
| 285 | ); |
| 286 | |
Felipe Balbi | 19a7d0d | 2017-04-07 17:56:57 +0300 | [diff] [blame] | 287 | DECLARE_EVENT_CLASS(xhci_log_ep_ctx, |
| 288 | TP_PROTO(struct xhci_ep_ctx *ctx), |
| 289 | TP_ARGS(ctx), |
| 290 | TP_STRUCT__entry( |
| 291 | __field(u32, info) |
| 292 | __field(u32, info2) |
| 293 | __field(u64, deq) |
| 294 | __field(u32, tx_info) |
| 295 | ), |
| 296 | TP_fast_assign( |
| 297 | __entry->info = le32_to_cpu(ctx->ep_info); |
| 298 | __entry->info2 = le32_to_cpu(ctx->ep_info2); |
| 299 | __entry->deq = le64_to_cpu(ctx->deq); |
| 300 | __entry->tx_info = le32_to_cpu(ctx->tx_info); |
| 301 | ), |
| 302 | TP_printk("%s", xhci_decode_ep_context(__entry->info, |
| 303 | __entry->info2, __entry->deq, __entry->tx_info) |
| 304 | ) |
| 305 | ); |
| 306 | |
| 307 | DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_stop_ep, |
| 308 | TP_PROTO(struct xhci_ep_ctx *ctx), |
| 309 | TP_ARGS(ctx) |
| 310 | ); |
| 311 | |
| 312 | DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_set_deq_ep, |
| 313 | TP_PROTO(struct xhci_ep_ctx *ctx), |
| 314 | TP_ARGS(ctx) |
| 315 | ); |
| 316 | |
| 317 | DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_reset_ep, |
| 318 | TP_PROTO(struct xhci_ep_ctx *ctx), |
| 319 | TP_ARGS(ctx) |
| 320 | ); |
| 321 | |
| 322 | DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_config_ep, |
| 323 | TP_PROTO(struct xhci_ep_ctx *ctx), |
| 324 | TP_ARGS(ctx) |
| 325 | ); |
| 326 | |
| 327 | DECLARE_EVENT_CLASS(xhci_log_slot_ctx, |
| 328 | TP_PROTO(struct xhci_slot_ctx *ctx), |
| 329 | TP_ARGS(ctx), |
| 330 | TP_STRUCT__entry( |
| 331 | __field(u32, info) |
| 332 | __field(u32, info2) |
| 333 | __field(u32, tt_info) |
| 334 | __field(u32, state) |
| 335 | ), |
| 336 | TP_fast_assign( |
| 337 | __entry->info = le32_to_cpu(ctx->dev_info); |
| 338 | __entry->info2 = le32_to_cpu(ctx->dev_info2); |
| 339 | __entry->tt_info = le64_to_cpu(ctx->tt_info); |
| 340 | __entry->state = le32_to_cpu(ctx->dev_state); |
| 341 | ), |
| 342 | TP_printk("%s", xhci_decode_slot_context(__entry->info, |
| 343 | __entry->info2, __entry->tt_info, |
| 344 | __entry->state) |
| 345 | ) |
| 346 | ); |
| 347 | |
| 348 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_alloc_dev, |
| 349 | TP_PROTO(struct xhci_slot_ctx *ctx), |
| 350 | TP_ARGS(ctx) |
| 351 | ); |
| 352 | |
| 353 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_free_dev, |
| 354 | TP_PROTO(struct xhci_slot_ctx *ctx), |
| 355 | TP_ARGS(ctx) |
| 356 | ); |
| 357 | |
| 358 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_disable_slot, |
| 359 | TP_PROTO(struct xhci_slot_ctx *ctx), |
| 360 | TP_ARGS(ctx) |
| 361 | ); |
| 362 | |
| 363 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_discover_or_reset_device, |
| 364 | TP_PROTO(struct xhci_slot_ctx *ctx), |
| 365 | TP_ARGS(ctx) |
| 366 | ); |
| 367 | |
| 368 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_setup_device_slot, |
| 369 | TP_PROTO(struct xhci_slot_ctx *ctx), |
| 370 | TP_ARGS(ctx) |
| 371 | ); |
| 372 | |
| 373 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_addr_dev, |
| 374 | TP_PROTO(struct xhci_slot_ctx *ctx), |
| 375 | TP_ARGS(ctx) |
| 376 | ); |
| 377 | |
| 378 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_reset_dev, |
| 379 | TP_PROTO(struct xhci_slot_ctx *ctx), |
| 380 | TP_ARGS(ctx) |
| 381 | ); |
| 382 | |
| 383 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_set_deq, |
| 384 | TP_PROTO(struct xhci_slot_ctx *ctx), |
| 385 | TP_ARGS(ctx) |
| 386 | ); |
| 387 | |
Mathias Nyman | e3a78ff | 2017-10-05 11:21:48 +0300 | [diff] [blame] | 388 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_configure_endpoint, |
| 389 | TP_PROTO(struct xhci_slot_ctx *ctx), |
| 390 | TP_ARGS(ctx) |
| 391 | ); |
| 392 | |
Lu Baolu | b2d6edb | 2017-04-07 17:57:02 +0300 | [diff] [blame] | 393 | DECLARE_EVENT_CLASS(xhci_log_ring, |
| 394 | TP_PROTO(struct xhci_ring *ring), |
| 395 | TP_ARGS(ring), |
| 396 | TP_STRUCT__entry( |
| 397 | __field(u32, type) |
| 398 | __field(void *, ring) |
| 399 | __field(dma_addr_t, enq) |
| 400 | __field(dma_addr_t, deq) |
| 401 | __field(dma_addr_t, enq_seg) |
| 402 | __field(dma_addr_t, deq_seg) |
| 403 | __field(unsigned int, num_segs) |
| 404 | __field(unsigned int, stream_id) |
| 405 | __field(unsigned int, cycle_state) |
| 406 | __field(unsigned int, num_trbs_free) |
| 407 | __field(unsigned int, bounce_buf_len) |
| 408 | ), |
| 409 | TP_fast_assign( |
| 410 | __entry->ring = ring; |
| 411 | __entry->type = ring->type; |
| 412 | __entry->num_segs = ring->num_segs; |
| 413 | __entry->stream_id = ring->stream_id; |
| 414 | __entry->enq_seg = ring->enq_seg->dma; |
| 415 | __entry->deq_seg = ring->deq_seg->dma; |
| 416 | __entry->cycle_state = ring->cycle_state; |
| 417 | __entry->num_trbs_free = ring->num_trbs_free; |
| 418 | __entry->bounce_buf_len = ring->bounce_buf_len; |
| 419 | __entry->enq = xhci_trb_virt_to_dma(ring->enq_seg, ring->enqueue); |
| 420 | __entry->deq = xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue); |
| 421 | ), |
| 422 | TP_printk("%s %p: enq %pad(%pad) deq %pad(%pad) segs %d stream %d free_trbs %d bounce %d cycle %d", |
| 423 | xhci_ring_type_string(__entry->type), __entry->ring, |
| 424 | &__entry->enq, &__entry->enq_seg, |
| 425 | &__entry->deq, &__entry->deq_seg, |
| 426 | __entry->num_segs, |
| 427 | __entry->stream_id, |
| 428 | __entry->num_trbs_free, |
| 429 | __entry->bounce_buf_len, |
| 430 | __entry->cycle_state |
| 431 | ) |
| 432 | ); |
| 433 | |
| 434 | DEFINE_EVENT(xhci_log_ring, xhci_ring_alloc, |
| 435 | TP_PROTO(struct xhci_ring *ring), |
| 436 | TP_ARGS(ring) |
| 437 | ); |
| 438 | |
| 439 | DEFINE_EVENT(xhci_log_ring, xhci_ring_free, |
| 440 | TP_PROTO(struct xhci_ring *ring), |
| 441 | TP_ARGS(ring) |
| 442 | ); |
| 443 | |
| 444 | DEFINE_EVENT(xhci_log_ring, xhci_ring_expansion, |
| 445 | TP_PROTO(struct xhci_ring *ring), |
| 446 | TP_ARGS(ring) |
| 447 | ); |
| 448 | |
| 449 | DEFINE_EVENT(xhci_log_ring, xhci_inc_enq, |
| 450 | TP_PROTO(struct xhci_ring *ring), |
| 451 | TP_ARGS(ring) |
| 452 | ); |
| 453 | |
| 454 | DEFINE_EVENT(xhci_log_ring, xhci_inc_deq, |
| 455 | TP_PROTO(struct xhci_ring *ring), |
| 456 | TP_ARGS(ring) |
| 457 | ); |
Mathias Nyman | 8ca1358 | 2017-08-16 14:23:24 +0300 | [diff] [blame] | 458 | |
| 459 | DECLARE_EVENT_CLASS(xhci_log_portsc, |
| 460 | TP_PROTO(u32 portnum, u32 portsc), |
| 461 | TP_ARGS(portnum, portsc), |
| 462 | TP_STRUCT__entry( |
| 463 | __field(u32, portnum) |
| 464 | __field(u32, portsc) |
| 465 | ), |
| 466 | TP_fast_assign( |
| 467 | __entry->portnum = portnum; |
| 468 | __entry->portsc = portsc; |
| 469 | ), |
| 470 | TP_printk("port-%d: %s", |
| 471 | __entry->portnum, |
| 472 | xhci_decode_portsc(__entry->portsc) |
| 473 | ) |
| 474 | ); |
| 475 | |
| 476 | DEFINE_EVENT(xhci_log_portsc, xhci_handle_port_status, |
| 477 | TP_PROTO(u32 portnum, u32 portsc), |
| 478 | TP_ARGS(portnum, portsc) |
| 479 | ); |
| 480 | |
Xenia Ragiadakou | 84a99f6 | 2013-08-06 00:22:15 +0300 | [diff] [blame] | 481 | #endif /* __XHCI_TRACE_H */ |
| 482 | |
| 483 | /* this part must be outside header guard */ |
| 484 | |
| 485 | #undef TRACE_INCLUDE_PATH |
| 486 | #define TRACE_INCLUDE_PATH . |
| 487 | |
| 488 | #undef TRACE_INCLUDE_FILE |
| 489 | #define TRACE_INCLUDE_FILE xhci-trace |
| 490 | |
| 491 | #include <trace/define_trace.h> |