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_ohci 6 7 #if !defined(_FIREWIRE_OHCI_TRACE_EVENT_H) || defined(TRACE_HEADER_MULTI_READ) 8 #define _FIREWIRE_OHCI_TRACE_EVENT_H 9 10 #include <linux/tracepoint.h> 11 12 // Some macros and helper functions are defined in 'drivers/firewire/ohci.c'. 13 14 TRACE_EVENT(irqs, 15 TP_PROTO(unsigned int card_index, u32 events), 16 TP_ARGS(card_index, events), 17 TP_STRUCT__entry( 18 __field(u8, card_index) 19 __field(u32, events) 20 ), 21 TP_fast_assign( 22 __entry->card_index = card_index; 23 __entry->events = events; 24 ), 25 TP_printk( 26 "card_index=%u events=%s", 27 __entry->card_index, 28 __print_flags(__entry->events, "|", 29 { OHCI1394_selfIDComplete, "selfIDComplete" }, 30 { OHCI1394_RQPkt, "RQPkt" }, 31 { OHCI1394_RSPkt, "RSPkt" }, 32 { OHCI1394_reqTxComplete, "reqTxComplete" }, 33 { OHCI1394_respTxComplete, "respTxComplete" }, 34 { OHCI1394_isochRx, "isochRx" }, 35 { OHCI1394_isochTx, "isochTx" }, 36 { OHCI1394_postedWriteErr, "postedWriteErr" }, 37 { OHCI1394_cycleTooLong, "cycleTooLong" }, 38 { OHCI1394_cycle64Seconds, "cycle64Seconds" }, 39 { OHCI1394_cycleInconsistent, "cycleInconsistent" }, 40 { OHCI1394_regAccessFail, "regAccessFail" }, 41 { OHCI1394_unrecoverableError, "unrecoverableError" }, 42 { OHCI1394_busReset, "busReset" } 43 ) 44 ) 45 ); 46 47 #define QUADLET_SIZE 4 48 49 #define SELF_ID_COUNT_IS_ERROR(reg) \ 50 (!!(((reg) & OHCI1394_SelfIDCount_selfIDError_MASK) >> OHCI1394_SelfIDCount_selfIDError_SHIFT)) 51 52 #define SELF_ID_COUNT_GET_GENERATION(reg) \ 53 (((reg) & OHCI1394_SelfIDCount_selfIDGeneration_MASK) >> OHCI1394_SelfIDCount_selfIDGeneration_SHIFT) 54 55 #define SELF_ID_RECEIVE_Q0_GET_GENERATION(quadlet) \ 56 (((quadlet) & OHCI1394_SELF_ID_RECEIVE_Q0_GENERATION_MASK) >> OHCI1394_SELF_ID_RECEIVE_Q0_GENERATION_SHIFT) 57 58 #define SELF_ID_RECEIVE_Q0_GET_TIMESTAMP(quadlet) \ 59 (((quadlet) & OHCI1394_SELF_ID_RECEIVE_Q0_TIMESTAMP_MASK) >> OHCI1394_SELF_ID_RECEIVE_Q0_TIMESTAMP_SHIFT) 60 61 TRACE_EVENT(self_id_complete, 62 TP_PROTO(unsigned int card_index, u32 reg, const __le32 *self_id_receive, bool has_be_header_quirk), 63 TP_ARGS(card_index, reg, self_id_receive, has_be_header_quirk), 64 TP_STRUCT__entry( 65 __field(u8, card_index) 66 __field(u32, reg) 67 __dynamic_array(u32, self_id_receive, ohci1394_self_id_count_get_size(reg)) 68 ), 69 TP_fast_assign( 70 __entry->card_index = card_index; 71 __entry->reg = reg; 72 { 73 u32 *ptr = __get_dynamic_array(self_id_receive); 74 int i; 75 76 for (i = 0; i < __get_dynamic_array_len(self_id_receive) / QUADLET_SIZE; ++i) 77 ptr[i] = cond_le32_to_cpu(self_id_receive[i], has_be_header_quirk); 78 } 79 ), 80 TP_printk( 81 "card_index=%u is_error=%s generation_at_bus_reset=%u generation_at_completion=%u timestamp=0x%04x packet_data=%s", 82 __entry->card_index, 83 SELF_ID_COUNT_IS_ERROR(__entry->reg) ? "true" : "false", 84 SELF_ID_COUNT_GET_GENERATION(__entry->reg), 85 SELF_ID_RECEIVE_Q0_GET_GENERATION(((const u32 *)__get_dynamic_array(self_id_receive))[0]), 86 SELF_ID_RECEIVE_Q0_GET_TIMESTAMP(((const u32 *)__get_dynamic_array(self_id_receive))[0]), 87 __print_array(((const u32 *)__get_dynamic_array(self_id_receive)) + 1, 88 (__get_dynamic_array_len(self_id_receive) / QUADLET_SIZE) - 1, QUADLET_SIZE) 89 ) 90 ); 91 92 #undef SELF_ID_COUNT_IS_ERROR 93 #undef SELF_ID_COUNT_GET_GENERATION 94 #undef SELF_ID_RECEIVE_Q0_GET_GENERATION 95 #undef SELF_ID_RECEIVE_Q0_GET_TIMESTAMP 96 97 #undef QUADLET_SIZE 98 99 #endif // _FIREWIRE_OHCI_TRACE_EVENT_H 100 101 #include <trace/define_trace.h> 102