1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM rv
4 
5 #if !defined(_TRACE_RV_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_RV_H
7 
8 #include <linux/rv.h>
9 #include <linux/tracepoint.h>
10 
11 #ifdef CONFIG_DA_MON_EVENTS_IMPLICIT
12 DECLARE_EVENT_CLASS(event_da_monitor,
13 
14 	TP_PROTO(char *state, char *event, char *next_state, bool final_state),
15 
16 	TP_ARGS(state, event, next_state, final_state),
17 
18 	TP_STRUCT__entry(
19 		__array(	char,	state,		MAX_DA_NAME_LEN	)
20 		__array(	char,	event,		MAX_DA_NAME_LEN	)
21 		__array(	char,	next_state,	MAX_DA_NAME_LEN	)
22 		__field(	bool,	final_state			)
23 	),
24 
25 	TP_fast_assign(
26 		memcpy(__entry->state,		state,		MAX_DA_NAME_LEN);
27 		memcpy(__entry->event,		event,		MAX_DA_NAME_LEN);
28 		memcpy(__entry->next_state,	next_state,	MAX_DA_NAME_LEN);
29 		__entry->final_state		= final_state;
30 	),
31 
32 	TP_printk("%s x %s -> %s %s",
33 		__entry->state,
34 		__entry->event,
35 		__entry->next_state,
36 		__entry->final_state ? "(final)" : "")
37 );
38 
39 DECLARE_EVENT_CLASS(error_da_monitor,
40 
41 	TP_PROTO(char *state, char *event),
42 
43 	TP_ARGS(state, event),
44 
45 	TP_STRUCT__entry(
46 		__array(	char,	state,		MAX_DA_NAME_LEN	)
47 		__array(	char,	event,		MAX_DA_NAME_LEN	)
48 	),
49 
50 	TP_fast_assign(
51 		memcpy(__entry->state,		state,		MAX_DA_NAME_LEN);
52 		memcpy(__entry->event,		event,		MAX_DA_NAME_LEN);
53 	),
54 
55 	TP_printk("event %s not expected in the state %s",
56 		__entry->event,
57 		__entry->state)
58 );
59 
60 #include <monitors/wip/wip_trace.h>
61 #include <monitors/tss/tss_trace.h>
62 #include <monitors/sco/sco_trace.h>
63 #include <monitors/scpd/scpd_trace.h>
64 #include <monitors/snep/snep_trace.h>
65 #include <monitors/sncid/sncid_trace.h>
66 // Add new monitors based on CONFIG_DA_MON_EVENTS_IMPLICIT here
67 
68 #endif /* CONFIG_DA_MON_EVENTS_IMPLICIT */
69 
70 #ifdef CONFIG_DA_MON_EVENTS_ID
71 DECLARE_EVENT_CLASS(event_da_monitor_id,
72 
73 	TP_PROTO(int id, char *state, char *event, char *next_state, bool final_state),
74 
75 	TP_ARGS(id, state, event, next_state, final_state),
76 
77 	TP_STRUCT__entry(
78 		__field(	int,	id				)
79 		__array(	char,	state,		MAX_DA_NAME_LEN	)
80 		__array(	char,	event,		MAX_DA_NAME_LEN	)
81 		__array(	char,	next_state,	MAX_DA_NAME_LEN	)
82 		__field(	bool,	final_state			)
83 	),
84 
85 	TP_fast_assign(
86 		memcpy(__entry->state,		state,		MAX_DA_NAME_LEN);
87 		memcpy(__entry->event,		event,		MAX_DA_NAME_LEN);
88 		memcpy(__entry->next_state,	next_state,	MAX_DA_NAME_LEN);
89 		__entry->id			= id;
90 		__entry->final_state		= final_state;
91 	),
92 
93 	TP_printk("%d: %s x %s -> %s %s",
94 		__entry->id,
95 		__entry->state,
96 		__entry->event,
97 		__entry->next_state,
98 		__entry->final_state ? "(final)" : "")
99 );
100 
101 DECLARE_EVENT_CLASS(error_da_monitor_id,
102 
103 	TP_PROTO(int id, char *state, char *event),
104 
105 	TP_ARGS(id, state, event),
106 
107 	TP_STRUCT__entry(
108 		__field(	int,	id				)
109 		__array(	char,	state,		MAX_DA_NAME_LEN	)
110 		__array(	char,	event,		MAX_DA_NAME_LEN	)
111 	),
112 
113 	TP_fast_assign(
114 		memcpy(__entry->state,		state,		MAX_DA_NAME_LEN);
115 		memcpy(__entry->event,		event,		MAX_DA_NAME_LEN);
116 		__entry->id			= id;
117 	),
118 
119 	TP_printk("%d: event %s not expected in the state %s",
120 		__entry->id,
121 		__entry->event,
122 		__entry->state)
123 );
124 
125 #include <monitors/wwnr/wwnr_trace.h>
126 #include <monitors/snroc/snroc_trace.h>
127 // Add new monitors based on CONFIG_DA_MON_EVENTS_ID here
128 
129 #endif /* CONFIG_DA_MON_EVENTS_ID */
130 #endif /* _TRACE_RV_H */
131 
132 /* This part ust be outside protection */
133 #undef TRACE_INCLUDE_PATH
134 #define TRACE_INCLUDE_PATH .
135 #define TRACE_INCLUDE_FILE rv_trace
136 #include <trace/define_trace.h>
137