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 // Add new monitors based on CONFIG_DA_MON_EVENTS_IMPLICIT here
62 
63 #endif /* CONFIG_DA_MON_EVENTS_IMPLICIT */
64 
65 #ifdef CONFIG_DA_MON_EVENTS_ID
66 DECLARE_EVENT_CLASS(event_da_monitor_id,
67 
68 	TP_PROTO(int id, char *state, char *event, char *next_state, bool final_state),
69 
70 	TP_ARGS(id, state, event, next_state, final_state),
71 
72 	TP_STRUCT__entry(
73 		__field(	int,	id				)
74 		__array(	char,	state,		MAX_DA_NAME_LEN	)
75 		__array(	char,	event,		MAX_DA_NAME_LEN	)
76 		__array(	char,	next_state,	MAX_DA_NAME_LEN	)
77 		__field(	bool,	final_state			)
78 	),
79 
80 	TP_fast_assign(
81 		memcpy(__entry->state,		state,		MAX_DA_NAME_LEN);
82 		memcpy(__entry->event,		event,		MAX_DA_NAME_LEN);
83 		memcpy(__entry->next_state,	next_state,	MAX_DA_NAME_LEN);
84 		__entry->id			= id;
85 		__entry->final_state		= final_state;
86 	),
87 
88 	TP_printk("%d: %s x %s -> %s %s",
89 		__entry->id,
90 		__entry->state,
91 		__entry->event,
92 		__entry->next_state,
93 		__entry->final_state ? "(final)" : "")
94 );
95 
96 DECLARE_EVENT_CLASS(error_da_monitor_id,
97 
98 	TP_PROTO(int id, char *state, char *event),
99 
100 	TP_ARGS(id, state, event),
101 
102 	TP_STRUCT__entry(
103 		__field(	int,	id				)
104 		__array(	char,	state,		MAX_DA_NAME_LEN	)
105 		__array(	char,	event,		MAX_DA_NAME_LEN	)
106 	),
107 
108 	TP_fast_assign(
109 		memcpy(__entry->state,		state,		MAX_DA_NAME_LEN);
110 		memcpy(__entry->event,		event,		MAX_DA_NAME_LEN);
111 		__entry->id			= id;
112 	),
113 
114 	TP_printk("%d: event %s not expected in the state %s",
115 		__entry->id,
116 		__entry->event,
117 		__entry->state)
118 );
119 
120 #include <monitors/wwnr/wwnr_trace.h>
121 // Add new monitors based on CONFIG_DA_MON_EVENTS_ID here
122 
123 #endif /* CONFIG_DA_MON_EVENTS_ID */
124 #endif /* _TRACE_RV_H */
125 
126 /* This part ust be outside protection */
127 #undef TRACE_INCLUDE_PATH
128 #define TRACE_INCLUDE_PATH .
129 #define TRACE_INCLUDE_FILE rv_trace
130 #include <trace/define_trace.h>
131