1 // SPDX-License-Identifier: GPL-2.0-or-later
2 // Copyright (c) 2024 Takashi Sakamoto
5 #define TRACE_SYSTEM firewire
7 #if !defined(_FIREWIRE_TRACE_EVENT_H) || defined(TRACE_HEADER_MULTI_READ)
8 #define _FIREWIRE_TRACE_EVENT_H
10 #include <linux/tracepoint.h>
11 #include <linux/firewire.h>
13 #include <linux/firewire-constants.h>
15 // Some macros are defined in 'drivers/firewire/packet-header-definitions.h'.
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)
21 #define ASYNC_HEADER_GET_TLABEL(header) \
22 (((header)[0] & ASYNC_HEADER_Q0_TLABEL_MASK) >> ASYNC_HEADER_Q0_TLABEL_SHIFT)
24 #define ASYNC_HEADER_GET_TCODE(header) \
25 (((header)[0] & ASYNC_HEADER_Q0_TCODE_MASK) >> ASYNC_HEADER_Q0_TCODE_SHIFT)
27 #define ASYNC_HEADER_GET_SOURCE(header) \
28 (((header)[1] & ASYNC_HEADER_Q1_SOURCE_MASK) >> ASYNC_HEADER_Q1_SOURCE_SHIFT)
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)| \
34 #define ASYNC_HEADER_GET_RCODE(header) \
35 (((header)[1] & ASYNC_HEADER_Q1_RCODE_MASK) >> ASYNC_HEADER_Q1_RCODE_SHIFT)
37 #define QUADLET_SIZE 4
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
),
43 __field(u64
, transaction
)
44 __field(u8
, card_index
)
45 __field(u8
, generation
)
47 __array(u32
, header
, ASYNC_HEADER_QUADLET_COUNT
)
48 __dynamic_array(u32
, data
, data_count
)
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
));
58 // This format is for the request subaction.
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",
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
)
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
),
81 __field(u64
, transaction
)
82 __field(u8
, card_index
)
83 __field(u8
, generation
)
86 __field(u16
, timestamp
)
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
;
97 "transaction=0x%llx card_index=%u generation=%u scode=%u status=%u timestamp=0x%04x",
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
),
112 __field(u64
, transaction
)
113 __field(u8
, card_index
)
114 __field(u8
, generation
)
117 __field(u16
, timestamp
)
118 __array(u32
, header
, ASYNC_HEADER_QUADLET_COUNT
)
119 __dynamic_array(u32
, data
, data_count
)
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
));
131 // This format is for the response subaction.
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
,
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
)
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
)
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
)
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
)
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
),
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
,
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
)
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
),
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
,
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
)
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
)
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
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
),
225 __field(u8
, card_index
)
226 __field(u8
, generation
)
227 __field(u32
, first_quadlet
)
228 __field(u32
, second_quadlet
)
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
238 "packet=0x%llx card_index=%u generation=%u first_quadlet=0x%08x second_quadlet=0x%08x",
242 __entry
->first_quadlet
,
243 __entry
->second_quadlet
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
),
252 __field(u8
, card_index
)
253 __field(u8
, generation
)
255 __field(u16
, timestamp
)
258 __entry
->packet
= packet
;
259 __entry
->card_index
= card_index
;
260 __entry
->generation
= generation
;
261 __entry
->status
= status
;
262 __entry
->timestamp
= timestamp
;
265 "packet=0x%llx card_index=%u generation=%u status=%u timestamp=0x%04x",
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
),
279 __field(u8
, card_index
)
280 __field(u8
, generation
)
282 __field(u16
, timestamp
)
283 __field(u32
, first_quadlet
)
284 __field(u32
, second_quadlet
)
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
295 "packet=0x%llx card_index=%u generation=%u status=%u timestamp=0x%04x first_quadlet=0x%08x second_quadlet=0x%08x",
301 __entry
->first_quadlet
,
302 __entry
->second_quadlet
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
),
310 __field(u8
, card_index
)
311 __field(u8
, generation
)
312 __field(bool, short_reset
)
315 __entry
->card_index
= card_index
;
316 __entry
->generation
= generation
;
317 __entry
->short_reset
= short_reset
;
320 "card_index=%u generation=%u short_reset=%s",
323 __entry
->short_reset
? "true" : "false"
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
)
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
)
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
)
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
),
346 __field(u8
, card_index
)
347 __field(u8
, generation
)
349 __field(bool, bm_abdicate
)
350 __dynamic_array(u32
, self_ids
, self_id_count
)
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
));
360 "card_index=%u generation=%u node_id=0x%04x bm_abdicate=%s self_ids=%s",
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
)
370 // Some macros are defined in 'drivers/firewire/phy-packet-definitions.h'.
372 // The content of TP_printk field is preprocessed, then put to the module binary.
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)
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)
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)
383 #define PHY_PACKET_SELF_ID_GET_SCODE(quads) \
384 ((((const u32 *)quads)[0] & SELF_ID_ZERO_SCODE_MASK) >> SELF_ID_ZERO_SCODE_SHIFT)
386 #define PHY_PACKET_SELF_ID_GET_CONTENDER(quads) \
387 ((((const u32 *)quads)[0] & SELF_ID_ZERO_CONTENDER_MASK) >> SELF_ID_ZERO_CONTENDER_SHIFT)
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)
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)
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
),
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
)
405 __entry
->card_index
= card_index
;
406 __entry
->generation
= generation
;
408 u8
*port_status
= __get_dynamic_array(port_status
);
409 unsigned int port_index
;
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
);
417 memcpy(__get_dynamic_array(self_id_sequence
), self_id_sequence
,
418 __get_dynamic_array_len(self_id_sequence
));
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",
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
)
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
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
),
450 __field(u64
, context
)
451 __field(u8
, card_index
)
456 __entry
->context
= (uintptr_t)ctx
;
457 __entry
->card_index
= ctx
->card
->index
;
458 __entry
->channel
= channel
;
459 __entry
->scode
= scode
;
462 "context=0x%llx card_index=%u channel=%u scode=%u",
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
),
475 __field(u64
, context
)
476 __field(u8
, card_index
)
478 __field(u8
, header_size
)
481 __entry
->context
= (uintptr_t)ctx
;
482 __entry
->card_index
= ctx
->card
->index
;
483 __entry
->channel
= channel
;
484 __entry
->header_size
= header_size
;
487 "context=0x%llx card_index=%u channel=%u header_size=%u",
495 TRACE_EVENT_CONDITION(isoc_inbound_multiple_allocate
,
496 TP_PROTO(const struct fw_iso_context
*ctx
),
498 TP_CONDITION(ctx
->type
== FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL
),
500 __field(u64
, context
)
501 __field(u8
, card_index
)
504 __entry
->context
= (uintptr_t)ctx
;
505 __entry
->card_index
= ctx
->card
->index
;
508 "context=0x%llx card_index=%u",
514 DECLARE_EVENT_CLASS(isoc_destroy_template
,
515 TP_PROTO(const struct fw_iso_context
*ctx
),
518 __field(u64
, context
)
519 __field(u8
, card_index
)
522 __entry
->context
= (uintptr_t)ctx
;
523 __entry
->card_index
= ctx
->card
->index
;
526 "context=0x%llx card_index=%u",
532 DEFINE_EVENT_CONDITION(isoc_destroy_template
, isoc_outbound_destroy
,
533 TP_PROTO(const struct fw_iso_context
*ctx
),
535 TP_CONDITION(ctx
->type
== FW_ISO_CONTEXT_TRANSMIT
)
538 DEFINE_EVENT_CONDITION(isoc_destroy_template
, isoc_inbound_single_destroy
,
539 TP_PROTO(const struct fw_iso_context
*ctx
),
541 TP_CONDITION(ctx
->type
== FW_ISO_CONTEXT_RECEIVE
)
544 DEFINE_EVENT_CONDITION(isoc_destroy_template
, isoc_inbound_multiple_destroy
,
545 TP_PROTO(const struct fw_iso_context
*ctx
),
547 TP_CONDITION(ctx
->type
== FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL
)
550 TRACE_EVENT(isoc_inbound_multiple_channels
,
551 TP_PROTO(const struct fw_iso_context
*ctx
, u64 channels
),
552 TP_ARGS(ctx
, channels
),
554 __field(u64
, context
)
555 __field(u8
, card_index
)
556 __field(u64
, channels
)
559 __entry
->context
= (uintptr_t)ctx
;
560 __entry
->card_index
= ctx
->card
->index
;
561 __entry
->channels
= channels
;
564 "context=0x%llx card_index=%u channels=0x%016llx",
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
),
576 __field(u64
, context
)
577 __field(u8
, card_index
)
578 __field(bool, cycle_match
)
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;
588 "context=0x%llx card_index=%u cycle_match=%s cycle=0x%04x",
591 __entry
->cycle_match
? "true" : "false",
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
),
600 __field(u64
, context
)
601 __field(u8
, card_index
)
602 __field(bool, cycle_match
)
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
;
616 "context=0x%llx card_index=%u cycle_match=%s cycle=0x%04x sync=%u tags=%s",
619 __entry
->cycle_match
? "true" : "false",
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" }
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
)
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
)
643 DECLARE_EVENT_CLASS(isoc_stop_template
,
644 TP_PROTO(const struct fw_iso_context
*ctx
),
647 __field(u64
, context
)
648 __field(u8
, card_index
)
651 __entry
->context
= (uintptr_t)ctx
;
652 __entry
->card_index
= ctx
->card
->index
;
655 "context=0x%llx card_index=%u",
661 DEFINE_EVENT_CONDITION(isoc_stop_template
, isoc_outbound_stop
,
662 TP_PROTO(const struct fw_iso_context
*ctx
),
664 TP_CONDITION(ctx
->type
== FW_ISO_CONTEXT_TRANSMIT
)
667 DEFINE_EVENT_CONDITION(isoc_stop_template
, isoc_inbound_single_stop
,
668 TP_PROTO(const struct fw_iso_context
*ctx
),
670 TP_CONDITION(ctx
->type
== FW_ISO_CONTEXT_RECEIVE
)
673 DEFINE_EVENT_CONDITION(isoc_stop_template
, isoc_inbound_multiple_stop
,
674 TP_PROTO(const struct fw_iso_context
*ctx
),
676 TP_CONDITION(ctx
->type
== FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL
)
679 DECLARE_EVENT_CLASS(isoc_flush_template
,
680 TP_PROTO(const struct fw_iso_context
*ctx
),
683 __field(u64
, context
)
684 __field(u8
, card_index
)
687 __entry
->context
= (uintptr_t)ctx
;
688 __entry
->card_index
= ctx
->card
->index
;
691 "context=0x%llx card_index=%u",
697 DEFINE_EVENT_CONDITION(isoc_flush_template
, isoc_outbound_flush
,
698 TP_PROTO(const struct fw_iso_context
*ctx
),
700 TP_CONDITION(ctx
->type
== FW_ISO_CONTEXT_TRANSMIT
)
703 DEFINE_EVENT_CONDITION(isoc_flush_template
, isoc_inbound_single_flush
,
704 TP_PROTO(const struct fw_iso_context
*ctx
),
706 TP_CONDITION(ctx
->type
== FW_ISO_CONTEXT_RECEIVE
)
709 DEFINE_EVENT_CONDITION(isoc_flush_template
, isoc_inbound_multiple_flush
,
710 TP_PROTO(const struct fw_iso_context
*ctx
),
712 TP_CONDITION(ctx
->type
== FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL
)
715 DECLARE_EVENT_CLASS(isoc_flush_completions_template
,
716 TP_PROTO(const struct fw_iso_context
*ctx
),
719 __field(u64
, context
)
720 __field(u8
, card_index
)
723 __entry
->context
= (uintptr_t)ctx
;
724 __entry
->card_index
= ctx
->card
->index
;
727 "context=0x%llx card_index=%u",
733 DEFINE_EVENT_CONDITION(isoc_flush_completions_template
, isoc_outbound_flush_completions
,
734 TP_PROTO(const struct fw_iso_context
*ctx
),
736 TP_CONDITION(ctx
->type
== FW_ISO_CONTEXT_TRANSMIT
)
739 DEFINE_EVENT_CONDITION(isoc_flush_completions_template
, isoc_inbound_single_flush_completions
,
740 TP_PROTO(const struct fw_iso_context
*ctx
),
742 TP_CONDITION(ctx
->type
== FW_ISO_CONTEXT_RECEIVE
)
745 DEFINE_EVENT_CONDITION(isoc_flush_completions_template
, isoc_inbound_multiple_flush_completions
,
746 TP_PROTO(const struct fw_iso_context
*ctx
),
748 TP_CONDITION(ctx
->type
== FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL
)
751 #define TP_STRUCT__entry_iso_packet(ctx, buffer_offset, packet) \
753 __field(u64, context) \
754 __field(u8, card_index) \
755 __field(u32, buffer_offset) \
756 __field(bool, interrupt) \
757 __field(bool, skip) \
760 __dynamic_array(u32, header, packet->header_length / QUADLET_SIZE) \
763 #define TP_fast_assign_iso_packet(ctx, buffer_offset, packet) \
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)); \
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
),
783 "context=0x%llx card_index=%u buffer_offset=0x%x interrupt=%s skip=%s sy=%d tag=%u header=%s",
786 __entry
->buffer_offset
,
787 __entry
->interrupt
? "true" : "false",
788 __entry
->skip
? "true" : "false",
791 __print_array(__get_dynamic_array(header
),
792 __get_dynamic_array_len(header
) / QUADLET_SIZE
, QUADLET_SIZE
)
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
),
803 "context=0x%llx card_index=%u buffer_offset=0x%x interrupt=%s skip=%s",
806 __entry
->buffer_offset
,
807 __entry
->interrupt
? "true" : "false",
808 __entry
->skip
? "true" : "false"
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
),
819 "context=0x%llx card_index=%u buffer_offset=0x%x interrupt=%s",
822 __entry
->buffer_offset
,
823 __entry
->interrupt
? "true" : "false"
827 #undef TP_STRUCT__entry_iso_packet
828 #undef TP_fast_assign_iso_packet
831 enum fw_iso_context_completions_cause
{
832 FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH
= 0,
833 FW_ISO_CONTEXT_COMPLETIONS_CAUSE_INTERRUPT
,
834 FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERFLOW
,
836 #define show_cause(cause) \
837 __print_symbolic(cause, \
838 { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH, "FLUSH" }, \
839 { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_INTERRUPT, "INTERRUPT" }, \
840 { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERFLOW, "HEADER_OVERFLOW" } \
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
),
848 __field(u64
, context
)
849 __field(u8
, card_index
)
850 __field(u16
, timestamp
)
852 __dynamic_array(u32
, header
, header_length
/ QUADLET_SIZE
)
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
));
862 "context=0x%llx card_index=%u timestamp=0x%04x cause=%s header=%s",
866 show_cause(__entry
->cause
),
867 __print_array(__get_dynamic_array(header
),
868 __get_dynamic_array_len(header
) / QUADLET_SIZE
, QUADLET_SIZE
)
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
)
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
)
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
),
888 __field(u64
, context
)
889 __field(u8
, card_index
)
890 __field(u16
, completed
)
894 __entry
->context
= (uintptr_t)ctx
;
895 __entry
->card_index
= ctx
->card
->index
;
896 __entry
->completed
= completed
;
897 __entry
->cause
= cause
;
900 "context=0x%llx card_index=%u completed=%u cause=%s",
904 show_cause(__entry
->cause
)
910 #endif // _FIREWIRE_TRACE_EVENT_H
912 #include <trace/define_trace.h>