10d21bb85SMaximilian Luz /* SPDX-License-Identifier: GPL-2.0+ */
20d21bb85SMaximilian Luz /*
30d21bb85SMaximilian Luz * Trace points for SSAM/SSH.
40d21bb85SMaximilian Luz *
5221756e6SMaximilian Luz * Copyright (C) 2020-2022 Maximilian Luz <luzmaximilian@gmail.com>
60d21bb85SMaximilian Luz */
70d21bb85SMaximilian Luz
80d21bb85SMaximilian Luz #undef TRACE_SYSTEM
90d21bb85SMaximilian Luz #define TRACE_SYSTEM surface_aggregator
100d21bb85SMaximilian Luz
110d21bb85SMaximilian Luz #if !defined(_SURFACE_AGGREGATOR_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
120d21bb85SMaximilian Luz #define _SURFACE_AGGREGATOR_TRACE_H
130d21bb85SMaximilian Luz
140d21bb85SMaximilian Luz #include <linux/surface_aggregator/serial_hub.h>
150d21bb85SMaximilian Luz
160d21bb85SMaximilian Luz #include <asm/unaligned.h>
170d21bb85SMaximilian Luz #include <linux/tracepoint.h>
180d21bb85SMaximilian Luz
190d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_FRAME_TYPE_DATA_SEQ);
200d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_FRAME_TYPE_DATA_NSQ);
210d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_FRAME_TYPE_ACK);
220d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_FRAME_TYPE_NAK);
230d21bb85SMaximilian Luz
240d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_PACKET_SF_LOCKED_BIT);
250d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_PACKET_SF_QUEUED_BIT);
260d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_PACKET_SF_PENDING_BIT);
270d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_PACKET_SF_TRANSMITTING_BIT);
280d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_PACKET_SF_TRANSMITTED_BIT);
290d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_PACKET_SF_ACKED_BIT);
300d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_PACKET_SF_CANCELED_BIT);
310d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_PACKET_SF_COMPLETED_BIT);
320d21bb85SMaximilian Luz
330d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_PACKET_TY_FLUSH_BIT);
340d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_PACKET_TY_SEQUENCED_BIT);
350d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_PACKET_TY_BLOCKING_BIT);
360d21bb85SMaximilian Luz
370d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_PACKET_FLAGS_SF_MASK);
380d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_PACKET_FLAGS_TY_MASK);
390d21bb85SMaximilian Luz
400d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_REQUEST_SF_LOCKED_BIT);
410d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_REQUEST_SF_QUEUED_BIT);
420d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_REQUEST_SF_PENDING_BIT);
430d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_REQUEST_SF_TRANSMITTING_BIT);
440d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_REQUEST_SF_TRANSMITTED_BIT);
450d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_REQUEST_SF_RSPRCVD_BIT);
460d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_REQUEST_SF_CANCELED_BIT);
470d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_REQUEST_SF_COMPLETED_BIT);
480d21bb85SMaximilian Luz
490d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_REQUEST_TY_FLUSH_BIT);
500d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_REQUEST_TY_HAS_RESPONSE_BIT);
510d21bb85SMaximilian Luz
520d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_REQUEST_FLAGS_SF_MASK);
530d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSH_REQUEST_FLAGS_TY_MASK);
540d21bb85SMaximilian Luz
550d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_SAM);
560d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_BAT);
570d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_TMP);
580d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_PMC);
590d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_FAN);
600d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_PoM);
610d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_DBG);
620d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_KBD);
630d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_FWU);
640d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_UNI);
650d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_LPC);
660d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_TCL);
670d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_SFL);
680d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_KIP);
690d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_EXT);
700d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_BLD);
710d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_BAS);
720d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_SEN);
730d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_SRQ);
740d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_MCU);
750d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_HID);
760d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_TCH);
770d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_BKL);
780d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_TAM);
79e244a46aSMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_ACC0);
800d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_UFI);
810d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_USC);
820d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_PEN);
830d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_VID);
840d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_AUD);
850d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_SMC);
860d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_KPD);
870d21bb85SMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_REG);
88e244a46aSMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_SPT);
89e244a46aSMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_SYS);
90e244a46aSMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_ACC1);
91e244a46aSMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_SHB);
92e244a46aSMaximilian Luz TRACE_DEFINE_ENUM(SSAM_SSH_TC_POS);
930d21bb85SMaximilian Luz
940d21bb85SMaximilian Luz #define SSAM_PTR_UID_LEN 9
950d21bb85SMaximilian Luz #define SSAM_U8_FIELD_NOT_APPLICABLE ((u16)-1)
960d21bb85SMaximilian Luz #define SSAM_SEQ_NOT_APPLICABLE ((u16)-1)
970d21bb85SMaximilian Luz #define SSAM_RQID_NOT_APPLICABLE ((u32)-1)
980d21bb85SMaximilian Luz #define SSAM_SSH_TC_NOT_APPLICABLE 0
99*2730fc0aSMaximilian Luz #define SSAM_SSH_TID_NOT_APPLICABLE ((u8)-1)
1000d21bb85SMaximilian Luz
1010d21bb85SMaximilian Luz #ifndef _SURFACE_AGGREGATOR_TRACE_HELPERS
1020d21bb85SMaximilian Luz #define _SURFACE_AGGREGATOR_TRACE_HELPERS
1030d21bb85SMaximilian Luz
1040d21bb85SMaximilian Luz /**
1050d21bb85SMaximilian Luz * ssam_trace_ptr_uid() - Convert the pointer to a non-pointer UID string.
1060d21bb85SMaximilian Luz * @ptr: The pointer to convert.
1070d21bb85SMaximilian Luz * @uid_str: A buffer of length SSAM_PTR_UID_LEN where the UID will be stored.
1080d21bb85SMaximilian Luz *
1090d21bb85SMaximilian Luz * Converts the given pointer into a UID string that is safe to be shared
1100d21bb85SMaximilian Luz * with userspace and logs, i.e. doesn't give away the real memory location.
1110d21bb85SMaximilian Luz */
ssam_trace_ptr_uid(const void * ptr,char * uid_str)1120d21bb85SMaximilian Luz static inline void ssam_trace_ptr_uid(const void *ptr, char *uid_str)
1130d21bb85SMaximilian Luz {
1140d21bb85SMaximilian Luz char buf[2 * sizeof(void *) + 1];
1150d21bb85SMaximilian Luz
1160d21bb85SMaximilian Luz BUILD_BUG_ON(ARRAY_SIZE(buf) < SSAM_PTR_UID_LEN);
1170d21bb85SMaximilian Luz
1180d21bb85SMaximilian Luz snprintf(buf, ARRAY_SIZE(buf), "%p", ptr);
1190d21bb85SMaximilian Luz memcpy(uid_str, &buf[ARRAY_SIZE(buf) - SSAM_PTR_UID_LEN],
1200d21bb85SMaximilian Luz SSAM_PTR_UID_LEN);
1210d21bb85SMaximilian Luz }
1220d21bb85SMaximilian Luz
1230d21bb85SMaximilian Luz /**
1240d21bb85SMaximilian Luz * ssam_trace_get_packet_seq() - Read the packet's sequence ID.
1250d21bb85SMaximilian Luz * @p: The packet.
1260d21bb85SMaximilian Luz *
1270d21bb85SMaximilian Luz * Return: Returns the packet's sequence ID (SEQ) field if present, or
1280d21bb85SMaximilian Luz * %SSAM_SEQ_NOT_APPLICABLE if not (e.g. flush packet).
1290d21bb85SMaximilian Luz */
ssam_trace_get_packet_seq(const struct ssh_packet * p)1300d21bb85SMaximilian Luz static inline u16 ssam_trace_get_packet_seq(const struct ssh_packet *p)
1310d21bb85SMaximilian Luz {
1320d21bb85SMaximilian Luz if (!p->data.ptr || p->data.len < SSH_MESSAGE_LENGTH(0))
1330d21bb85SMaximilian Luz return SSAM_SEQ_NOT_APPLICABLE;
1340d21bb85SMaximilian Luz
1350d21bb85SMaximilian Luz return p->data.ptr[SSH_MSGOFFSET_FRAME(seq)];
1360d21bb85SMaximilian Luz }
1370d21bb85SMaximilian Luz
1380d21bb85SMaximilian Luz /**
1390d21bb85SMaximilian Luz * ssam_trace_get_request_id() - Read the packet's request ID.
1400d21bb85SMaximilian Luz * @p: The packet.
1410d21bb85SMaximilian Luz *
1420d21bb85SMaximilian Luz * Return: Returns the packet's request ID (RQID) field if the packet
1430d21bb85SMaximilian Luz * represents a request with command data, or %SSAM_RQID_NOT_APPLICABLE if not
1440d21bb85SMaximilian Luz * (e.g. flush request, control packet).
1450d21bb85SMaximilian Luz */
ssam_trace_get_request_id(const struct ssh_packet * p)1460d21bb85SMaximilian Luz static inline u32 ssam_trace_get_request_id(const struct ssh_packet *p)
1470d21bb85SMaximilian Luz {
1480d21bb85SMaximilian Luz if (!p->data.ptr || p->data.len < SSH_COMMAND_MESSAGE_LENGTH(0))
1490d21bb85SMaximilian Luz return SSAM_RQID_NOT_APPLICABLE;
1500d21bb85SMaximilian Luz
1510d21bb85SMaximilian Luz return get_unaligned_le16(&p->data.ptr[SSH_MSGOFFSET_COMMAND(rqid)]);
1520d21bb85SMaximilian Luz }
1530d21bb85SMaximilian Luz
1540d21bb85SMaximilian Luz /**
155*2730fc0aSMaximilian Luz * ssam_trace_get_request_tid() - Read the packet's request target ID.
156*2730fc0aSMaximilian Luz * @p: The packet.
157*2730fc0aSMaximilian Luz *
158*2730fc0aSMaximilian Luz * Return: Returns the packet's request target ID (TID) field if the packet
159*2730fc0aSMaximilian Luz * represents a request with command data, or %SSAM_SSH_TID_NOT_APPLICABLE
160*2730fc0aSMaximilian Luz * if not (e.g. flush request, control packet).
161*2730fc0aSMaximilian Luz */
ssam_trace_get_request_tid(const struct ssh_packet * p)162*2730fc0aSMaximilian Luz static inline u32 ssam_trace_get_request_tid(const struct ssh_packet *p)
163*2730fc0aSMaximilian Luz {
164*2730fc0aSMaximilian Luz if (!p->data.ptr || p->data.len < SSH_COMMAND_MESSAGE_LENGTH(0))
165*2730fc0aSMaximilian Luz return SSAM_SSH_TID_NOT_APPLICABLE;
166*2730fc0aSMaximilian Luz
167*2730fc0aSMaximilian Luz return get_unaligned_le16(&p->data.ptr[SSH_MSGOFFSET_COMMAND(tid)]);
168*2730fc0aSMaximilian Luz }
169*2730fc0aSMaximilian Luz
170*2730fc0aSMaximilian Luz /**
171*2730fc0aSMaximilian Luz * ssam_trace_get_request_sid() - Read the packet's request source ID.
172*2730fc0aSMaximilian Luz * @p: The packet.
173*2730fc0aSMaximilian Luz *
174*2730fc0aSMaximilian Luz * Return: Returns the packet's request source ID (SID) field if the packet
175*2730fc0aSMaximilian Luz * represents a request with command data, or %SSAM_SSH_TID_NOT_APPLICABLE
176*2730fc0aSMaximilian Luz * if not (e.g. flush request, control packet).
177*2730fc0aSMaximilian Luz */
ssam_trace_get_request_sid(const struct ssh_packet * p)178*2730fc0aSMaximilian Luz static inline u32 ssam_trace_get_request_sid(const struct ssh_packet *p)
179*2730fc0aSMaximilian Luz {
180*2730fc0aSMaximilian Luz if (!p->data.ptr || p->data.len < SSH_COMMAND_MESSAGE_LENGTH(0))
181*2730fc0aSMaximilian Luz return SSAM_SSH_TID_NOT_APPLICABLE;
182*2730fc0aSMaximilian Luz
183*2730fc0aSMaximilian Luz return get_unaligned_le16(&p->data.ptr[SSH_MSGOFFSET_COMMAND(sid)]);
184*2730fc0aSMaximilian Luz }
185*2730fc0aSMaximilian Luz
186*2730fc0aSMaximilian Luz /**
1870d21bb85SMaximilian Luz * ssam_trace_get_request_tc() - Read the packet's request target category.
1880d21bb85SMaximilian Luz * @p: The packet.
1890d21bb85SMaximilian Luz *
1900d21bb85SMaximilian Luz * Return: Returns the packet's request target category (TC) field if the
191*2730fc0aSMaximilian Luz * packet represents a request with command data, or %SSAM_SSH_TC_NOT_APPLICABLE
1920d21bb85SMaximilian Luz * if not (e.g. flush request, control packet).
1930d21bb85SMaximilian Luz */
ssam_trace_get_request_tc(const struct ssh_packet * p)1940d21bb85SMaximilian Luz static inline u32 ssam_trace_get_request_tc(const struct ssh_packet *p)
1950d21bb85SMaximilian Luz {
1960d21bb85SMaximilian Luz if (!p->data.ptr || p->data.len < SSH_COMMAND_MESSAGE_LENGTH(0))
1970d21bb85SMaximilian Luz return SSAM_SSH_TC_NOT_APPLICABLE;
1980d21bb85SMaximilian Luz
1990d21bb85SMaximilian Luz return get_unaligned_le16(&p->data.ptr[SSH_MSGOFFSET_COMMAND(tc)]);
2000d21bb85SMaximilian Luz }
2010d21bb85SMaximilian Luz
2020d21bb85SMaximilian Luz #endif /* _SURFACE_AGGREGATOR_TRACE_HELPERS */
2030d21bb85SMaximilian Luz
2040d21bb85SMaximilian Luz #define ssam_trace_get_command_field_u8(packet, field) \
2050d21bb85SMaximilian Luz ((!(packet) || (packet)->data.len < SSH_COMMAND_MESSAGE_LENGTH(0)) \
2060d21bb85SMaximilian Luz ? 0 : (packet)->data.ptr[SSH_MSGOFFSET_COMMAND(field)])
2070d21bb85SMaximilian Luz
2080d21bb85SMaximilian Luz #define ssam_show_generic_u8_field(value) \
2090d21bb85SMaximilian Luz __print_symbolic(value, \
2100d21bb85SMaximilian Luz { SSAM_U8_FIELD_NOT_APPLICABLE, "N/A" } \
2110d21bb85SMaximilian Luz )
2120d21bb85SMaximilian Luz
2130d21bb85SMaximilian Luz #define ssam_show_frame_type(ty) \
2140d21bb85SMaximilian Luz __print_symbolic(ty, \
2150d21bb85SMaximilian Luz { SSH_FRAME_TYPE_DATA_SEQ, "DSEQ" }, \
2160d21bb85SMaximilian Luz { SSH_FRAME_TYPE_DATA_NSQ, "DNSQ" }, \
2170d21bb85SMaximilian Luz { SSH_FRAME_TYPE_ACK, "ACK" }, \
2180d21bb85SMaximilian Luz { SSH_FRAME_TYPE_NAK, "NAK" } \
2190d21bb85SMaximilian Luz )
2200d21bb85SMaximilian Luz
2210d21bb85SMaximilian Luz #define ssam_show_packet_type(type) \
2220d21bb85SMaximilian Luz __print_flags(flags & SSH_PACKET_FLAGS_TY_MASK, "", \
2230d21bb85SMaximilian Luz { BIT(SSH_PACKET_TY_FLUSH_BIT), "F" }, \
2240d21bb85SMaximilian Luz { BIT(SSH_PACKET_TY_SEQUENCED_BIT), "S" }, \
2250d21bb85SMaximilian Luz { BIT(SSH_PACKET_TY_BLOCKING_BIT), "B" } \
2260d21bb85SMaximilian Luz )
2270d21bb85SMaximilian Luz
2280d21bb85SMaximilian Luz #define ssam_show_packet_state(state) \
2290d21bb85SMaximilian Luz __print_flags(flags & SSH_PACKET_FLAGS_SF_MASK, "", \
2300d21bb85SMaximilian Luz { BIT(SSH_PACKET_SF_LOCKED_BIT), "L" }, \
2310d21bb85SMaximilian Luz { BIT(SSH_PACKET_SF_QUEUED_BIT), "Q" }, \
2320d21bb85SMaximilian Luz { BIT(SSH_PACKET_SF_PENDING_BIT), "P" }, \
2330d21bb85SMaximilian Luz { BIT(SSH_PACKET_SF_TRANSMITTING_BIT), "S" }, \
2340d21bb85SMaximilian Luz { BIT(SSH_PACKET_SF_TRANSMITTED_BIT), "T" }, \
2350d21bb85SMaximilian Luz { BIT(SSH_PACKET_SF_ACKED_BIT), "A" }, \
2360d21bb85SMaximilian Luz { BIT(SSH_PACKET_SF_CANCELED_BIT), "C" }, \
2370d21bb85SMaximilian Luz { BIT(SSH_PACKET_SF_COMPLETED_BIT), "F" } \
2380d21bb85SMaximilian Luz )
2390d21bb85SMaximilian Luz
2400d21bb85SMaximilian Luz #define ssam_show_packet_seq(seq) \
2410d21bb85SMaximilian Luz __print_symbolic(seq, \
2420d21bb85SMaximilian Luz { SSAM_SEQ_NOT_APPLICABLE, "N/A" } \
2430d21bb85SMaximilian Luz )
2440d21bb85SMaximilian Luz
2450d21bb85SMaximilian Luz #define ssam_show_request_type(flags) \
2460d21bb85SMaximilian Luz __print_flags((flags) & SSH_REQUEST_FLAGS_TY_MASK, "", \
2470d21bb85SMaximilian Luz { BIT(SSH_REQUEST_TY_FLUSH_BIT), "F" }, \
2480d21bb85SMaximilian Luz { BIT(SSH_REQUEST_TY_HAS_RESPONSE_BIT), "R" } \
2490d21bb85SMaximilian Luz )
2500d21bb85SMaximilian Luz
2510d21bb85SMaximilian Luz #define ssam_show_request_state(flags) \
2520d21bb85SMaximilian Luz __print_flags((flags) & SSH_REQUEST_FLAGS_SF_MASK, "", \
2530d21bb85SMaximilian Luz { BIT(SSH_REQUEST_SF_LOCKED_BIT), "L" }, \
2540d21bb85SMaximilian Luz { BIT(SSH_REQUEST_SF_QUEUED_BIT), "Q" }, \
2550d21bb85SMaximilian Luz { BIT(SSH_REQUEST_SF_PENDING_BIT), "P" }, \
2560d21bb85SMaximilian Luz { BIT(SSH_REQUEST_SF_TRANSMITTING_BIT), "S" }, \
2570d21bb85SMaximilian Luz { BIT(SSH_REQUEST_SF_TRANSMITTED_BIT), "T" }, \
2580d21bb85SMaximilian Luz { BIT(SSH_REQUEST_SF_RSPRCVD_BIT), "A" }, \
2590d21bb85SMaximilian Luz { BIT(SSH_REQUEST_SF_CANCELED_BIT), "C" }, \
2600d21bb85SMaximilian Luz { BIT(SSH_REQUEST_SF_COMPLETED_BIT), "F" } \
2610d21bb85SMaximilian Luz )
2620d21bb85SMaximilian Luz
2630d21bb85SMaximilian Luz #define ssam_show_request_id(rqid) \
2640d21bb85SMaximilian Luz __print_symbolic(rqid, \
2650d21bb85SMaximilian Luz { SSAM_RQID_NOT_APPLICABLE, "N/A" } \
2660d21bb85SMaximilian Luz )
2670d21bb85SMaximilian Luz
268*2730fc0aSMaximilian Luz #define ssam_show_ssh_tid(tid) \
269*2730fc0aSMaximilian Luz __print_symbolic(tid, \
270*2730fc0aSMaximilian Luz { SSAM_SSH_TID_NOT_APPLICABLE, "N/A" }, \
271*2730fc0aSMaximilian Luz { SSAM_SSH_TID_HOST, "Host" }, \
272*2730fc0aSMaximilian Luz { SSAM_SSH_TID_SAM, "SAM" }, \
273*2730fc0aSMaximilian Luz { SSAM_SSH_TID_KIP, "KIP" }, \
274*2730fc0aSMaximilian Luz { SSAM_SSH_TID_DEBUG, "Debug" }, \
275*2730fc0aSMaximilian Luz { SSAM_SSH_TID_SURFLINK, "SurfLink" } \
276*2730fc0aSMaximilian Luz )
277*2730fc0aSMaximilian Luz
278*2730fc0aSMaximilian Luz #define ssam_show_ssh_tc(tc) \
279*2730fc0aSMaximilian Luz __print_symbolic(tc, \
2800d21bb85SMaximilian Luz { SSAM_SSH_TC_NOT_APPLICABLE, "N/A" }, \
2810d21bb85SMaximilian Luz { SSAM_SSH_TC_SAM, "SAM" }, \
2820d21bb85SMaximilian Luz { SSAM_SSH_TC_BAT, "BAT" }, \
2830d21bb85SMaximilian Luz { SSAM_SSH_TC_TMP, "TMP" }, \
2840d21bb85SMaximilian Luz { SSAM_SSH_TC_PMC, "PMC" }, \
2850d21bb85SMaximilian Luz { SSAM_SSH_TC_FAN, "FAN" }, \
2860d21bb85SMaximilian Luz { SSAM_SSH_TC_PoM, "PoM" }, \
2870d21bb85SMaximilian Luz { SSAM_SSH_TC_DBG, "DBG" }, \
2880d21bb85SMaximilian Luz { SSAM_SSH_TC_KBD, "KBD" }, \
2890d21bb85SMaximilian Luz { SSAM_SSH_TC_FWU, "FWU" }, \
2900d21bb85SMaximilian Luz { SSAM_SSH_TC_UNI, "UNI" }, \
2910d21bb85SMaximilian Luz { SSAM_SSH_TC_LPC, "LPC" }, \
2920d21bb85SMaximilian Luz { SSAM_SSH_TC_TCL, "TCL" }, \
2930d21bb85SMaximilian Luz { SSAM_SSH_TC_SFL, "SFL" }, \
2940d21bb85SMaximilian Luz { SSAM_SSH_TC_KIP, "KIP" }, \
2950d21bb85SMaximilian Luz { SSAM_SSH_TC_EXT, "EXT" }, \
2960d21bb85SMaximilian Luz { SSAM_SSH_TC_BLD, "BLD" }, \
2970d21bb85SMaximilian Luz { SSAM_SSH_TC_BAS, "BAS" }, \
2980d21bb85SMaximilian Luz { SSAM_SSH_TC_SEN, "SEN" }, \
2990d21bb85SMaximilian Luz { SSAM_SSH_TC_SRQ, "SRQ" }, \
3000d21bb85SMaximilian Luz { SSAM_SSH_TC_MCU, "MCU" }, \
3010d21bb85SMaximilian Luz { SSAM_SSH_TC_HID, "HID" }, \
3020d21bb85SMaximilian Luz { SSAM_SSH_TC_TCH, "TCH" }, \
3030d21bb85SMaximilian Luz { SSAM_SSH_TC_BKL, "BKL" }, \
3040d21bb85SMaximilian Luz { SSAM_SSH_TC_TAM, "TAM" }, \
305e244a46aSMaximilian Luz { SSAM_SSH_TC_ACC0, "ACC0" }, \
3060d21bb85SMaximilian Luz { SSAM_SSH_TC_UFI, "UFI" }, \
3070d21bb85SMaximilian Luz { SSAM_SSH_TC_USC, "USC" }, \
3080d21bb85SMaximilian Luz { SSAM_SSH_TC_PEN, "PEN" }, \
3090d21bb85SMaximilian Luz { SSAM_SSH_TC_VID, "VID" }, \
3100d21bb85SMaximilian Luz { SSAM_SSH_TC_AUD, "AUD" }, \
3110d21bb85SMaximilian Luz { SSAM_SSH_TC_SMC, "SMC" }, \
3120d21bb85SMaximilian Luz { SSAM_SSH_TC_KPD, "KPD" }, \
313e244a46aSMaximilian Luz { SSAM_SSH_TC_REG, "REG" }, \
314e244a46aSMaximilian Luz { SSAM_SSH_TC_SPT, "SPT" }, \
315e244a46aSMaximilian Luz { SSAM_SSH_TC_SYS, "SYS" }, \
316e244a46aSMaximilian Luz { SSAM_SSH_TC_ACC1, "ACC1" }, \
317e244a46aSMaximilian Luz { SSAM_SSH_TC_SHB, "SMB" }, \
318e244a46aSMaximilian Luz { SSAM_SSH_TC_POS, "POS" } \
3190d21bb85SMaximilian Luz )
3200d21bb85SMaximilian Luz
3210d21bb85SMaximilian Luz DECLARE_EVENT_CLASS(ssam_frame_class,
3220d21bb85SMaximilian Luz TP_PROTO(const struct ssh_frame *frame),
3230d21bb85SMaximilian Luz
3240d21bb85SMaximilian Luz TP_ARGS(frame),
3250d21bb85SMaximilian Luz
3260d21bb85SMaximilian Luz TP_STRUCT__entry(
3270d21bb85SMaximilian Luz __field(u8, type)
3280d21bb85SMaximilian Luz __field(u8, seq)
3290d21bb85SMaximilian Luz __field(u16, len)
3300d21bb85SMaximilian Luz ),
3310d21bb85SMaximilian Luz
3320d21bb85SMaximilian Luz TP_fast_assign(
3330d21bb85SMaximilian Luz __entry->type = frame->type;
3340d21bb85SMaximilian Luz __entry->seq = frame->seq;
3350d21bb85SMaximilian Luz __entry->len = get_unaligned_le16(&frame->len);
3360d21bb85SMaximilian Luz ),
3370d21bb85SMaximilian Luz
3380d21bb85SMaximilian Luz TP_printk("ty=%s, seq=%#04x, len=%u",
3390d21bb85SMaximilian Luz ssam_show_frame_type(__entry->type),
3400d21bb85SMaximilian Luz __entry->seq,
3410d21bb85SMaximilian Luz __entry->len
3420d21bb85SMaximilian Luz )
3430d21bb85SMaximilian Luz );
3440d21bb85SMaximilian Luz
3450d21bb85SMaximilian Luz #define DEFINE_SSAM_FRAME_EVENT(name) \
3460d21bb85SMaximilian Luz DEFINE_EVENT(ssam_frame_class, ssam_##name, \
3470d21bb85SMaximilian Luz TP_PROTO(const struct ssh_frame *frame), \
3480d21bb85SMaximilian Luz TP_ARGS(frame) \
3490d21bb85SMaximilian Luz )
3500d21bb85SMaximilian Luz
3510d21bb85SMaximilian Luz DECLARE_EVENT_CLASS(ssam_command_class,
3520d21bb85SMaximilian Luz TP_PROTO(const struct ssh_command *cmd, u16 len),
3530d21bb85SMaximilian Luz
3540d21bb85SMaximilian Luz TP_ARGS(cmd, len),
3550d21bb85SMaximilian Luz
3560d21bb85SMaximilian Luz TP_STRUCT__entry(
3570d21bb85SMaximilian Luz __field(u16, rqid)
3580d21bb85SMaximilian Luz __field(u16, len)
359*2730fc0aSMaximilian Luz __field(u8, tid)
360*2730fc0aSMaximilian Luz __field(u8, sid)
3610d21bb85SMaximilian Luz __field(u8, tc)
3620d21bb85SMaximilian Luz __field(u8, cid)
3630d21bb85SMaximilian Luz __field(u8, iid)
3640d21bb85SMaximilian Luz ),
3650d21bb85SMaximilian Luz
3660d21bb85SMaximilian Luz TP_fast_assign(
3670d21bb85SMaximilian Luz __entry->rqid = get_unaligned_le16(&cmd->rqid);
368*2730fc0aSMaximilian Luz __entry->tid = cmd->tid;
369*2730fc0aSMaximilian Luz __entry->sid = cmd->sid;
3700d21bb85SMaximilian Luz __entry->tc = cmd->tc;
3710d21bb85SMaximilian Luz __entry->cid = cmd->cid;
3720d21bb85SMaximilian Luz __entry->iid = cmd->iid;
3730d21bb85SMaximilian Luz __entry->len = len;
3740d21bb85SMaximilian Luz ),
3750d21bb85SMaximilian Luz
376*2730fc0aSMaximilian Luz TP_printk("rqid=%#06x, tid=%s, sid=%s, tc=%s, cid=%#04x, iid=%#04x, len=%u",
3770d21bb85SMaximilian Luz __entry->rqid,
378*2730fc0aSMaximilian Luz ssam_show_ssh_tid(__entry->tid),
379*2730fc0aSMaximilian Luz ssam_show_ssh_tid(__entry->sid),
3800d21bb85SMaximilian Luz ssam_show_ssh_tc(__entry->tc),
3810d21bb85SMaximilian Luz __entry->cid,
3820d21bb85SMaximilian Luz __entry->iid,
3830d21bb85SMaximilian Luz __entry->len
3840d21bb85SMaximilian Luz )
3850d21bb85SMaximilian Luz );
3860d21bb85SMaximilian Luz
3870d21bb85SMaximilian Luz #define DEFINE_SSAM_COMMAND_EVENT(name) \
3880d21bb85SMaximilian Luz DEFINE_EVENT(ssam_command_class, ssam_##name, \
3890d21bb85SMaximilian Luz TP_PROTO(const struct ssh_command *cmd, u16 len), \
3900d21bb85SMaximilian Luz TP_ARGS(cmd, len) \
3910d21bb85SMaximilian Luz )
3920d21bb85SMaximilian Luz
3930d21bb85SMaximilian Luz DECLARE_EVENT_CLASS(ssam_packet_class,
3940d21bb85SMaximilian Luz TP_PROTO(const struct ssh_packet *packet),
3950d21bb85SMaximilian Luz
3960d21bb85SMaximilian Luz TP_ARGS(packet),
3970d21bb85SMaximilian Luz
3980d21bb85SMaximilian Luz TP_STRUCT__entry(
3990d21bb85SMaximilian Luz __field(unsigned long, state)
4000d21bb85SMaximilian Luz __array(char, uid, SSAM_PTR_UID_LEN)
4010d21bb85SMaximilian Luz __field(u8, priority)
4020d21bb85SMaximilian Luz __field(u16, length)
4030d21bb85SMaximilian Luz __field(u16, seq)
4040d21bb85SMaximilian Luz ),
4050d21bb85SMaximilian Luz
4060d21bb85SMaximilian Luz TP_fast_assign(
4070d21bb85SMaximilian Luz __entry->state = READ_ONCE(packet->state);
4080d21bb85SMaximilian Luz ssam_trace_ptr_uid(packet, __entry->uid);
4090d21bb85SMaximilian Luz __entry->priority = READ_ONCE(packet->priority);
4100d21bb85SMaximilian Luz __entry->length = packet->data.len;
4110d21bb85SMaximilian Luz __entry->seq = ssam_trace_get_packet_seq(packet);
4120d21bb85SMaximilian Luz ),
4130d21bb85SMaximilian Luz
4140d21bb85SMaximilian Luz TP_printk("uid=%s, seq=%s, ty=%s, pri=%#04x, len=%u, sta=%s",
4150d21bb85SMaximilian Luz __entry->uid,
4160d21bb85SMaximilian Luz ssam_show_packet_seq(__entry->seq),
4170d21bb85SMaximilian Luz ssam_show_packet_type(__entry->state),
4180d21bb85SMaximilian Luz __entry->priority,
4190d21bb85SMaximilian Luz __entry->length,
4200d21bb85SMaximilian Luz ssam_show_packet_state(__entry->state)
4210d21bb85SMaximilian Luz )
4220d21bb85SMaximilian Luz );
4230d21bb85SMaximilian Luz
4240d21bb85SMaximilian Luz #define DEFINE_SSAM_PACKET_EVENT(name) \
4250d21bb85SMaximilian Luz DEFINE_EVENT(ssam_packet_class, ssam_##name, \
4260d21bb85SMaximilian Luz TP_PROTO(const struct ssh_packet *packet), \
4270d21bb85SMaximilian Luz TP_ARGS(packet) \
4280d21bb85SMaximilian Luz )
4290d21bb85SMaximilian Luz
4300d21bb85SMaximilian Luz DECLARE_EVENT_CLASS(ssam_packet_status_class,
4310d21bb85SMaximilian Luz TP_PROTO(const struct ssh_packet *packet, int status),
4320d21bb85SMaximilian Luz
4330d21bb85SMaximilian Luz TP_ARGS(packet, status),
4340d21bb85SMaximilian Luz
4350d21bb85SMaximilian Luz TP_STRUCT__entry(
4360d21bb85SMaximilian Luz __field(unsigned long, state)
4370d21bb85SMaximilian Luz __field(int, status)
4380d21bb85SMaximilian Luz __array(char, uid, SSAM_PTR_UID_LEN)
4390d21bb85SMaximilian Luz __field(u8, priority)
4400d21bb85SMaximilian Luz __field(u16, length)
4410d21bb85SMaximilian Luz __field(u16, seq)
4420d21bb85SMaximilian Luz ),
4430d21bb85SMaximilian Luz
4440d21bb85SMaximilian Luz TP_fast_assign(
4450d21bb85SMaximilian Luz __entry->state = READ_ONCE(packet->state);
4460d21bb85SMaximilian Luz __entry->status = status;
4470d21bb85SMaximilian Luz ssam_trace_ptr_uid(packet, __entry->uid);
4480d21bb85SMaximilian Luz __entry->priority = READ_ONCE(packet->priority);
4490d21bb85SMaximilian Luz __entry->length = packet->data.len;
4500d21bb85SMaximilian Luz __entry->seq = ssam_trace_get_packet_seq(packet);
4510d21bb85SMaximilian Luz ),
4520d21bb85SMaximilian Luz
4530d21bb85SMaximilian Luz TP_printk("uid=%s, seq=%s, ty=%s, pri=%#04x, len=%u, sta=%s, status=%d",
4540d21bb85SMaximilian Luz __entry->uid,
4550d21bb85SMaximilian Luz ssam_show_packet_seq(__entry->seq),
4560d21bb85SMaximilian Luz ssam_show_packet_type(__entry->state),
4570d21bb85SMaximilian Luz __entry->priority,
4580d21bb85SMaximilian Luz __entry->length,
4590d21bb85SMaximilian Luz ssam_show_packet_state(__entry->state),
4600d21bb85SMaximilian Luz __entry->status
4610d21bb85SMaximilian Luz )
4620d21bb85SMaximilian Luz );
4630d21bb85SMaximilian Luz
4640d21bb85SMaximilian Luz #define DEFINE_SSAM_PACKET_STATUS_EVENT(name) \
4650d21bb85SMaximilian Luz DEFINE_EVENT(ssam_packet_status_class, ssam_##name, \
4660d21bb85SMaximilian Luz TP_PROTO(const struct ssh_packet *packet, int status), \
4670d21bb85SMaximilian Luz TP_ARGS(packet, status) \
4680d21bb85SMaximilian Luz )
4690d21bb85SMaximilian Luz
4700d21bb85SMaximilian Luz DECLARE_EVENT_CLASS(ssam_request_class,
4710d21bb85SMaximilian Luz TP_PROTO(const struct ssh_request *request),
4720d21bb85SMaximilian Luz
4730d21bb85SMaximilian Luz TP_ARGS(request),
4740d21bb85SMaximilian Luz
4750d21bb85SMaximilian Luz TP_STRUCT__entry(
4760d21bb85SMaximilian Luz __field(unsigned long, state)
4770d21bb85SMaximilian Luz __field(u32, rqid)
4780d21bb85SMaximilian Luz __array(char, uid, SSAM_PTR_UID_LEN)
4790d21bb85SMaximilian Luz __field(u8, tc)
4800d21bb85SMaximilian Luz __field(u16, cid)
4810d21bb85SMaximilian Luz __field(u16, iid)
482*2730fc0aSMaximilian Luz __field(u8, tid)
483*2730fc0aSMaximilian Luz __field(u8, sid)
4840d21bb85SMaximilian Luz ),
4850d21bb85SMaximilian Luz
4860d21bb85SMaximilian Luz TP_fast_assign(
4870d21bb85SMaximilian Luz const struct ssh_packet *p = &request->packet;
4880d21bb85SMaximilian Luz
4890d21bb85SMaximilian Luz /* Use packet for UID so we can match requests to packets. */
4900d21bb85SMaximilian Luz __entry->state = READ_ONCE(request->state);
4910d21bb85SMaximilian Luz __entry->rqid = ssam_trace_get_request_id(p);
4920d21bb85SMaximilian Luz ssam_trace_ptr_uid(p, __entry->uid);
493*2730fc0aSMaximilian Luz __entry->tid = ssam_trace_get_request_tid(p);
494*2730fc0aSMaximilian Luz __entry->sid = ssam_trace_get_request_sid(p);
4950d21bb85SMaximilian Luz __entry->tc = ssam_trace_get_request_tc(p);
4960d21bb85SMaximilian Luz __entry->cid = ssam_trace_get_command_field_u8(p, cid);
4970d21bb85SMaximilian Luz __entry->iid = ssam_trace_get_command_field_u8(p, iid);
4980d21bb85SMaximilian Luz ),
4990d21bb85SMaximilian Luz
500*2730fc0aSMaximilian Luz TP_printk("uid=%s, rqid=%s, ty=%s, sta=%s, tid=%s, sid=%s, tc=%s, cid=%s, iid=%s",
5010d21bb85SMaximilian Luz __entry->uid,
5020d21bb85SMaximilian Luz ssam_show_request_id(__entry->rqid),
5030d21bb85SMaximilian Luz ssam_show_request_type(__entry->state),
5040d21bb85SMaximilian Luz ssam_show_request_state(__entry->state),
505*2730fc0aSMaximilian Luz ssam_show_ssh_tid(__entry->tid),
506*2730fc0aSMaximilian Luz ssam_show_ssh_tid(__entry->sid),
5070d21bb85SMaximilian Luz ssam_show_ssh_tc(__entry->tc),
5080d21bb85SMaximilian Luz ssam_show_generic_u8_field(__entry->cid),
5090d21bb85SMaximilian Luz ssam_show_generic_u8_field(__entry->iid)
5100d21bb85SMaximilian Luz )
5110d21bb85SMaximilian Luz );
5120d21bb85SMaximilian Luz
5130d21bb85SMaximilian Luz #define DEFINE_SSAM_REQUEST_EVENT(name) \
5140d21bb85SMaximilian Luz DEFINE_EVENT(ssam_request_class, ssam_##name, \
5150d21bb85SMaximilian Luz TP_PROTO(const struct ssh_request *request), \
5160d21bb85SMaximilian Luz TP_ARGS(request) \
5170d21bb85SMaximilian Luz )
5180d21bb85SMaximilian Luz
5190d21bb85SMaximilian Luz DECLARE_EVENT_CLASS(ssam_request_status_class,
5200d21bb85SMaximilian Luz TP_PROTO(const struct ssh_request *request, int status),
5210d21bb85SMaximilian Luz
5220d21bb85SMaximilian Luz TP_ARGS(request, status),
5230d21bb85SMaximilian Luz
5240d21bb85SMaximilian Luz TP_STRUCT__entry(
5250d21bb85SMaximilian Luz __field(unsigned long, state)
5260d21bb85SMaximilian Luz __field(u32, rqid)
5270d21bb85SMaximilian Luz __field(int, status)
5280d21bb85SMaximilian Luz __array(char, uid, SSAM_PTR_UID_LEN)
5290d21bb85SMaximilian Luz __field(u8, tc)
5300d21bb85SMaximilian Luz __field(u16, cid)
5310d21bb85SMaximilian Luz __field(u16, iid)
532*2730fc0aSMaximilian Luz __field(u8, tid)
533*2730fc0aSMaximilian Luz __field(u8, sid)
5340d21bb85SMaximilian Luz ),
5350d21bb85SMaximilian Luz
5360d21bb85SMaximilian Luz TP_fast_assign(
5370d21bb85SMaximilian Luz const struct ssh_packet *p = &request->packet;
5380d21bb85SMaximilian Luz
5390d21bb85SMaximilian Luz /* Use packet for UID so we can match requests to packets. */
5400d21bb85SMaximilian Luz __entry->state = READ_ONCE(request->state);
5410d21bb85SMaximilian Luz __entry->rqid = ssam_trace_get_request_id(p);
5420d21bb85SMaximilian Luz __entry->status = status;
5430d21bb85SMaximilian Luz ssam_trace_ptr_uid(p, __entry->uid);
544*2730fc0aSMaximilian Luz __entry->tid = ssam_trace_get_request_tid(p);
545*2730fc0aSMaximilian Luz __entry->sid = ssam_trace_get_request_sid(p);
5460d21bb85SMaximilian Luz __entry->tc = ssam_trace_get_request_tc(p);
5470d21bb85SMaximilian Luz __entry->cid = ssam_trace_get_command_field_u8(p, cid);
5480d21bb85SMaximilian Luz __entry->iid = ssam_trace_get_command_field_u8(p, iid);
5490d21bb85SMaximilian Luz ),
5500d21bb85SMaximilian Luz
551*2730fc0aSMaximilian Luz TP_printk("uid=%s, rqid=%s, ty=%s, sta=%s, tid=%s, sid=%s, tc=%s, cid=%s, iid=%s, status=%d",
5520d21bb85SMaximilian Luz __entry->uid,
5530d21bb85SMaximilian Luz ssam_show_request_id(__entry->rqid),
5540d21bb85SMaximilian Luz ssam_show_request_type(__entry->state),
5550d21bb85SMaximilian Luz ssam_show_request_state(__entry->state),
556*2730fc0aSMaximilian Luz ssam_show_ssh_tid(__entry->tid),
557*2730fc0aSMaximilian Luz ssam_show_ssh_tid(__entry->sid),
5580d21bb85SMaximilian Luz ssam_show_ssh_tc(__entry->tc),
5590d21bb85SMaximilian Luz ssam_show_generic_u8_field(__entry->cid),
5600d21bb85SMaximilian Luz ssam_show_generic_u8_field(__entry->iid),
5610d21bb85SMaximilian Luz __entry->status
5620d21bb85SMaximilian Luz )
5630d21bb85SMaximilian Luz );
5640d21bb85SMaximilian Luz
5650d21bb85SMaximilian Luz #define DEFINE_SSAM_REQUEST_STATUS_EVENT(name) \
5660d21bb85SMaximilian Luz DEFINE_EVENT(ssam_request_status_class, ssam_##name, \
5670d21bb85SMaximilian Luz TP_PROTO(const struct ssh_request *request, int status),\
5680d21bb85SMaximilian Luz TP_ARGS(request, status) \
5690d21bb85SMaximilian Luz )
5700d21bb85SMaximilian Luz
5710d21bb85SMaximilian Luz DECLARE_EVENT_CLASS(ssam_alloc_class,
5720d21bb85SMaximilian Luz TP_PROTO(void *ptr, size_t len),
5730d21bb85SMaximilian Luz
5740d21bb85SMaximilian Luz TP_ARGS(ptr, len),
5750d21bb85SMaximilian Luz
5760d21bb85SMaximilian Luz TP_STRUCT__entry(
5770d21bb85SMaximilian Luz __field(size_t, len)
5780d21bb85SMaximilian Luz __array(char, uid, SSAM_PTR_UID_LEN)
5790d21bb85SMaximilian Luz ),
5800d21bb85SMaximilian Luz
5810d21bb85SMaximilian Luz TP_fast_assign(
5820d21bb85SMaximilian Luz __entry->len = len;
5830d21bb85SMaximilian Luz ssam_trace_ptr_uid(ptr, __entry->uid);
5840d21bb85SMaximilian Luz ),
5850d21bb85SMaximilian Luz
5860d21bb85SMaximilian Luz TP_printk("uid=%s, len=%zu", __entry->uid, __entry->len)
5870d21bb85SMaximilian Luz );
5880d21bb85SMaximilian Luz
5890d21bb85SMaximilian Luz #define DEFINE_SSAM_ALLOC_EVENT(name) \
5900d21bb85SMaximilian Luz DEFINE_EVENT(ssam_alloc_class, ssam_##name, \
5910d21bb85SMaximilian Luz TP_PROTO(void *ptr, size_t len), \
5920d21bb85SMaximilian Luz TP_ARGS(ptr, len) \
5930d21bb85SMaximilian Luz )
5940d21bb85SMaximilian Luz
5950d21bb85SMaximilian Luz DECLARE_EVENT_CLASS(ssam_free_class,
5960d21bb85SMaximilian Luz TP_PROTO(void *ptr),
5970d21bb85SMaximilian Luz
5980d21bb85SMaximilian Luz TP_ARGS(ptr),
5990d21bb85SMaximilian Luz
6000d21bb85SMaximilian Luz TP_STRUCT__entry(
6010d21bb85SMaximilian Luz __array(char, uid, SSAM_PTR_UID_LEN)
6020d21bb85SMaximilian Luz ),
6030d21bb85SMaximilian Luz
6040d21bb85SMaximilian Luz TP_fast_assign(
6050d21bb85SMaximilian Luz ssam_trace_ptr_uid(ptr, __entry->uid);
6060d21bb85SMaximilian Luz ),
6070d21bb85SMaximilian Luz
6080d21bb85SMaximilian Luz TP_printk("uid=%s", __entry->uid)
6090d21bb85SMaximilian Luz );
6100d21bb85SMaximilian Luz
6110d21bb85SMaximilian Luz #define DEFINE_SSAM_FREE_EVENT(name) \
6120d21bb85SMaximilian Luz DEFINE_EVENT(ssam_free_class, ssam_##name, \
6130d21bb85SMaximilian Luz TP_PROTO(void *ptr), \
6140d21bb85SMaximilian Luz TP_ARGS(ptr) \
6150d21bb85SMaximilian Luz )
6160d21bb85SMaximilian Luz
6170d21bb85SMaximilian Luz DECLARE_EVENT_CLASS(ssam_pending_class,
6180d21bb85SMaximilian Luz TP_PROTO(unsigned int pending),
6190d21bb85SMaximilian Luz
6200d21bb85SMaximilian Luz TP_ARGS(pending),
6210d21bb85SMaximilian Luz
6220d21bb85SMaximilian Luz TP_STRUCT__entry(
6230d21bb85SMaximilian Luz __field(unsigned int, pending)
6240d21bb85SMaximilian Luz ),
6250d21bb85SMaximilian Luz
6260d21bb85SMaximilian Luz TP_fast_assign(
6270d21bb85SMaximilian Luz __entry->pending = pending;
6280d21bb85SMaximilian Luz ),
6290d21bb85SMaximilian Luz
6300d21bb85SMaximilian Luz TP_printk("pending=%u", __entry->pending)
6310d21bb85SMaximilian Luz );
6320d21bb85SMaximilian Luz
6330d21bb85SMaximilian Luz #define DEFINE_SSAM_PENDING_EVENT(name) \
6340d21bb85SMaximilian Luz DEFINE_EVENT(ssam_pending_class, ssam_##name, \
6350d21bb85SMaximilian Luz TP_PROTO(unsigned int pending), \
6360d21bb85SMaximilian Luz TP_ARGS(pending) \
6370d21bb85SMaximilian Luz )
6380d21bb85SMaximilian Luz
63902be44f6SMaximilian Luz DECLARE_EVENT_CLASS(ssam_data_class,
64002be44f6SMaximilian Luz TP_PROTO(size_t length),
64102be44f6SMaximilian Luz
64202be44f6SMaximilian Luz TP_ARGS(length),
64302be44f6SMaximilian Luz
64402be44f6SMaximilian Luz TP_STRUCT__entry(
64502be44f6SMaximilian Luz __field(size_t, length)
64602be44f6SMaximilian Luz ),
64702be44f6SMaximilian Luz
64802be44f6SMaximilian Luz TP_fast_assign(
64902be44f6SMaximilian Luz __entry->length = length;
65002be44f6SMaximilian Luz ),
65102be44f6SMaximilian Luz
65202be44f6SMaximilian Luz TP_printk("length=%zu", __entry->length)
65302be44f6SMaximilian Luz );
65402be44f6SMaximilian Luz
65502be44f6SMaximilian Luz #define DEFINE_SSAM_DATA_EVENT(name) \
65602be44f6SMaximilian Luz DEFINE_EVENT(ssam_data_class, ssam_##name, \
65702be44f6SMaximilian Luz TP_PROTO(size_t length), \
65802be44f6SMaximilian Luz TP_ARGS(length) \
65902be44f6SMaximilian Luz )
66002be44f6SMaximilian Luz
6610d21bb85SMaximilian Luz DEFINE_SSAM_FRAME_EVENT(rx_frame_received);
6620d21bb85SMaximilian Luz DEFINE_SSAM_COMMAND_EVENT(rx_response_received);
6630d21bb85SMaximilian Luz DEFINE_SSAM_COMMAND_EVENT(rx_event_received);
6640d21bb85SMaximilian Luz
6650d21bb85SMaximilian Luz DEFINE_SSAM_PACKET_EVENT(packet_release);
6660d21bb85SMaximilian Luz DEFINE_SSAM_PACKET_EVENT(packet_submit);
6670d21bb85SMaximilian Luz DEFINE_SSAM_PACKET_EVENT(packet_resubmit);
6680d21bb85SMaximilian Luz DEFINE_SSAM_PACKET_EVENT(packet_timeout);
6690d21bb85SMaximilian Luz DEFINE_SSAM_PACKET_EVENT(packet_cancel);
6700d21bb85SMaximilian Luz DEFINE_SSAM_PACKET_STATUS_EVENT(packet_complete);
6710d21bb85SMaximilian Luz DEFINE_SSAM_PENDING_EVENT(ptl_timeout_reap);
6720d21bb85SMaximilian Luz
6730d21bb85SMaximilian Luz DEFINE_SSAM_REQUEST_EVENT(request_submit);
6740d21bb85SMaximilian Luz DEFINE_SSAM_REQUEST_EVENT(request_timeout);
6750d21bb85SMaximilian Luz DEFINE_SSAM_REQUEST_EVENT(request_cancel);
6760d21bb85SMaximilian Luz DEFINE_SSAM_REQUEST_STATUS_EVENT(request_complete);
6770d21bb85SMaximilian Luz DEFINE_SSAM_PENDING_EVENT(rtl_timeout_reap);
6780d21bb85SMaximilian Luz
67902be44f6SMaximilian Luz DEFINE_SSAM_PACKET_EVENT(ei_tx_drop_ack_packet);
68002be44f6SMaximilian Luz DEFINE_SSAM_PACKET_EVENT(ei_tx_drop_nak_packet);
68102be44f6SMaximilian Luz DEFINE_SSAM_PACKET_EVENT(ei_tx_drop_dsq_packet);
68202be44f6SMaximilian Luz DEFINE_SSAM_PACKET_STATUS_EVENT(ei_tx_fail_write);
68302be44f6SMaximilian Luz DEFINE_SSAM_PACKET_EVENT(ei_tx_corrupt_data);
68402be44f6SMaximilian Luz DEFINE_SSAM_DATA_EVENT(ei_rx_corrupt_syn);
68502be44f6SMaximilian Luz DEFINE_SSAM_FRAME_EVENT(ei_rx_corrupt_data);
68602be44f6SMaximilian Luz DEFINE_SSAM_REQUEST_EVENT(ei_rx_drop_response);
68702be44f6SMaximilian Luz
6880d21bb85SMaximilian Luz DEFINE_SSAM_ALLOC_EVENT(ctrl_packet_alloc);
6890d21bb85SMaximilian Luz DEFINE_SSAM_FREE_EVENT(ctrl_packet_free);
6900d21bb85SMaximilian Luz
6910d21bb85SMaximilian Luz DEFINE_SSAM_ALLOC_EVENT(event_item_alloc);
6920d21bb85SMaximilian Luz DEFINE_SSAM_FREE_EVENT(event_item_free);
6930d21bb85SMaximilian Luz
6940d21bb85SMaximilian Luz #endif /* _SURFACE_AGGREGATOR_TRACE_H */
6950d21bb85SMaximilian Luz
6960d21bb85SMaximilian Luz /* This part must be outside protection */
6970d21bb85SMaximilian Luz #undef TRACE_INCLUDE_PATH
6980d21bb85SMaximilian Luz #undef TRACE_INCLUDE_FILE
6990d21bb85SMaximilian Luz
7000d21bb85SMaximilian Luz #define TRACE_INCLUDE_PATH .
7010d21bb85SMaximilian Luz #define TRACE_INCLUDE_FILE trace
7020d21bb85SMaximilian Luz
7030d21bb85SMaximilian Luz #include <trace/define_trace.h>
704