1 // SPDX-License-Identifier: GPL-2.0-or-later 2 // Copyright (c) 2024 Takashi Sakamoto 3 4 #undef TRACE_SYSTEM 5 #define TRACE_SYSTEM firewire 6 7 #if !defined(_FIREWIRE_TRACE_EVENT_H) || defined(TRACE_HEADER_MULTI_READ) 8 #define _FIREWIRE_TRACE_EVENT_H 9 10 #include <linux/tracepoint.h> 11 #include <linux/firewire.h> 12 13 #include <linux/firewire-constants.h> 14 15 // Some macros are defined in 'drivers/firewire/packet-header-definitions.h'. 16 17 // The content of TP_printk field is preprocessed, then put to the module binary. 18 #define ASYNC_HEADER_GET_DESTINATION(header) \ 19 (((header)[0] & ASYNC_HEADER_Q0_DESTINATION_MASK) >> ASYNC_HEADER_Q0_DESTINATION_SHIFT) 20 21 #define ASYNC_HEADER_GET_TLABEL(header) \ 22 (((header)[0] & ASYNC_HEADER_Q0_TLABEL_MASK) >> ASYNC_HEADER_Q0_TLABEL_SHIFT) 23 24 #define ASYNC_HEADER_GET_TCODE(header) \ 25 (((header)[0] & ASYNC_HEADER_Q0_TCODE_MASK) >> ASYNC_HEADER_Q0_TCODE_SHIFT) 26 27 #define ASYNC_HEADER_GET_SOURCE(header) \ 28 (((header)[1] & ASYNC_HEADER_Q1_SOURCE_MASK) >> ASYNC_HEADER_Q1_SOURCE_SHIFT) 29 30 #define ASYNC_HEADER_GET_OFFSET(header) \ 31 ((((unsigned long long)((header)[1] & ASYNC_HEADER_Q1_OFFSET_HIGH_MASK)) >> ASYNC_HEADER_Q1_OFFSET_HIGH_SHIFT) << 32)| \ 32 (header)[2] 33 34 #define ASYNC_HEADER_GET_RCODE(header) \ 35 (((header)[1] & ASYNC_HEADER_Q1_RCODE_MASK) >> ASYNC_HEADER_Q1_RCODE_SHIFT) 36 37 #define QUADLET_SIZE 4 38 39 DECLARE_EVENT_CLASS(async_outbound_initiate_template, 40 TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, const u32 *header, const u32 *data, unsigned int data_count), 41 TP_ARGS(transaction, card_index, generation, scode, header, data, data_count), 42 TP_STRUCT__entry( 43 __field(u64, transaction) 44 __field(u8, card_index) 45 __field(u8, generation) 46 __field(u8, scode) 47 __array(u32, header, ASYNC_HEADER_QUADLET_COUNT) 48 __dynamic_array(u32, data, data_count) 49 ), 50 TP_fast_assign( 51 __entry->transaction = transaction; 52 __entry->card_index = card_index; 53 __entry->generation = generation; 54 __entry->scode = scode; 55 memcpy(__entry->header, header, QUADLET_SIZE * ASYNC_HEADER_QUADLET_COUNT); 56 memcpy(__get_dynamic_array(data), data, __get_dynamic_array_len(data)); 57 ), 58 // This format is for the request subaction. 59 TP_printk( 60 "transaction=0x%llx card_index=%u generation=%u scode=%u dst_id=0x%04x tlabel=%u tcode=%u src_id=0x%04x offset=0x%012llx header=%s data=%s", 61 __entry->transaction, 62 __entry->card_index, 63 __entry->generation, 64 __entry->scode, 65 ASYNC_HEADER_GET_DESTINATION(__entry->header), 66 ASYNC_HEADER_GET_TLABEL(__entry->header), 67 ASYNC_HEADER_GET_TCODE(__entry->header), 68 ASYNC_HEADER_GET_SOURCE(__entry->header), 69 ASYNC_HEADER_GET_OFFSET(__entry->header), 70 __print_array(__entry->header, ASYNC_HEADER_QUADLET_COUNT, QUADLET_SIZE), 71 __print_array(__get_dynamic_array(data), 72 __get_dynamic_array_len(data) / QUADLET_SIZE, QUADLET_SIZE) 73 ) 74 ); 75 76 // The value of status is one of ack codes and rcodes specific to Linux FireWire subsystem. 77 DECLARE_EVENT_CLASS(async_outbound_complete_template, 78 TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, unsigned int status, unsigned int timestamp), 79 TP_ARGS(transaction, card_index, generation, scode, status, timestamp), 80 TP_STRUCT__entry( 81 __field(u64, transaction) 82 __field(u8, card_index) 83 __field(u8, generation) 84 __field(u8, scode) 85 __field(u8, status) 86 __field(u16, timestamp) 87 ), 88 TP_fast_assign( 89 __entry->transaction = transaction; 90 __entry->card_index = card_index; 91 __entry->generation = generation; 92 __entry->scode = scode; 93 __entry->status = status; 94 __entry->timestamp = timestamp; 95 ), 96 TP_printk( 97 "transaction=0x%llx card_index=%u generation=%u scode=%u status=%u timestamp=0x%04x", 98 __entry->transaction, 99 __entry->card_index, 100 __entry->generation, 101 __entry->scode, 102 __entry->status, 103 __entry->timestamp 104 ) 105 ); 106 107 // The value of status is one of ack codes and rcodes specific to Linux FireWire subsystem. 108 DECLARE_EVENT_CLASS(async_inbound_template, 109 TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, unsigned int status, unsigned int timestamp, const u32 *header, const u32 *data, unsigned int data_count), 110 TP_ARGS(transaction, card_index, generation, scode, status, timestamp, header, data, data_count), 111 TP_STRUCT__entry( 112 __field(u64, transaction) 113 __field(u8, card_index) 114 __field(u8, generation) 115 __field(u8, scode) 116 __field(u8, status) 117 __field(u16, timestamp) 118 __array(u32, header, ASYNC_HEADER_QUADLET_COUNT) 119 __dynamic_array(u32, data, data_count) 120 ), 121 TP_fast_assign( 122 __entry->transaction = transaction; 123 __entry->card_index = card_index; 124 __entry->generation = generation; 125 __entry->scode = scode; 126 __entry->status = status; 127 __entry->timestamp = timestamp; 128 memcpy(__entry->header, header, QUADLET_SIZE * ASYNC_HEADER_QUADLET_COUNT); 129 memcpy(__get_dynamic_array(data), data, __get_dynamic_array_len(data)); 130 ), 131 // This format is for the response subaction. 132 TP_printk( 133 "transaction=0x%llx card_index=%u generation=%u scode=%u status=%u timestamp=0x%04x dst_id=0x%04x tlabel=%u tcode=%u src_id=0x%04x rcode=%u header=%s data=%s", 134 __entry->transaction, 135 __entry->card_index, 136 __entry->generation, 137 __entry->scode, 138 __entry->status, 139 __entry->timestamp, 140 ASYNC_HEADER_GET_DESTINATION(__entry->header), 141 ASYNC_HEADER_GET_TLABEL(__entry->header), 142 ASYNC_HEADER_GET_TCODE(__entry->header), 143 ASYNC_HEADER_GET_SOURCE(__entry->header), 144 ASYNC_HEADER_GET_RCODE(__entry->header), 145 __print_array(__entry->header, ASYNC_HEADER_QUADLET_COUNT, QUADLET_SIZE), 146 __print_array(__get_dynamic_array(data), 147 __get_dynamic_array_len(data) / QUADLET_SIZE, QUADLET_SIZE) 148 ) 149 ); 150 151 DEFINE_EVENT(async_outbound_initiate_template, async_request_outbound_initiate, 152 TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, const u32 *header, const u32 *data, unsigned int data_count), 153 TP_ARGS(transaction, card_index, generation, scode, header, data, data_count) 154 ); 155 156 DEFINE_EVENT(async_outbound_complete_template, async_request_outbound_complete, 157 TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, unsigned int status, unsigned int timestamp), 158 TP_ARGS(transaction, card_index, generation, scode, status, timestamp) 159 ); 160 161 DEFINE_EVENT(async_inbound_template, async_response_inbound, 162 TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, unsigned int status, unsigned int timestamp, const u32 *header, const u32 *data, unsigned int data_count), 163 TP_ARGS(transaction, card_index, generation, scode, status, timestamp, header, data, data_count) 164 ); 165 166 DEFINE_EVENT_PRINT(async_inbound_template, async_request_inbound, 167 TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, unsigned int status, unsigned int timestamp, const u32 *header, const u32 *data, unsigned int data_count), 168 TP_ARGS(transaction, card_index, generation, scode, status, timestamp, header, data, data_count), 169 TP_printk( 170 "transaction=0x%llx card_index=%u generation=%u scode=%u status=%u timestamp=0x%04x dst_id=0x%04x tlabel=%u tcode=%u src_id=0x%04x offset=0x%012llx header=%s data=%s", 171 __entry->transaction, 172 __entry->card_index, 173 __entry->generation, 174 __entry->scode, 175 __entry->status, 176 __entry->timestamp, 177 ASYNC_HEADER_GET_DESTINATION(__entry->header), 178 ASYNC_HEADER_GET_TLABEL(__entry->header), 179 ASYNC_HEADER_GET_TCODE(__entry->header), 180 ASYNC_HEADER_GET_SOURCE(__entry->header), 181 ASYNC_HEADER_GET_OFFSET(__entry->header), 182 __print_array(__entry->header, ASYNC_HEADER_QUADLET_COUNT, QUADLET_SIZE), 183 __print_array(__get_dynamic_array(data), 184 __get_dynamic_array_len(data) / QUADLET_SIZE, QUADLET_SIZE) 185 ) 186 ); 187 188 DEFINE_EVENT_PRINT(async_outbound_initiate_template, async_response_outbound_initiate, 189 TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, const u32 *header, const u32 *data, unsigned int data_count), 190 TP_ARGS(transaction, card_index, generation, scode, header, data, data_count), 191 TP_printk( 192 "transaction=0x%llx card_index=%u generation=%u scode=%u dst_id=0x%04x tlabel=%u tcode=%u src_id=0x%04x rcode=%u header=%s data=%s", 193 __entry->transaction, 194 __entry->card_index, 195 __entry->generation, 196 __entry->scode, 197 ASYNC_HEADER_GET_DESTINATION(__entry->header), 198 ASYNC_HEADER_GET_TLABEL(__entry->header), 199 ASYNC_HEADER_GET_TCODE(__entry->header), 200 ASYNC_HEADER_GET_SOURCE(__entry->header), 201 ASYNC_HEADER_GET_RCODE(__entry->header), 202 __print_array(__entry->header, ASYNC_HEADER_QUADLET_COUNT, QUADLET_SIZE), 203 __print_array(__get_dynamic_array(data), 204 __get_dynamic_array_len(data) / QUADLET_SIZE, QUADLET_SIZE) 205 ) 206 ); 207 208 DEFINE_EVENT(async_outbound_complete_template, async_response_outbound_complete, 209 TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, unsigned int status, unsigned int timestamp), 210 TP_ARGS(transaction, card_index, generation, scode, status, timestamp) 211 ); 212 213 #undef ASYNC_HEADER_GET_DESTINATION 214 #undef ASYNC_HEADER_GET_TLABEL 215 #undef ASYNC_HEADER_GET_TCODE 216 #undef ASYNC_HEADER_GET_SOURCE 217 #undef ASYNC_HEADER_GET_OFFSET 218 #undef ASYNC_HEADER_GET_RCODE 219 220 TRACE_EVENT(async_phy_outbound_initiate, 221 TP_PROTO(u64 packet, unsigned int card_index, unsigned int generation, u32 first_quadlet, u32 second_quadlet), 222 TP_ARGS(packet, card_index, generation, first_quadlet, second_quadlet), 223 TP_STRUCT__entry( 224 __field(u64, packet) 225 __field(u8, card_index) 226 __field(u8, generation) 227 __field(u32, first_quadlet) 228 __field(u32, second_quadlet) 229 ), 230 TP_fast_assign( 231 __entry->packet = packet; 232 __entry->card_index = card_index; 233 __entry->generation = generation; 234 __entry->first_quadlet = first_quadlet; 235 __entry->second_quadlet = second_quadlet 236 ), 237 TP_printk( 238 "packet=0x%llx card_index=%u generation=%u first_quadlet=0x%08x second_quadlet=0x%08x", 239 __entry->packet, 240 __entry->card_index, 241 __entry->generation, 242 __entry->first_quadlet, 243 __entry->second_quadlet 244 ) 245 ); 246 247 TRACE_EVENT(async_phy_outbound_complete, 248 TP_PROTO(u64 packet, unsigned int card_index, unsigned int generation, unsigned int status, unsigned int timestamp), 249 TP_ARGS(packet, card_index, generation, status, timestamp), 250 TP_STRUCT__entry( 251 __field(u64, packet) 252 __field(u8, card_index) 253 __field(u8, generation) 254 __field(u8, status) 255 __field(u16, timestamp) 256 ), 257 TP_fast_assign( 258 __entry->packet = packet; 259 __entry->card_index = card_index; 260 __entry->generation = generation; 261 __entry->status = status; 262 __entry->timestamp = timestamp; 263 ), 264 TP_printk( 265 "packet=0x%llx card_index=%u generation=%u status=%u timestamp=0x%04x", 266 __entry->packet, 267 __entry->card_index, 268 __entry->generation, 269 __entry->status, 270 __entry->timestamp 271 ) 272 ); 273 274 TRACE_EVENT(async_phy_inbound, 275 TP_PROTO(u64 packet, unsigned int card_index, unsigned int generation, unsigned int status, unsigned int timestamp, u32 first_quadlet, u32 second_quadlet), 276 TP_ARGS(packet, card_index, generation, status, timestamp, first_quadlet, second_quadlet), 277 TP_STRUCT__entry( 278 __field(u64, packet) 279 __field(u8, card_index) 280 __field(u8, generation) 281 __field(u8, status) 282 __field(u16, timestamp) 283 __field(u32, first_quadlet) 284 __field(u32, second_quadlet) 285 ), 286 TP_fast_assign( 287 __entry->packet = packet; 288 __entry->generation = generation; 289 __entry->status = status; 290 __entry->timestamp = timestamp; 291 __entry->first_quadlet = first_quadlet; 292 __entry->second_quadlet = second_quadlet 293 ), 294 TP_printk( 295 "packet=0x%llx card_index=%u generation=%u status=%u timestamp=0x%04x first_quadlet=0x%08x second_quadlet=0x%08x", 296 __entry->packet, 297 __entry->card_index, 298 __entry->generation, 299 __entry->status, 300 __entry->timestamp, 301 __entry->first_quadlet, 302 __entry->second_quadlet 303 ) 304 ); 305 306 DECLARE_EVENT_CLASS(bus_reset_arrange_template, 307 TP_PROTO(unsigned int card_index, unsigned int generation, bool short_reset), 308 TP_ARGS(card_index, generation, short_reset), 309 TP_STRUCT__entry( 310 __field(u8, card_index) 311 __field(u8, generation) 312 __field(bool, short_reset) 313 ), 314 TP_fast_assign( 315 __entry->card_index = card_index; 316 __entry->generation = generation; 317 __entry->short_reset = short_reset; 318 ), 319 TP_printk( 320 "card_index=%u generation=%u short_reset=%s", 321 __entry->card_index, 322 __entry->generation, 323 __entry->short_reset ? "true" : "false" 324 ) 325 ); 326 327 DEFINE_EVENT(bus_reset_arrange_template, bus_reset_initiate, 328 TP_PROTO(unsigned int card_index, unsigned int generation, bool short_reset), 329 TP_ARGS(card_index, generation, short_reset) 330 ); 331 332 DEFINE_EVENT(bus_reset_arrange_template, bus_reset_schedule, 333 TP_PROTO(unsigned int card_index, unsigned int generation, bool short_reset), 334 TP_ARGS(card_index, generation, short_reset) 335 ); 336 337 DEFINE_EVENT(bus_reset_arrange_template, bus_reset_postpone, 338 TP_PROTO(unsigned int card_index, unsigned int generation, bool short_reset), 339 TP_ARGS(card_index, generation, short_reset) 340 ); 341 342 TRACE_EVENT(bus_reset_handle, 343 TP_PROTO(unsigned int card_index, unsigned int generation, unsigned int node_id, bool bm_abdicate, u32 *self_ids, unsigned int self_id_count), 344 TP_ARGS(card_index, generation, node_id, bm_abdicate, self_ids, self_id_count), 345 TP_STRUCT__entry( 346 __field(u8, card_index) 347 __field(u8, generation) 348 __field(u8, node_id) 349 __field(bool, bm_abdicate) 350 __dynamic_array(u32, self_ids, self_id_count) 351 ), 352 TP_fast_assign( 353 __entry->card_index = card_index; 354 __entry->generation = generation; 355 __entry->node_id = node_id; 356 __entry->bm_abdicate = bm_abdicate; 357 memcpy(__get_dynamic_array(self_ids), self_ids, __get_dynamic_array_len(self_ids)); 358 ), 359 TP_printk( 360 "card_index=%u generation=%u node_id=0x%04x bm_abdicate=%s self_ids=%s", 361 __entry->card_index, 362 __entry->generation, 363 __entry->node_id, 364 __entry->bm_abdicate ? "true" : "false", 365 __print_array(__get_dynamic_array(self_ids), 366 __get_dynamic_array_len(self_ids) / QUADLET_SIZE, QUADLET_SIZE) 367 ) 368 ); 369 370 // Some macros are defined in 'drivers/firewire/phy-packet-definitions.h'. 371 372 // The content of TP_printk field is preprocessed, then put to the module binary. 373 374 #define PHY_PACKET_SELF_ID_GET_PHY_ID(quads) \ 375 ((((const u32 *)quads)[0] & SELF_ID_PHY_ID_MASK) >> SELF_ID_PHY_ID_SHIFT) 376 377 #define PHY_PACKET_SELF_ID_GET_LINK_ACTIVE(quads) \ 378 ((((const u32 *)quads)[0] & SELF_ID_ZERO_LINK_ACTIVE_MASK) >> SELF_ID_ZERO_LINK_ACTIVE_SHIFT) 379 380 #define PHY_PACKET_SELF_ID_GET_GAP_COUNT(quads) \ 381 ((((const u32 *)quads)[0] & SELF_ID_ZERO_GAP_COUNT_MASK) >> SELF_ID_ZERO_GAP_COUNT_SHIFT) 382 383 #define PHY_PACKET_SELF_ID_GET_SCODE(quads) \ 384 ((((const u32 *)quads)[0] & SELF_ID_ZERO_SCODE_MASK) >> SELF_ID_ZERO_SCODE_SHIFT) 385 386 #define PHY_PACKET_SELF_ID_GET_CONTENDER(quads) \ 387 ((((const u32 *)quads)[0] & SELF_ID_ZERO_CONTENDER_MASK) >> SELF_ID_ZERO_CONTENDER_SHIFT) 388 389 #define PHY_PACKET_SELF_ID_GET_POWER_CLASS(quads) \ 390 ((((const u32 *)quads)[0] & SELF_ID_ZERO_POWER_CLASS_MASK) >> SELF_ID_ZERO_POWER_CLASS_SHIFT) 391 392 #define PHY_PACKET_SELF_ID_GET_INITIATED_RESET(quads) \ 393 ((((const u32 *)quads)[0] & SELF_ID_ZERO_INITIATED_RESET_MASK) >> SELF_ID_ZERO_INITIATED_RESET_SHIFT) 394 395 TRACE_EVENT(self_id_sequence, 396 TP_PROTO(unsigned int card_index, const u32 *self_id_sequence, unsigned int quadlet_count, unsigned int generation), 397 TP_ARGS(card_index, self_id_sequence, quadlet_count, generation), 398 TP_STRUCT__entry( 399 __field(u8, card_index) 400 __field(u8, generation) 401 __dynamic_array(u8, port_status, self_id_sequence_get_port_capacity(quadlet_count)) 402 __dynamic_array(u32, self_id_sequence, quadlet_count) 403 ), 404 TP_fast_assign( 405 __entry->card_index = card_index; 406 __entry->generation = generation; 407 { 408 u8 *port_status = __get_dynamic_array(port_status); 409 unsigned int port_index; 410 411 for (port_index = 0; port_index < __get_dynamic_array_len(port_status); ++port_index) { 412 port_status[port_index] = 413 self_id_sequence_get_port_status(self_id_sequence, 414 quadlet_count, port_index); 415 } 416 } 417 memcpy(__get_dynamic_array(self_id_sequence), self_id_sequence, 418 __get_dynamic_array_len(self_id_sequence)); 419 ), 420 TP_printk( 421 "card_index=%u generation=%u phy_id=0x%02x link_active=%s gap_count=%u scode=%u contender=%s power_class=%u initiated_reset=%s port_status=%s self_id_sequence=%s", 422 __entry->card_index, 423 __entry->generation, 424 PHY_PACKET_SELF_ID_GET_PHY_ID(__get_dynamic_array(self_id_sequence)), 425 PHY_PACKET_SELF_ID_GET_LINK_ACTIVE(__get_dynamic_array(self_id_sequence)) ? "true" : "false", 426 PHY_PACKET_SELF_ID_GET_GAP_COUNT(__get_dynamic_array(self_id_sequence)), 427 PHY_PACKET_SELF_ID_GET_SCODE(__get_dynamic_array(self_id_sequence)), 428 PHY_PACKET_SELF_ID_GET_CONTENDER(__get_dynamic_array(self_id_sequence)) ? "true" : "false", 429 PHY_PACKET_SELF_ID_GET_POWER_CLASS(__get_dynamic_array(self_id_sequence)), 430 PHY_PACKET_SELF_ID_GET_INITIATED_RESET(__get_dynamic_array(self_id_sequence)) ? "true" : "false", 431 __print_array(__get_dynamic_array(port_status), __get_dynamic_array_len(port_status), 1), 432 __print_array(__get_dynamic_array(self_id_sequence), 433 __get_dynamic_array_len(self_id_sequence) / QUADLET_SIZE, QUADLET_SIZE) 434 ) 435 ); 436 437 #undef PHY_PACKET_SELF_ID_GET_PHY_ID 438 #undef PHY_PACKET_SELF_ID_GET_LINK_ACTIVE 439 #undef PHY_PACKET_SELF_ID_GET_GAP_COUNT 440 #undef PHY_PACKET_SELF_ID_GET_SCODE 441 #undef PHY_PACKET_SELF_ID_GET_CONTENDER 442 #undef PHY_PACKET_SELF_ID_GET_POWER_CLASS 443 #undef PHY_PACKET_SELF_ID_GET_INITIATED_RESET 444 445 TRACE_EVENT_CONDITION(isoc_outbound_allocate, 446 TP_PROTO(const struct fw_iso_context *ctx, unsigned int channel, unsigned int scode), 447 TP_ARGS(ctx, channel, scode), 448 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT), 449 TP_STRUCT__entry( 450 __field(u64, context) 451 __field(u8, card_index) 452 __field(u8, channel) 453 __field(u8, scode) 454 ), 455 TP_fast_assign( 456 __entry->context = (uintptr_t)ctx; 457 __entry->card_index = ctx->card->index; 458 __entry->channel = channel; 459 __entry->scode = scode; 460 ), 461 TP_printk( 462 "context=0x%llx card_index=%u channel=%u scode=%u", 463 __entry->context, 464 __entry->card_index, 465 __entry->channel, 466 __entry->scode 467 ) 468 ); 469 470 TRACE_EVENT_CONDITION(isoc_inbound_single_allocate, 471 TP_PROTO(const struct fw_iso_context *ctx, unsigned int channel, unsigned int header_size), 472 TP_ARGS(ctx, channel, header_size), 473 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE), 474 TP_STRUCT__entry( 475 __field(u64, context) 476 __field(u8, card_index) 477 __field(u8, channel) 478 __field(u8, header_size) 479 ), 480 TP_fast_assign( 481 __entry->context = (uintptr_t)ctx; 482 __entry->card_index = ctx->card->index; 483 __entry->channel = channel; 484 __entry->header_size = header_size; 485 ), 486 TP_printk( 487 "context=0x%llx card_index=%u channel=%u header_size=%u", 488 __entry->context, 489 __entry->card_index, 490 __entry->channel, 491 __entry->header_size 492 ) 493 ); 494 495 TRACE_EVENT_CONDITION(isoc_inbound_multiple_allocate, 496 TP_PROTO(const struct fw_iso_context *ctx), 497 TP_ARGS(ctx), 498 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL), 499 TP_STRUCT__entry( 500 __field(u64, context) 501 __field(u8, card_index) 502 ), 503 TP_fast_assign( 504 __entry->context = (uintptr_t)ctx; 505 __entry->card_index = ctx->card->index; 506 ), 507 TP_printk( 508 "context=0x%llx card_index=%u", 509 __entry->context, 510 __entry->card_index 511 ) 512 ); 513 514 DECLARE_EVENT_CLASS(isoc_destroy_template, 515 TP_PROTO(const struct fw_iso_context *ctx), 516 TP_ARGS(ctx), 517 TP_STRUCT__entry( 518 __field(u64, context) 519 __field(u8, card_index) 520 ), 521 TP_fast_assign( 522 __entry->context = (uintptr_t)ctx; 523 __entry->card_index = ctx->card->index; 524 ), 525 TP_printk( 526 "context=0x%llx card_index=%u", 527 __entry->context, 528 __entry->card_index 529 ) 530 ) 531 532 DEFINE_EVENT_CONDITION(isoc_destroy_template, isoc_outbound_destroy, 533 TP_PROTO(const struct fw_iso_context *ctx), 534 TP_ARGS(ctx), 535 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT) 536 ); 537 538 DEFINE_EVENT_CONDITION(isoc_destroy_template, isoc_inbound_single_destroy, 539 TP_PROTO(const struct fw_iso_context *ctx), 540 TP_ARGS(ctx), 541 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE) 542 ); 543 544 DEFINE_EVENT_CONDITION(isoc_destroy_template, isoc_inbound_multiple_destroy, 545 TP_PROTO(const struct fw_iso_context *ctx), 546 TP_ARGS(ctx), 547 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) 548 ); 549 550 TRACE_EVENT(isoc_inbound_multiple_channels, 551 TP_PROTO(const struct fw_iso_context *ctx, u64 channels), 552 TP_ARGS(ctx, channels), 553 TP_STRUCT__entry( 554 __field(u64, context) 555 __field(u8, card_index) 556 __field(u64, channels) 557 ), 558 TP_fast_assign( 559 __entry->context = (uintptr_t)ctx; 560 __entry->card_index = ctx->card->index; 561 __entry->channels = channels; 562 ), 563 TP_printk( 564 "context=0x%llx card_index=%u channels=0x%016llx", 565 __entry->context, 566 __entry->card_index, 567 __entry->channels 568 ) 569 ); 570 571 TRACE_EVENT_CONDITION(isoc_outbound_start, 572 TP_PROTO(const struct fw_iso_context *ctx, int cycle_match), 573 TP_ARGS(ctx, cycle_match), 574 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT), 575 TP_STRUCT__entry( 576 __field(u64, context) 577 __field(u8, card_index) 578 __field(bool, cycle_match) 579 __field(u16, cycle) 580 ), 581 TP_fast_assign( 582 __entry->context = (uintptr_t)ctx; 583 __entry->card_index = ctx->card->index; 584 __entry->cycle_match = cycle_match < 0 ? false : true; 585 __entry->cycle = __entry->cycle_match ? (u16)cycle_match : 0; 586 ), 587 TP_printk( 588 "context=0x%llx card_index=%u cycle_match=%s cycle=0x%04x", 589 __entry->context, 590 __entry->card_index, 591 __entry->cycle_match ? "true" : "false", 592 __entry->cycle 593 ) 594 ); 595 596 DECLARE_EVENT_CLASS(isoc_inbound_start_template, 597 TP_PROTO(const struct fw_iso_context *ctx, int cycle_match, unsigned int sync, unsigned int tags), 598 TP_ARGS(ctx, cycle_match, sync, tags), 599 TP_STRUCT__entry( 600 __field(u64, context) 601 __field(u8, card_index) 602 __field(bool, cycle_match) 603 __field(u16, cycle) 604 __field(u8, sync) 605 __field(u8, tags) 606 ), 607 TP_fast_assign( 608 __entry->context = (uintptr_t)ctx; 609 __entry->card_index = ctx->card->index; 610 __entry->cycle_match = cycle_match < 0 ? false : true; 611 __entry->cycle = __entry->cycle_match ? (u16)cycle_match : 0; 612 __entry->sync = sync; 613 __entry->tags = tags; 614 ), 615 TP_printk( 616 "context=0x%llx card_index=%u cycle_match=%s cycle=0x%04x sync=%u tags=%s", 617 __entry->context, 618 __entry->card_index, 619 __entry->cycle_match ? "true" : "false", 620 __entry->cycle, 621 __entry->sync, 622 __print_flags(__entry->tags, "|", 623 { FW_ISO_CONTEXT_MATCH_TAG0, "0" }, 624 { FW_ISO_CONTEXT_MATCH_TAG1, "1" }, 625 { FW_ISO_CONTEXT_MATCH_TAG2, "2" }, 626 { FW_ISO_CONTEXT_MATCH_TAG3, "3" } 627 ) 628 ) 629 ); 630 631 DEFINE_EVENT_CONDITION(isoc_inbound_start_template, isoc_inbound_single_start, 632 TP_PROTO(const struct fw_iso_context *ctx, int cycle_match, unsigned int sync, unsigned int tags), 633 TP_ARGS(ctx, cycle_match, sync, tags), 634 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE) 635 ); 636 637 DEFINE_EVENT_CONDITION(isoc_inbound_start_template, isoc_inbound_multiple_start, 638 TP_PROTO(const struct fw_iso_context *ctx, int cycle_match, unsigned int sync, unsigned int tags), 639 TP_ARGS(ctx, cycle_match, sync, tags), 640 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) 641 ); 642 643 DECLARE_EVENT_CLASS(isoc_stop_template, 644 TP_PROTO(const struct fw_iso_context *ctx), 645 TP_ARGS(ctx), 646 TP_STRUCT__entry( 647 __field(u64, context) 648 __field(u8, card_index) 649 ), 650 TP_fast_assign( 651 __entry->context = (uintptr_t)ctx; 652 __entry->card_index = ctx->card->index; 653 ), 654 TP_printk( 655 "context=0x%llx card_index=%u", 656 __entry->context, 657 __entry->card_index 658 ) 659 ) 660 661 DEFINE_EVENT_CONDITION(isoc_stop_template, isoc_outbound_stop, 662 TP_PROTO(const struct fw_iso_context *ctx), 663 TP_ARGS(ctx), 664 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT) 665 ); 666 667 DEFINE_EVENT_CONDITION(isoc_stop_template, isoc_inbound_single_stop, 668 TP_PROTO(const struct fw_iso_context *ctx), 669 TP_ARGS(ctx), 670 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE) 671 ); 672 673 DEFINE_EVENT_CONDITION(isoc_stop_template, isoc_inbound_multiple_stop, 674 TP_PROTO(const struct fw_iso_context *ctx), 675 TP_ARGS(ctx), 676 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) 677 ); 678 679 DECLARE_EVENT_CLASS(isoc_flush_template, 680 TP_PROTO(const struct fw_iso_context *ctx), 681 TP_ARGS(ctx), 682 TP_STRUCT__entry( 683 __field(u64, context) 684 __field(u8, card_index) 685 ), 686 TP_fast_assign( 687 __entry->context = (uintptr_t)ctx; 688 __entry->card_index = ctx->card->index; 689 ), 690 TP_printk( 691 "context=0x%llx card_index=%u", 692 __entry->context, 693 __entry->card_index 694 ) 695 ); 696 697 DEFINE_EVENT_CONDITION(isoc_flush_template, isoc_outbound_flush, 698 TP_PROTO(const struct fw_iso_context *ctx), 699 TP_ARGS(ctx), 700 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT) 701 ); 702 703 DEFINE_EVENT_CONDITION(isoc_flush_template, isoc_inbound_single_flush, 704 TP_PROTO(const struct fw_iso_context *ctx), 705 TP_ARGS(ctx), 706 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE) 707 ); 708 709 DEFINE_EVENT_CONDITION(isoc_flush_template, isoc_inbound_multiple_flush, 710 TP_PROTO(const struct fw_iso_context *ctx), 711 TP_ARGS(ctx), 712 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) 713 ); 714 715 DECLARE_EVENT_CLASS(isoc_flush_completions_template, 716 TP_PROTO(const struct fw_iso_context *ctx), 717 TP_ARGS(ctx), 718 TP_STRUCT__entry( 719 __field(u64, context) 720 __field(u8, card_index) 721 ), 722 TP_fast_assign( 723 __entry->context = (uintptr_t)ctx; 724 __entry->card_index = ctx->card->index; 725 ), 726 TP_printk( 727 "context=0x%llx card_index=%u", 728 __entry->context, 729 __entry->card_index 730 ) 731 ); 732 733 DEFINE_EVENT_CONDITION(isoc_flush_completions_template, isoc_outbound_flush_completions, 734 TP_PROTO(const struct fw_iso_context *ctx), 735 TP_ARGS(ctx), 736 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT) 737 ); 738 739 DEFINE_EVENT_CONDITION(isoc_flush_completions_template, isoc_inbound_single_flush_completions, 740 TP_PROTO(const struct fw_iso_context *ctx), 741 TP_ARGS(ctx), 742 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE) 743 ); 744 745 DEFINE_EVENT_CONDITION(isoc_flush_completions_template, isoc_inbound_multiple_flush_completions, 746 TP_PROTO(const struct fw_iso_context *ctx), 747 TP_ARGS(ctx), 748 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) 749 ); 750 751 #define TP_STRUCT__entry_iso_packet(ctx, buffer_offset, packet) \ 752 TP_STRUCT__entry( \ 753 __field(u64, context) \ 754 __field(u8, card_index) \ 755 __field(u32, buffer_offset) \ 756 __field(bool, interrupt) \ 757 __field(bool, skip) \ 758 __field(u8, sy) \ 759 __field(u8, tag) \ 760 __dynamic_array(u32, header, packet->header_length / QUADLET_SIZE) \ 761 ) 762 763 #define TP_fast_assign_iso_packet(ctx, buffer_offset, packet) \ 764 TP_fast_assign( \ 765 __entry->context = (uintptr_t)ctx; \ 766 __entry->card_index = ctx->card->index; \ 767 __entry->buffer_offset = buffer_offset; \ 768 __entry->interrupt = packet->interrupt; \ 769 __entry->skip = packet->skip; \ 770 __entry->sy = packet->sy; \ 771 __entry->tag = packet->tag; \ 772 memcpy(__get_dynamic_array(header), packet->header, \ 773 __get_dynamic_array_len(header)); \ 774 ) 775 776 TRACE_EVENT_CONDITION(isoc_outbound_queue, 777 TP_PROTO(const struct fw_iso_context *ctx, unsigned long buffer_offset, const struct fw_iso_packet *packet), 778 TP_ARGS(ctx, buffer_offset, packet), 779 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT), 780 TP_STRUCT__entry_iso_packet(ctx, buffer_offset, packet), 781 TP_fast_assign_iso_packet(ctx, buffer_offset, packet), 782 TP_printk( 783 "context=0x%llx card_index=%u buffer_offset=0x%x interrupt=%s skip=%s sy=%d tag=%u header=%s", 784 __entry->context, 785 __entry->card_index, 786 __entry->buffer_offset, 787 __entry->interrupt ? "true" : "false", 788 __entry->skip ? "true" : "false", 789 __entry->sy, 790 __entry->tag, 791 __print_array(__get_dynamic_array(header), 792 __get_dynamic_array_len(header) / QUADLET_SIZE, QUADLET_SIZE) 793 ) 794 ); 795 796 TRACE_EVENT_CONDITION(isoc_inbound_single_queue, 797 TP_PROTO(const struct fw_iso_context *ctx, unsigned long buffer_offset, const struct fw_iso_packet *packet), 798 TP_ARGS(ctx, buffer_offset, packet), 799 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE), 800 TP_STRUCT__entry_iso_packet(ctx, buffer_offset, packet), 801 TP_fast_assign_iso_packet(ctx, buffer_offset, packet), 802 TP_printk( 803 "context=0x%llx card_index=%u buffer_offset=0x%x interrupt=%s skip=%s", 804 __entry->context, 805 __entry->card_index, 806 __entry->buffer_offset, 807 __entry->interrupt ? "true" : "false", 808 __entry->skip ? "true" : "false" 809 ) 810 ); 811 812 TRACE_EVENT_CONDITION(isoc_inbound_multiple_queue, 813 TP_PROTO(const struct fw_iso_context *ctx, unsigned long buffer_offset, const struct fw_iso_packet *packet), 814 TP_ARGS(ctx, buffer_offset, packet), 815 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL), 816 TP_STRUCT__entry_iso_packet(ctx, buffer_offset, packet), 817 TP_fast_assign_iso_packet(ctx, buffer_offset, packet), 818 TP_printk( 819 "context=0x%llx card_index=%u buffer_offset=0x%x interrupt=%s", 820 __entry->context, 821 __entry->card_index, 822 __entry->buffer_offset, 823 __entry->interrupt ? "true" : "false" 824 ) 825 ); 826 827 #undef TP_STRUCT__entry_iso_packet 828 #undef TP_fast_assign_iso_packet 829 830 #ifndef show_cause 831 enum fw_iso_context_completions_cause { 832 FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH = 0, 833 FW_ISO_CONTEXT_COMPLETIONS_CAUSE_IRQ, 834 FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERFLOW, 835 }; 836 #define show_cause(cause) \ 837 __print_symbolic(cause, \ 838 { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH, "FLUSH" }, \ 839 { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_IRQ, "IRQ" }, \ 840 { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERFLOW, "HEADER_OVERFLOW" } \ 841 ) 842 #endif 843 844 DECLARE_EVENT_CLASS(isoc_single_completions_template, 845 TP_PROTO(const struct fw_iso_context *ctx, u16 timestamp, enum fw_iso_context_completions_cause cause, const u32 *header, unsigned int header_length), 846 TP_ARGS(ctx, timestamp, cause, header, header_length), 847 TP_STRUCT__entry( 848 __field(u64, context) 849 __field(u8, card_index) 850 __field(u16, timestamp) 851 __field(u8, cause) 852 __dynamic_array(u32, header, header_length / QUADLET_SIZE) 853 ), 854 TP_fast_assign( 855 __entry->context = (uintptr_t)ctx; 856 __entry->card_index = ctx->card->index; 857 __entry->timestamp = timestamp; 858 __entry->cause = cause; 859 memcpy(__get_dynamic_array(header), header, __get_dynamic_array_len(header)); 860 ), 861 TP_printk( 862 "context=0x%llx card_index=%u timestamp=0x%04x cause=%s header=%s", 863 __entry->context, 864 __entry->card_index, 865 __entry->timestamp, 866 show_cause(__entry->cause), 867 __print_array(__get_dynamic_array(header), 868 __get_dynamic_array_len(header) / QUADLET_SIZE, QUADLET_SIZE) 869 ) 870 ) 871 872 DEFINE_EVENT_CONDITION(isoc_single_completions_template, isoc_outbound_completions, 873 TP_PROTO(const struct fw_iso_context *ctx, u16 timestamp, enum fw_iso_context_completions_cause cause, const u32 *header, unsigned int header_length), 874 TP_ARGS(ctx, timestamp, cause, header, header_length), 875 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT) 876 ); 877 878 DEFINE_EVENT_CONDITION(isoc_single_completions_template, isoc_inbound_single_completions, 879 TP_PROTO(const struct fw_iso_context *ctx, u16 timestamp, enum fw_iso_context_completions_cause cause, const u32 *header, unsigned int header_length), 880 TP_ARGS(ctx, timestamp, cause, header, header_length), 881 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE) 882 ); 883 884 TRACE_EVENT(isoc_inbound_multiple_completions, 885 TP_PROTO(const struct fw_iso_context *ctx, unsigned int completed, enum fw_iso_context_completions_cause cause), 886 TP_ARGS(ctx, completed, cause), 887 TP_STRUCT__entry( 888 __field(u64, context) 889 __field(u8, card_index) 890 __field(u16, completed) 891 __field(u8, cause) 892 ), 893 TP_fast_assign( 894 __entry->context = (uintptr_t)ctx; 895 __entry->card_index = ctx->card->index; 896 __entry->completed = completed; 897 __entry->cause = cause; 898 ), 899 TP_printk( 900 "context=0x%llx card_index=%u completed=%u cause=%s", 901 __entry->context, 902 __entry->card_index, 903 __entry->completed, 904 show_cause(__entry->cause) 905 ) 906 ); 907 908 #undef QUADLET_SIZE 909 910 #endif // _FIREWIRE_TRACE_EVENT_H 911 912 #include <trace/define_trace.h> 913