|
7 | 7 | #define _FIREWIRE_TRACE_EVENT_H
|
8 | 8 |
|
9 | 9 | #include <linux/tracepoint.h>
|
| 10 | +#include <linux/firewire.h> |
10 | 11 |
|
11 |
| -// Placeholder for future use. |
| 12 | +#include <linux/firewire-constants.h> |
| 13 | + |
| 14 | +#include "../../../drivers/firewire/packet-header-definitions.h" |
| 15 | + |
| 16 | +// The content of TP_printk field is preprocessed, then put to the module binary. |
| 17 | +#define ASYNC_HEADER_GET_DESTINATION(header) \ |
| 18 | + (((header)[0] & ASYNC_HEADER_Q0_DESTINATION_MASK) >> ASYNC_HEADER_Q0_DESTINATION_SHIFT) |
| 19 | + |
| 20 | +#define ASYNC_HEADER_GET_TLABEL(header) \ |
| 21 | + (((header)[0] & ASYNC_HEADER_Q0_TLABEL_MASK) >> ASYNC_HEADER_Q0_TLABEL_SHIFT) |
| 22 | + |
| 23 | +#define ASYNC_HEADER_GET_TCODE(header) \ |
| 24 | + (((header)[0] & ASYNC_HEADER_Q0_TCODE_MASK) >> ASYNC_HEADER_Q0_TCODE_SHIFT) |
| 25 | + |
| 26 | +#define ASYNC_HEADER_GET_SOURCE(header) \ |
| 27 | + (((header)[1] & ASYNC_HEADER_Q1_SOURCE_MASK) >> ASYNC_HEADER_Q1_SOURCE_SHIFT) |
| 28 | + |
| 29 | +#define ASYNC_HEADER_GET_OFFSET(header) \ |
| 30 | + ((((unsigned long long)((header)[1] & ASYNC_HEADER_Q1_OFFSET_HIGH_MASK)) >> ASYNC_HEADER_Q1_OFFSET_HIGH_SHIFT) << 32)| \ |
| 31 | + (header)[2] |
| 32 | + |
| 33 | +#define QUADLET_SIZE 4 |
| 34 | + |
| 35 | +DECLARE_EVENT_CLASS(async_outbound_initiate_template, |
| 36 | + TP_PROTO(u64 transaction, unsigned int generation, unsigned int scode, const u32 *header, const u32 *data, unsigned int data_count), |
| 37 | + TP_ARGS(transaction, generation, scode, header, data, data_count), |
| 38 | + TP_STRUCT__entry( |
| 39 | + __field(u64, transaction) |
| 40 | + __field(u8, generation) |
| 41 | + __field(u8, scode) |
| 42 | + __array(u32, header, ASYNC_HEADER_QUADLET_COUNT) |
| 43 | + __dynamic_array(u32, data, data_count) |
| 44 | + ), |
| 45 | + TP_fast_assign( |
| 46 | + __entry->transaction = transaction; |
| 47 | + __entry->generation = generation; |
| 48 | + __entry->scode = scode; |
| 49 | + memcpy(__entry->header, header, QUADLET_SIZE * ASYNC_HEADER_QUADLET_COUNT); |
| 50 | + memcpy(__get_dynamic_array(data), data, __get_dynamic_array_len(data)); |
| 51 | + ), |
| 52 | + // This format is for the request subaction. |
| 53 | + TP_printk( |
| 54 | + "transaction=0x%llx generation=%u scode=%u dst_id=0x%04x tlabel=%u tcode=%u src_id=0x%04x offset=0x%012llx header=%s data=%s", |
| 55 | + __entry->transaction, |
| 56 | + __entry->generation, |
| 57 | + __entry->scode, |
| 58 | + ASYNC_HEADER_GET_DESTINATION(__entry->header), |
| 59 | + ASYNC_HEADER_GET_TLABEL(__entry->header), |
| 60 | + ASYNC_HEADER_GET_TCODE(__entry->header), |
| 61 | + ASYNC_HEADER_GET_SOURCE(__entry->header), |
| 62 | + ASYNC_HEADER_GET_OFFSET(__entry->header), |
| 63 | + __print_array(__entry->header, ASYNC_HEADER_QUADLET_COUNT, QUADLET_SIZE), |
| 64 | + __print_array(__get_dynamic_array(data), |
| 65 | + __get_dynamic_array_len(data) / QUADLET_SIZE, QUADLET_SIZE) |
| 66 | + ) |
| 67 | +); |
| 68 | + |
| 69 | +// The value of status is one of ack codes and rcodes specific to Linux FireWire subsystem. |
| 70 | +DECLARE_EVENT_CLASS(async_outbound_complete_template, |
| 71 | + TP_PROTO(u64 transaction, unsigned int generation, unsigned int scode, unsigned int status, unsigned int timestamp), |
| 72 | + TP_ARGS(transaction, generation, scode, status, timestamp), |
| 73 | + TP_STRUCT__entry( |
| 74 | + __field(u64, transaction) |
| 75 | + __field(u8, generation) |
| 76 | + __field(u8, scode) |
| 77 | + __field(u8, status) |
| 78 | + __field(u16, timestamp) |
| 79 | + ), |
| 80 | + TP_fast_assign( |
| 81 | + __entry->transaction = transaction; |
| 82 | + __entry->generation = generation; |
| 83 | + __entry->scode = scode; |
| 84 | + __entry->status = status; |
| 85 | + __entry->timestamp = timestamp; |
| 86 | + ), |
| 87 | + TP_printk( |
| 88 | + "transaction=0x%llx generation=%u scode=%u status=%u timestamp=0x%04x", |
| 89 | + __entry->transaction, |
| 90 | + __entry->generation, |
| 91 | + __entry->scode, |
| 92 | + __entry->status, |
| 93 | + __entry->timestamp |
| 94 | + ) |
| 95 | +); |
| 96 | + |
| 97 | +DEFINE_EVENT(async_outbound_initiate_template, async_request_outbound_initiate, |
| 98 | + TP_PROTO(u64 transaction, unsigned int generation, unsigned int scode, const u32 *header, const u32 *data, unsigned int data_count), |
| 99 | + TP_ARGS(transaction, generation, scode, header, data, data_count) |
| 100 | +); |
| 101 | + |
| 102 | +DEFINE_EVENT(async_outbound_complete_template, async_request_outbound_complete, |
| 103 | + TP_PROTO(u64 transaction, unsigned int generation, unsigned int scode, unsigned int status, unsigned int timestamp), |
| 104 | + TP_ARGS(transaction, generation, scode, status, timestamp) |
| 105 | +); |
| 106 | + |
| 107 | +#undef ASYNC_HEADER_GET_DESTINATION |
| 108 | +#undef ASYNC_HEADER_GET_TLABEL |
| 109 | +#undef ASYNC_HEADER_GET_TCODE |
| 110 | +#undef ASYNC_HEADER_GET_SOURCE |
| 111 | +#undef ASYNC_HEADER_GET_OFFSET |
| 112 | +#undef QUADLET_SIZE |
12 | 113 |
|
13 | 114 | #endif // _FIREWIRE_TRACE_EVENT_H
|
14 | 115 |
|
|
0 commit comments