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 void copy_port_status(u8 *port_status, unsigned int port_capacity, const u32 *self_id_sequence, 396 unsigned int quadlet_count); 397 398 TRACE_EVENT(self_id_sequence, 399 TP_PROTO(unsigned int card_index, const u32 *self_id_sequence, unsigned int quadlet_count, unsigned int generation), 400 TP_ARGS(card_index, self_id_sequence, quadlet_count, generation), 401 TP_STRUCT__entry( 402 __field(u8, card_index) 403 __field(u8, generation) 404 __dynamic_array(u8, port_status, self_id_sequence_get_port_capacity(quadlet_count)) 405 __dynamic_array(u32, self_id_sequence, quadlet_count) 406 ), 407 TP_fast_assign( 408 __entry->card_index = card_index; 409 __entry->generation = generation; 410 copy_port_status(__get_dynamic_array(port_status), __get_dynamic_array_len(port_status), 411 self_id_sequence, quadlet_count); 412 memcpy(__get_dynamic_array(self_id_sequence), self_id_sequence, 413 __get_dynamic_array_len(self_id_sequence)); 414 ), 415 TP_printk( 416 "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", 417 __entry->card_index, 418 __entry->generation, 419 PHY_PACKET_SELF_ID_GET_PHY_ID(__get_dynamic_array(self_id_sequence)), 420 PHY_PACKET_SELF_ID_GET_LINK_ACTIVE(__get_dynamic_array(self_id_sequence)) ? "true" : "false", 421 PHY_PACKET_SELF_ID_GET_GAP_COUNT(__get_dynamic_array(self_id_sequence)), 422 PHY_PACKET_SELF_ID_GET_SCODE(__get_dynamic_array(self_id_sequence)), 423 PHY_PACKET_SELF_ID_GET_CONTENDER(__get_dynamic_array(self_id_sequence)) ? "true" : "false", 424 PHY_PACKET_SELF_ID_GET_POWER_CLASS(__get_dynamic_array(self_id_sequence)), 425 PHY_PACKET_SELF_ID_GET_INITIATED_RESET(__get_dynamic_array(self_id_sequence)) ? "true" : "false", 426 __print_array(__get_dynamic_array(port_status), __get_dynamic_array_len(port_status), 1), 427 __print_array(__get_dynamic_array(self_id_sequence), 428 __get_dynamic_array_len(self_id_sequence) / QUADLET_SIZE, QUADLET_SIZE) 429 ) 430 ); 431 432 #undef PHY_PACKET_SELF_ID_GET_PHY_ID 433 #undef PHY_PACKET_SELF_ID_GET_LINK_ACTIVE 434 #undef PHY_PACKET_SELF_ID_GET_GAP_COUNT 435 #undef PHY_PACKET_SELF_ID_GET_SCODE 436 #undef PHY_PACKET_SELF_ID_GET_CONTENDER 437 #undef PHY_PACKET_SELF_ID_GET_POWER_CLASS 438 #undef PHY_PACKET_SELF_ID_GET_INITIATED_RESET 439 440 TRACE_EVENT_CONDITION(isoc_outbound_allocate, 441 TP_PROTO(const struct fw_iso_context *ctx, unsigned int channel, unsigned int scode), 442 TP_ARGS(ctx, channel, scode), 443 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT), 444 TP_STRUCT__entry( 445 __field(u64, context) 446 __field(u8, card_index) 447 __field(u8, channel) 448 __field(u8, scode) 449 ), 450 TP_fast_assign( 451 __entry->context = (uintptr_t)ctx; 452 __entry->card_index = ctx->card->index; 453 __entry->channel = channel; 454 __entry->scode = scode; 455 ), 456 TP_printk( 457 "context=0x%llx card_index=%u channel=%u scode=%u", 458 __entry->context, 459 __entry->card_index, 460 __entry->channel, 461 __entry->scode 462 ) 463 ); 464 465 TRACE_EVENT_CONDITION(isoc_inbound_single_allocate, 466 TP_PROTO(const struct fw_iso_context *ctx, unsigned int channel, unsigned int header_size), 467 TP_ARGS(ctx, channel, header_size), 468 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE), 469 TP_STRUCT__entry( 470 __field(u64, context) 471 __field(u8, card_index) 472 __field(u8, channel) 473 __field(u8, header_size) 474 ), 475 TP_fast_assign( 476 __entry->context = (uintptr_t)ctx; 477 __entry->card_index = ctx->card->index; 478 __entry->channel = channel; 479 __entry->header_size = header_size; 480 ), 481 TP_printk( 482 "context=0x%llx card_index=%u channel=%u header_size=%u", 483 __entry->context, 484 __entry->card_index, 485 __entry->channel, 486 __entry->header_size 487 ) 488 ); 489 490 TRACE_EVENT_CONDITION(isoc_inbound_multiple_allocate, 491 TP_PROTO(const struct fw_iso_context *ctx), 492 TP_ARGS(ctx), 493 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL), 494 TP_STRUCT__entry( 495 __field(u64, context) 496 __field(u8, card_index) 497 ), 498 TP_fast_assign( 499 __entry->context = (uintptr_t)ctx; 500 __entry->card_index = ctx->card->index; 501 ), 502 TP_printk( 503 "context=0x%llx card_index=%u", 504 __entry->context, 505 __entry->card_index 506 ) 507 ); 508 509 DECLARE_EVENT_CLASS(isoc_destroy_template, 510 TP_PROTO(const struct fw_iso_context *ctx), 511 TP_ARGS(ctx), 512 TP_STRUCT__entry( 513 __field(u64, context) 514 __field(u8, card_index) 515 ), 516 TP_fast_assign( 517 __entry->context = (uintptr_t)ctx; 518 __entry->card_index = ctx->card->index; 519 ), 520 TP_printk( 521 "context=0x%llx card_index=%u", 522 __entry->context, 523 __entry->card_index 524 ) 525 ) 526 527 DEFINE_EVENT_CONDITION(isoc_destroy_template, isoc_outbound_destroy, 528 TP_PROTO(const struct fw_iso_context *ctx), 529 TP_ARGS(ctx), 530 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT) 531 ); 532 533 DEFINE_EVENT_CONDITION(isoc_destroy_template, isoc_inbound_single_destroy, 534 TP_PROTO(const struct fw_iso_context *ctx), 535 TP_ARGS(ctx), 536 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE) 537 ); 538 539 DEFINE_EVENT_CONDITION(isoc_destroy_template, isoc_inbound_multiple_destroy, 540 TP_PROTO(const struct fw_iso_context *ctx), 541 TP_ARGS(ctx), 542 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) 543 ); 544 545 TRACE_EVENT(isoc_inbound_multiple_channels, 546 TP_PROTO(const struct fw_iso_context *ctx, u64 channels), 547 TP_ARGS(ctx, channels), 548 TP_STRUCT__entry( 549 __field(u64, context) 550 __field(u8, card_index) 551 __field(u64, channels) 552 ), 553 TP_fast_assign( 554 __entry->context = (uintptr_t)ctx; 555 __entry->card_index = ctx->card->index; 556 __entry->channels = channels; 557 ), 558 TP_printk( 559 "context=0x%llx card_index=%u channels=0x%016llx", 560 __entry->context, 561 __entry->card_index, 562 __entry->channels 563 ) 564 ); 565 566 TRACE_EVENT_CONDITION(isoc_outbound_start, 567 TP_PROTO(const struct fw_iso_context *ctx, int cycle_match), 568 TP_ARGS(ctx, cycle_match), 569 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT), 570 TP_STRUCT__entry( 571 __field(u64, context) 572 __field(u8, card_index) 573 __field(bool, cycle_match) 574 __field(u16, cycle) 575 ), 576 TP_fast_assign( 577 __entry->context = (uintptr_t)ctx; 578 __entry->card_index = ctx->card->index; 579 __entry->cycle_match = cycle_match < 0 ? false : true; 580 __entry->cycle = __entry->cycle_match ? (u16)cycle_match : 0; 581 ), 582 TP_printk( 583 "context=0x%llx card_index=%u cycle_match=%s cycle=0x%04x", 584 __entry->context, 585 __entry->card_index, 586 __entry->cycle_match ? "true" : "false", 587 __entry->cycle 588 ) 589 ); 590 591 DECLARE_EVENT_CLASS(isoc_inbound_start_template, 592 TP_PROTO(const struct fw_iso_context *ctx, int cycle_match, unsigned int sync, unsigned int tags), 593 TP_ARGS(ctx, cycle_match, sync, tags), 594 TP_STRUCT__entry( 595 __field(u64, context) 596 __field(u8, card_index) 597 __field(bool, cycle_match) 598 __field(u16, cycle) 599 __field(u8, sync) 600 __field(u8, tags) 601 ), 602 TP_fast_assign( 603 __entry->context = (uintptr_t)ctx; 604 __entry->card_index = ctx->card->index; 605 __entry->cycle_match = cycle_match < 0 ? false : true; 606 __entry->cycle = __entry->cycle_match ? (u16)cycle_match : 0; 607 __entry->sync = sync; 608 __entry->tags = tags; 609 ), 610 TP_printk( 611 "context=0x%llx card_index=%u cycle_match=%s cycle=0x%04x sync=%u tags=%s", 612 __entry->context, 613 __entry->card_index, 614 __entry->cycle_match ? "true" : "false", 615 __entry->cycle, 616 __entry->sync, 617 __print_flags(__entry->tags, "|", 618 { FW_ISO_CONTEXT_MATCH_TAG0, "0" }, 619 { FW_ISO_CONTEXT_MATCH_TAG1, "1" }, 620 { FW_ISO_CONTEXT_MATCH_TAG2, "2" }, 621 { FW_ISO_CONTEXT_MATCH_TAG3, "3" } 622 ) 623 ) 624 ); 625 626 DEFINE_EVENT_CONDITION(isoc_inbound_start_template, isoc_inbound_single_start, 627 TP_PROTO(const struct fw_iso_context *ctx, int cycle_match, unsigned int sync, unsigned int tags), 628 TP_ARGS(ctx, cycle_match, sync, tags), 629 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE) 630 ); 631 632 DEFINE_EVENT_CONDITION(isoc_inbound_start_template, isoc_inbound_multiple_start, 633 TP_PROTO(const struct fw_iso_context *ctx, int cycle_match, unsigned int sync, unsigned int tags), 634 TP_ARGS(ctx, cycle_match, sync, tags), 635 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) 636 ); 637 638 DECLARE_EVENT_CLASS(isoc_stop_template, 639 TP_PROTO(const struct fw_iso_context *ctx), 640 TP_ARGS(ctx), 641 TP_STRUCT__entry( 642 __field(u64, context) 643 __field(u8, card_index) 644 ), 645 TP_fast_assign( 646 __entry->context = (uintptr_t)ctx; 647 __entry->card_index = ctx->card->index; 648 ), 649 TP_printk( 650 "context=0x%llx card_index=%u", 651 __entry->context, 652 __entry->card_index 653 ) 654 ) 655 656 DEFINE_EVENT_CONDITION(isoc_stop_template, isoc_outbound_stop, 657 TP_PROTO(const struct fw_iso_context *ctx), 658 TP_ARGS(ctx), 659 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT) 660 ); 661 662 DEFINE_EVENT_CONDITION(isoc_stop_template, isoc_inbound_single_stop, 663 TP_PROTO(const struct fw_iso_context *ctx), 664 TP_ARGS(ctx), 665 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE) 666 ); 667 668 DEFINE_EVENT_CONDITION(isoc_stop_template, isoc_inbound_multiple_stop, 669 TP_PROTO(const struct fw_iso_context *ctx), 670 TP_ARGS(ctx), 671 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) 672 ); 673 674 DECLARE_EVENT_CLASS(isoc_flush_template, 675 TP_PROTO(const struct fw_iso_context *ctx), 676 TP_ARGS(ctx), 677 TP_STRUCT__entry( 678 __field(u64, context) 679 __field(u8, card_index) 680 ), 681 TP_fast_assign( 682 __entry->context = (uintptr_t)ctx; 683 __entry->card_index = ctx->card->index; 684 ), 685 TP_printk( 686 "context=0x%llx card_index=%u", 687 __entry->context, 688 __entry->card_index 689 ) 690 ); 691 692 DEFINE_EVENT_CONDITION(isoc_flush_template, isoc_outbound_flush, 693 TP_PROTO(const struct fw_iso_context *ctx), 694 TP_ARGS(ctx), 695 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT) 696 ); 697 698 DEFINE_EVENT_CONDITION(isoc_flush_template, isoc_inbound_single_flush, 699 TP_PROTO(const struct fw_iso_context *ctx), 700 TP_ARGS(ctx), 701 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE) 702 ); 703 704 DEFINE_EVENT_CONDITION(isoc_flush_template, isoc_inbound_multiple_flush, 705 TP_PROTO(const struct fw_iso_context *ctx), 706 TP_ARGS(ctx), 707 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) 708 ); 709 710 DECLARE_EVENT_CLASS(isoc_flush_completions_template, 711 TP_PROTO(const struct fw_iso_context *ctx), 712 TP_ARGS(ctx), 713 TP_STRUCT__entry( 714 __field(u64, context) 715 __field(u8, card_index) 716 ), 717 TP_fast_assign( 718 __entry->context = (uintptr_t)ctx; 719 __entry->card_index = ctx->card->index; 720 ), 721 TP_printk( 722 "context=0x%llx card_index=%u", 723 __entry->context, 724 __entry->card_index 725 ) 726 ); 727 728 DEFINE_EVENT_CONDITION(isoc_flush_completions_template, isoc_outbound_flush_completions, 729 TP_PROTO(const struct fw_iso_context *ctx), 730 TP_ARGS(ctx), 731 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT) 732 ); 733 734 DEFINE_EVENT_CONDITION(isoc_flush_completions_template, isoc_inbound_single_flush_completions, 735 TP_PROTO(const struct fw_iso_context *ctx), 736 TP_ARGS(ctx), 737 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE) 738 ); 739 740 DEFINE_EVENT_CONDITION(isoc_flush_completions_template, isoc_inbound_multiple_flush_completions, 741 TP_PROTO(const struct fw_iso_context *ctx), 742 TP_ARGS(ctx), 743 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) 744 ); 745 746 #define TP_STRUCT__entry_iso_packet(ctx, buffer_offset, packet) \ 747 TP_STRUCT__entry( \ 748 __field(u64, context) \ 749 __field(u8, card_index) \ 750 __field(u32, buffer_offset) \ 751 __field(bool, interrupt) \ 752 __field(bool, skip) \ 753 __field(u8, sy) \ 754 __field(u8, tag) \ 755 __dynamic_array(u32, header, packet->header_length / QUADLET_SIZE) \ 756 ) 757 758 #define TP_fast_assign_iso_packet(ctx, buffer_offset, packet) \ 759 TP_fast_assign( \ 760 __entry->context = (uintptr_t)ctx; \ 761 __entry->card_index = ctx->card->index; \ 762 __entry->buffer_offset = buffer_offset; \ 763 __entry->interrupt = packet->interrupt; \ 764 __entry->skip = packet->skip; \ 765 __entry->sy = packet->sy; \ 766 __entry->tag = packet->tag; \ 767 memcpy(__get_dynamic_array(header), packet->header, \ 768 __get_dynamic_array_len(header)); \ 769 ) 770 771 TRACE_EVENT_CONDITION(isoc_outbound_queue, 772 TP_PROTO(const struct fw_iso_context *ctx, unsigned long buffer_offset, const struct fw_iso_packet *packet), 773 TP_ARGS(ctx, buffer_offset, packet), 774 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT), 775 TP_STRUCT__entry_iso_packet(ctx, buffer_offset, packet), 776 TP_fast_assign_iso_packet(ctx, buffer_offset, packet), 777 TP_printk( 778 "context=0x%llx card_index=%u buffer_offset=0x%x interrupt=%s skip=%s sy=%d tag=%u header=%s", 779 __entry->context, 780 __entry->card_index, 781 __entry->buffer_offset, 782 __entry->interrupt ? "true" : "false", 783 __entry->skip ? "true" : "false", 784 __entry->sy, 785 __entry->tag, 786 __print_array(__get_dynamic_array(header), 787 __get_dynamic_array_len(header) / QUADLET_SIZE, QUADLET_SIZE) 788 ) 789 ); 790 791 TRACE_EVENT_CONDITION(isoc_inbound_single_queue, 792 TP_PROTO(const struct fw_iso_context *ctx, unsigned long buffer_offset, const struct fw_iso_packet *packet), 793 TP_ARGS(ctx, buffer_offset, packet), 794 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE), 795 TP_STRUCT__entry_iso_packet(ctx, buffer_offset, packet), 796 TP_fast_assign_iso_packet(ctx, buffer_offset, packet), 797 TP_printk( 798 "context=0x%llx card_index=%u buffer_offset=0x%x interrupt=%s skip=%s", 799 __entry->context, 800 __entry->card_index, 801 __entry->buffer_offset, 802 __entry->interrupt ? "true" : "false", 803 __entry->skip ? "true" : "false" 804 ) 805 ); 806 807 TRACE_EVENT_CONDITION(isoc_inbound_multiple_queue, 808 TP_PROTO(const struct fw_iso_context *ctx, unsigned long buffer_offset, const struct fw_iso_packet *packet), 809 TP_ARGS(ctx, buffer_offset, packet), 810 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL), 811 TP_STRUCT__entry_iso_packet(ctx, buffer_offset, packet), 812 TP_fast_assign_iso_packet(ctx, buffer_offset, packet), 813 TP_printk( 814 "context=0x%llx card_index=%u buffer_offset=0x%x interrupt=%s", 815 __entry->context, 816 __entry->card_index, 817 __entry->buffer_offset, 818 __entry->interrupt ? "true" : "false" 819 ) 820 ); 821 822 #undef TP_STRUCT__entry_iso_packet 823 #undef TP_fast_assign_iso_packet 824 825 #ifndef show_cause 826 enum fw_iso_context_completions_cause { 827 FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH = 0, 828 FW_ISO_CONTEXT_COMPLETIONS_CAUSE_IRQ, 829 FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERFLOW, 830 }; 831 #define show_cause(cause) \ 832 __print_symbolic(cause, \ 833 { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH, "FLUSH" }, \ 834 { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_IRQ, "IRQ" }, \ 835 { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERFLOW, "HEADER_OVERFLOW" } \ 836 ) 837 #endif 838 839 DECLARE_EVENT_CLASS(isoc_single_completions_template, 840 TP_PROTO(const struct fw_iso_context *ctx, u16 timestamp, enum fw_iso_context_completions_cause cause, const u32 *header, unsigned int header_length), 841 TP_ARGS(ctx, timestamp, cause, header, header_length), 842 TP_STRUCT__entry( 843 __field(u64, context) 844 __field(u8, card_index) 845 __field(u16, timestamp) 846 __field(u8, cause) 847 __dynamic_array(u32, header, header_length / QUADLET_SIZE) 848 ), 849 TP_fast_assign( 850 __entry->context = (uintptr_t)ctx; 851 __entry->card_index = ctx->card->index; 852 __entry->timestamp = timestamp; 853 __entry->cause = cause; 854 memcpy(__get_dynamic_array(header), header, __get_dynamic_array_len(header)); 855 ), 856 TP_printk( 857 "context=0x%llx card_index=%u timestamp=0x%04x cause=%s header=%s", 858 __entry->context, 859 __entry->card_index, 860 __entry->timestamp, 861 show_cause(__entry->cause), 862 __print_array(__get_dynamic_array(header), 863 __get_dynamic_array_len(header) / QUADLET_SIZE, QUADLET_SIZE) 864 ) 865 ) 866 867 DEFINE_EVENT_CONDITION(isoc_single_completions_template, isoc_outbound_completions, 868 TP_PROTO(const struct fw_iso_context *ctx, u16 timestamp, enum fw_iso_context_completions_cause cause, const u32 *header, unsigned int header_length), 869 TP_ARGS(ctx, timestamp, cause, header, header_length), 870 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT) 871 ); 872 873 DEFINE_EVENT_CONDITION(isoc_single_completions_template, isoc_inbound_single_completions, 874 TP_PROTO(const struct fw_iso_context *ctx, u16 timestamp, enum fw_iso_context_completions_cause cause, const u32 *header, unsigned int header_length), 875 TP_ARGS(ctx, timestamp, cause, header, header_length), 876 TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE) 877 ); 878 879 TRACE_EVENT(isoc_inbound_multiple_completions, 880 TP_PROTO(const struct fw_iso_context *ctx, unsigned int completed, enum fw_iso_context_completions_cause cause), 881 TP_ARGS(ctx, completed, cause), 882 TP_STRUCT__entry( 883 __field(u64, context) 884 __field(u8, card_index) 885 __field(u16, completed) 886 __field(u8, cause) 887 ), 888 TP_fast_assign( 889 __entry->context = (uintptr_t)ctx; 890 __entry->card_index = ctx->card->index; 891 __entry->completed = completed; 892 __entry->cause = cause; 893 ), 894 TP_printk( 895 "context=0x%llx card_index=%u completed=%u cause=%s", 896 __entry->context, 897 __entry->card_index, 898 __entry->completed, 899 show_cause(__entry->cause) 900 ) 901 ); 902 903 #undef QUADLET_SIZE 904 905 #endif // _FIREWIRE_TRACE_EVENT_H 906 907 #include <trace/define_trace.h> 908