xref: /OK3568_Linux_fs/kernel/drivers/gpu/arm/bifrost/mali_kbase_mipe_gen_header.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  *
4  * (C) COPYRIGHT 2010-2021 ARM Limited. All rights reserved.
5  *
6  * This program is free software and is provided to you under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation, and any use by you of this program is subject to the terms
9  * of such GNU license.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you can access it online at
18  * http://www.gnu.org/licenses/gpl-2.0.html.
19  *
20  */
21 
22 /* THIS FILE IS AUTOGENERATED BY mali_trace_generator.py.
23  * DO NOT EDIT.
24  */
25 
26 /* clang-format off */
27 
28 #include "mali_kbase_mipe_proto.h"
29 
30 /*
31  * This header generates MIPE tracepoint declaration BLOB at
32  * compile time.
33  *
34  * It is intentional that there is no header guard.
35  * The header could be included multiple times for
36  * different blobs compilation.
37  *
38  * Before including this header MIPE_HEADER_* parameters must be
39  * defined. See documentation below:
40  */
41 
42 /*
43  * The name of the variable where the result BLOB will be stored.
44  */
45 #if !defined(MIPE_HEADER_BLOB_VAR_NAME)
46 #error "MIPE_HEADER_BLOB_VAR_NAME must be defined!"
47 #endif
48 
49 /*
50  * A compiler attribute for the BLOB variable.
51  *
52  * e.g. __attribute__((section("my_section")))
53  *
54  * Default value is no attribute.
55  */
56 #if !defined(MIPE_HEADER_BLOB_VAR_ATTRIBUTE)
57 #define MIPE_HEADER_BLOB_VAR_ATTRIBUTE
58 #endif
59 
60 /*
61  * A compiler attribute for packing structures
62  *
63  * e.g. __packed
64  *
65  * Default value is __attribute__((__packed__))
66  */
67 #if !defined(MIPE_HEADER_PACKED_ATTRIBUTE)
68 #define MIPE_HEADER_PACKED_ATTRIBUTE __attribute__((__packed__))
69 #endif
70 
71 /*
72  * MIPE stream id.
73  *
74  * See enum tl_stream_id.
75  */
76 #if !defined(MIPE_HEADER_STREAM_ID)
77 #error "MIPE_HEADER_STREAM_ID must be defined!"
78 #endif
79 
80 /*
81  * MIPE packet class.
82  *
83  * See enum tl_packet_class.
84  */
85 #if !defined(MIPE_HEADER_PKT_CLASS)
86 #error "MIPE_HEADER_PKT_CLASS must be defined!"
87 #endif
88 
89 /*
90  * The list of tracepoints to process.
91  *
92  * It should be defined as follows:
93  *
94  * #define MIPE_HEADER_TRACEPOINT_LIST \
95  *     TRACEPOINT_DESC(FIRST_TRACEPOINT, "Some description", "@II", "first_arg,second_arg") \
96  *     TRACEPOINT_DESC(SECOND_TRACEPOINT, "Some description", "@II", "first_arg,second_arg") \
97  *     etc.
98  *
99  * Where the first argument is tracepoints name, the second
100  * argument is a short tracepoint description, the third argument
101  * types (see MIPE documentation), and the fourth argument
102  * is comma separated argument names.
103  */
104 #if !defined(MIPE_HEADER_TRACEPOINT_LIST)
105 #error "MIPE_HEADER_TRACEPOINT_LIST must be defined!"
106 #endif
107 
108 /*
109  * The number of entries in MIPE_HEADER_TRACEPOINT_LIST.
110  */
111 #if !defined(MIPE_HEADER_TRACEPOINT_LIST_SIZE)
112 #error "MIPE_HEADER_TRACEPOINT_LIST_SIZE must be defined!"
113 #endif
114 
115 /*
116  * The list of enums to process.
117  *
118  * It should be defined as follows:
119  *
120  * #define MIPE_HEADER_ENUM_LIST \
121  *     ENUM_DESC(enum_arg_name, enum_value) \
122  *     ENUM_DESC(enum_arg_name, enum_value) \
123  *     etc.
124  *
125  * Where enum_arg_name is the name of a tracepoint argument being used with
126  * this enum. enum_value is a valid C enum value.
127  *
128  * Default value is an empty list.
129  */
130 #if defined(MIPE_HEADER_ENUM_LIST)
131 
132 /*
133  * Tracepoint message ID used for enums declaration.
134  */
135 #if !defined(MIPE_HEADER_ENUM_MSG_ID)
136 #error "MIPE_HEADER_ENUM_MSG_ID must be defined!"
137 #endif
138 
139 #else
140 #define MIPE_HEADER_ENUM_LIST
141 #endif
142 
143 /*
144  * The MIPE tracepoint declaration BLOB.
145  */
146 const struct
147 {
148 	u32 _mipe_w0;
149 	u32 _mipe_w1;
150 	u8  _protocol_version;
151 	u8  _pointer_size;
152 	u32 _tp_count;
153 #define TRACEPOINT_DESC(name, desc, arg_types, arg_names)	\
154 	struct {					\
155 		u32  _name;				\
156 		u32  _size_string_name;		\
157 		char _string_name[sizeof(#name)];	\
158 		u32  _size_desc;			\
159 		char _desc[sizeof(desc)];		\
160 		u32  _size_arg_types;		\
161 		char _arg_types[sizeof(arg_types)];	\
162 		u32  _size_arg_names;		\
163 		char _arg_names[sizeof(arg_names)];	\
164 	} MIPE_HEADER_PACKED_ATTRIBUTE __ ## name;
165 
166 #define ENUM_DESC(arg_name, value)					\
167 	struct {							\
168 		u32 _msg_id;					\
169 		u32 _arg_name_len;					\
170 		char _arg_name[sizeof(#arg_name)];			\
171 		u32 _value;						\
172 		u32 _value_str_len;					\
173 		char _value_str[sizeof(#value)];			\
174 	} MIPE_HEADER_PACKED_ATTRIBUTE __ ## arg_name ## _ ## value;
175 
176 	MIPE_HEADER_TRACEPOINT_LIST
177 	MIPE_HEADER_ENUM_LIST
178 #undef TRACEPOINT_DESC
179 #undef ENUM_DESC
180 } MIPE_HEADER_PACKED_ATTRIBUTE MIPE_HEADER_BLOB_VAR_NAME MIPE_HEADER_BLOB_VAR_ATTRIBUTE = {
181 	._mipe_w0 = MIPE_PACKET_HEADER_W0(
182 		TL_PACKET_FAMILY_TL,
183 		MIPE_HEADER_PKT_CLASS,
184 		TL_PACKET_TYPE_HEADER,
185 		MIPE_HEADER_STREAM_ID),
186 	._mipe_w1 = MIPE_PACKET_HEADER_W1(
187 		sizeof(MIPE_HEADER_BLOB_VAR_NAME) - PACKET_HEADER_SIZE,
188 		0),
189 	._protocol_version = SWTRACE_VERSION,
190 	._pointer_size = sizeof(void *),
191 	._tp_count = MIPE_HEADER_TRACEPOINT_LIST_SIZE,
192 #define TRACEPOINT_DESC(name, desc, arg_types, arg_names)	\
193 	.__ ## name = {					\
194 		._name = name,				\
195 		._size_string_name = sizeof(#name),	\
196 		._string_name = #name,			\
197 		._size_desc = sizeof(desc),		\
198 		._desc = desc,				\
199 		._size_arg_types = sizeof(arg_types),	\
200 		._arg_types = arg_types,		\
201 		._size_arg_names = sizeof(arg_names),	\
202 		._arg_names = arg_names			\
203 	},
204 #define ENUM_DESC(arg_name, value)				\
205 	.__ ## arg_name ## _ ## value = {			\
206 		._msg_id = MIPE_HEADER_ENUM_MSG_ID,		\
207 		._arg_name_len = sizeof(#arg_name),		\
208 		._arg_name = #arg_name,				\
209 		._value = value,				\
210 		._value_str_len = sizeof(#value),		\
211 		._value_str = #value				\
212 	},
213 
214 	MIPE_HEADER_TRACEPOINT_LIST
215 	MIPE_HEADER_ENUM_LIST
216 #undef TRACEPOINT_DESC
217 #undef ENUM_DESC
218 };
219 
220 #undef MIPE_HEADER_BLOB_VAR_NAME
221 #undef MIPE_HEADER_BLOB_VAR_ATTRIBUTE
222 #undef MIPE_HEADER_STREAM_ID
223 #undef MIPE_HEADER_PKT_CLASS
224 #undef MIPE_HEADER_TRACEPOINT_LIST
225 #undef MIPE_HEADER_TRACEPOINT_LIST_SIZE
226 #undef MIPE_HEADER_ENUM_LIST
227 #undef MIPE_HEADER_ENUM_MSG_ID
228 
229 /* clang-format on */
230