xref: /linux/drivers/soc/qcom/qcom_pdr_msg.c (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (C) 2020 The Linux Foundation. All rights reserved.
4  */
5 
6 #include <linux/module.h>
7 #include <linux/soc/qcom/qmi.h>
8 
9 #include "pdr_internal.h"
10 
11 const struct qmi_elem_info servreg_location_entry_ei[] = {
12 	{
13 		.data_type      = QMI_STRING,
14 		.elem_len       = SERVREG_NAME_LENGTH + 1,
15 		.elem_size      = sizeof(char),
16 		.array_type	= NO_ARRAY,
17 		.tlv_type       = 0,
18 		.offset         = offsetof(struct servreg_location_entry,
19 					   name),
20 	},
21 	{
22 		.data_type      = QMI_UNSIGNED_4_BYTE,
23 		.elem_len       = 1,
24 		.elem_size      = sizeof(u32),
25 		.array_type	= NO_ARRAY,
26 		.tlv_type       = 0,
27 		.offset         = offsetof(struct servreg_location_entry,
28 					   instance),
29 	},
30 	{
31 		.data_type      = QMI_UNSIGNED_1_BYTE,
32 		.elem_len       = 1,
33 		.elem_size      = sizeof(u8),
34 		.array_type	= NO_ARRAY,
35 		.tlv_type       = 0,
36 		.offset         = offsetof(struct servreg_location_entry,
37 					   service_data_valid),
38 	},
39 	{
40 		.data_type      = QMI_UNSIGNED_4_BYTE,
41 		.elem_len       = 1,
42 		.elem_size      = sizeof(u32),
43 		.array_type	= NO_ARRAY,
44 		.tlv_type       = 0,
45 		.offset         = offsetof(struct servreg_location_entry,
46 					   service_data),
47 	},
48 	{}
49 };
50 EXPORT_SYMBOL_GPL(servreg_location_entry_ei);
51 
52 const struct qmi_elem_info servreg_get_domain_list_req_ei[] = {
53 	{
54 		.data_type      = QMI_STRING,
55 		.elem_len       = SERVREG_NAME_LENGTH + 1,
56 		.elem_size      = sizeof(char),
57 		.array_type	= NO_ARRAY,
58 		.tlv_type       = 0x01,
59 		.offset         = offsetof(struct servreg_get_domain_list_req,
60 					   service_name),
61 	},
62 	{
63 		.data_type      = QMI_OPT_FLAG,
64 		.elem_len       = 1,
65 		.elem_size      = sizeof(u8),
66 		.array_type	= NO_ARRAY,
67 		.tlv_type       = 0x10,
68 		.offset         = offsetof(struct servreg_get_domain_list_req,
69 					   domain_offset_valid),
70 	},
71 	{
72 		.data_type      = QMI_UNSIGNED_4_BYTE,
73 		.elem_len       = 1,
74 		.elem_size      = sizeof(u32),
75 		.array_type	= NO_ARRAY,
76 		.tlv_type       = 0x10,
77 		.offset         = offsetof(struct servreg_get_domain_list_req,
78 					   domain_offset),
79 	},
80 	{}
81 };
82 EXPORT_SYMBOL_GPL(servreg_get_domain_list_req_ei);
83 
84 const struct qmi_elem_info servreg_get_domain_list_resp_ei[] = {
85 	{
86 		.data_type      = QMI_STRUCT,
87 		.elem_len       = 1,
88 		.elem_size      = sizeof(struct qmi_response_type_v01),
89 		.array_type	= NO_ARRAY,
90 		.tlv_type       = 0x02,
91 		.offset         = offsetof(struct servreg_get_domain_list_resp,
92 					   resp),
93 		.ei_array      = qmi_response_type_v01_ei,
94 	},
95 	{
96 		.data_type      = QMI_OPT_FLAG,
97 		.elem_len       = 1,
98 		.elem_size      = sizeof(u8),
99 		.array_type	= NO_ARRAY,
100 		.tlv_type       = 0x10,
101 		.offset         = offsetof(struct servreg_get_domain_list_resp,
102 					   total_domains_valid),
103 	},
104 	{
105 		.data_type      = QMI_UNSIGNED_2_BYTE,
106 		.elem_len       = 1,
107 		.elem_size      = sizeof(u16),
108 		.array_type	= NO_ARRAY,
109 		.tlv_type       = 0x10,
110 		.offset         = offsetof(struct servreg_get_domain_list_resp,
111 					   total_domains),
112 	},
113 	{
114 		.data_type      = QMI_OPT_FLAG,
115 		.elem_len       = 1,
116 		.elem_size      = sizeof(u8),
117 		.array_type	= NO_ARRAY,
118 		.tlv_type       = 0x11,
119 		.offset         = offsetof(struct servreg_get_domain_list_resp,
120 					   db_rev_count_valid),
121 	},
122 	{
123 		.data_type      = QMI_UNSIGNED_2_BYTE,
124 		.elem_len       = 1,
125 		.elem_size      = sizeof(u16),
126 		.array_type	= NO_ARRAY,
127 		.tlv_type       = 0x11,
128 		.offset         = offsetof(struct servreg_get_domain_list_resp,
129 					   db_rev_count),
130 	},
131 	{
132 		.data_type      = QMI_OPT_FLAG,
133 		.elem_len       = 1,
134 		.elem_size      = sizeof(u8),
135 		.array_type	= NO_ARRAY,
136 		.tlv_type       = 0x12,
137 		.offset         = offsetof(struct servreg_get_domain_list_resp,
138 					   domain_list_valid),
139 	},
140 	{
141 		.data_type      = QMI_DATA_LEN,
142 		.elem_len       = 1,
143 		.elem_size      = sizeof(u8),
144 		.array_type	= NO_ARRAY,
145 		.tlv_type       = 0x12,
146 		.offset         = offsetof(struct servreg_get_domain_list_resp,
147 					   domain_list_len),
148 	},
149 	{
150 		.data_type      = QMI_STRUCT,
151 		.elem_len       = SERVREG_DOMAIN_LIST_LENGTH,
152 		.elem_size      = sizeof(struct servreg_location_entry),
153 		.array_type	= VAR_LEN_ARRAY,
154 		.tlv_type       = 0x12,
155 		.offset         = offsetof(struct servreg_get_domain_list_resp,
156 					   domain_list),
157 		.ei_array      = servreg_location_entry_ei,
158 	},
159 	{}
160 };
161 EXPORT_SYMBOL_GPL(servreg_get_domain_list_resp_ei);
162 
163 const struct qmi_elem_info servreg_register_listener_req_ei[] = {
164 	{
165 		.data_type      = QMI_UNSIGNED_1_BYTE,
166 		.elem_len       = 1,
167 		.elem_size      = sizeof(u8),
168 		.array_type	= NO_ARRAY,
169 		.tlv_type       = 0x01,
170 		.offset         = offsetof(struct servreg_register_listener_req,
171 					   enable),
172 	},
173 	{
174 		.data_type      = QMI_STRING,
175 		.elem_len       = SERVREG_NAME_LENGTH + 1,
176 		.elem_size      = sizeof(char),
177 		.array_type	= NO_ARRAY,
178 		.tlv_type       = 0x02,
179 		.offset         = offsetof(struct servreg_register_listener_req,
180 					   service_path),
181 	},
182 	{}
183 };
184 EXPORT_SYMBOL_GPL(servreg_register_listener_req_ei);
185 
186 const struct qmi_elem_info servreg_register_listener_resp_ei[] = {
187 	{
188 		.data_type      = QMI_STRUCT,
189 		.elem_len       = 1,
190 		.elem_size      = sizeof(struct qmi_response_type_v01),
191 		.array_type	= NO_ARRAY,
192 		.tlv_type       = 0x02,
193 		.offset         = offsetof(struct servreg_register_listener_resp,
194 					   resp),
195 		.ei_array      = qmi_response_type_v01_ei,
196 	},
197 	{
198 		.data_type      = QMI_OPT_FLAG,
199 		.elem_len       = 1,
200 		.elem_size      = sizeof(u8),
201 		.array_type	= NO_ARRAY,
202 		.tlv_type       = 0x10,
203 		.offset         = offsetof(struct servreg_register_listener_resp,
204 					   curr_state_valid),
205 	},
206 	{
207 		.data_type      = QMI_SIGNED_4_BYTE_ENUM,
208 		.elem_len       = 1,
209 		.elem_size      = sizeof(enum servreg_service_state),
210 		.array_type	= NO_ARRAY,
211 		.tlv_type       = 0x10,
212 		.offset         = offsetof(struct servreg_register_listener_resp,
213 					   curr_state),
214 	},
215 	{}
216 };
217 EXPORT_SYMBOL_GPL(servreg_register_listener_resp_ei);
218 
219 const struct qmi_elem_info servreg_restart_pd_req_ei[] = {
220 	{
221 		.data_type      = QMI_STRING,
222 		.elem_len       = SERVREG_NAME_LENGTH + 1,
223 		.elem_size      = sizeof(char),
224 		.array_type	= NO_ARRAY,
225 		.tlv_type       = 0x01,
226 		.offset         = offsetof(struct servreg_restart_pd_req,
227 					   service_path),
228 	},
229 	{}
230 };
231 EXPORT_SYMBOL_GPL(servreg_restart_pd_req_ei);
232 
233 const struct qmi_elem_info servreg_restart_pd_resp_ei[] = {
234 	{
235 		.data_type      = QMI_STRUCT,
236 		.elem_len       = 1,
237 		.elem_size      = sizeof(struct qmi_response_type_v01),
238 		.array_type	= NO_ARRAY,
239 		.tlv_type       = 0x02,
240 		.offset         = offsetof(struct servreg_restart_pd_resp,
241 					   resp),
242 		.ei_array      = qmi_response_type_v01_ei,
243 	},
244 	{}
245 };
246 EXPORT_SYMBOL_GPL(servreg_restart_pd_resp_ei);
247 
248 const struct qmi_elem_info servreg_state_updated_ind_ei[] = {
249 	{
250 		.data_type      = QMI_SIGNED_4_BYTE_ENUM,
251 		.elem_len       = 1,
252 		.elem_size      = sizeof(u32),
253 		.array_type	= NO_ARRAY,
254 		.tlv_type       = 0x01,
255 		.offset         = offsetof(struct servreg_state_updated_ind,
256 					   curr_state),
257 	},
258 	{
259 		.data_type      = QMI_STRING,
260 		.elem_len       = SERVREG_NAME_LENGTH + 1,
261 		.elem_size      = sizeof(char),
262 		.array_type	= NO_ARRAY,
263 		.tlv_type       = 0x02,
264 		.offset         = offsetof(struct servreg_state_updated_ind,
265 					   service_path),
266 	},
267 	{
268 		.data_type      = QMI_UNSIGNED_2_BYTE,
269 		.elem_len       = 1,
270 		.elem_size      = sizeof(u16),
271 		.array_type	= NO_ARRAY,
272 		.tlv_type       = 0x03,
273 		.offset         = offsetof(struct servreg_state_updated_ind,
274 					   transaction_id),
275 	},
276 	{}
277 };
278 EXPORT_SYMBOL_GPL(servreg_state_updated_ind_ei);
279 
280 const struct qmi_elem_info servreg_set_ack_req_ei[] = {
281 	{
282 		.data_type      = QMI_STRING,
283 		.elem_len       = SERVREG_NAME_LENGTH + 1,
284 		.elem_size      = sizeof(char),
285 		.array_type	= NO_ARRAY,
286 		.tlv_type       = 0x01,
287 		.offset         = offsetof(struct servreg_set_ack_req,
288 					   service_path),
289 	},
290 	{
291 		.data_type      = QMI_UNSIGNED_2_BYTE,
292 		.elem_len       = 1,
293 		.elem_size      = sizeof(u16),
294 		.array_type	= NO_ARRAY,
295 		.tlv_type       = 0x02,
296 		.offset         = offsetof(struct servreg_set_ack_req,
297 					   transaction_id),
298 	},
299 	{}
300 };
301 EXPORT_SYMBOL_GPL(servreg_set_ack_req_ei);
302 
303 const struct qmi_elem_info servreg_set_ack_resp_ei[] = {
304 	{
305 		.data_type      = QMI_STRUCT,
306 		.elem_len       = 1,
307 		.elem_size      = sizeof(struct qmi_response_type_v01),
308 		.array_type	= NO_ARRAY,
309 		.tlv_type       = 0x02,
310 		.offset         = offsetof(struct servreg_set_ack_resp,
311 					   resp),
312 		.ei_array       = qmi_response_type_v01_ei,
313 	},
314 	{}
315 };
316 EXPORT_SYMBOL_GPL(servreg_set_ack_resp_ei);
317 
318 const struct qmi_elem_info servreg_loc_pfr_req_ei[] = {
319 	{
320 		.data_type = QMI_STRING,
321 		.elem_len = SERVREG_NAME_LENGTH + 1,
322 		.elem_size = sizeof(char),
323 		.array_type = VAR_LEN_ARRAY,
324 		.tlv_type = 0x01,
325 		.offset = offsetof(struct servreg_loc_pfr_req, service)
326 	},
327 	{
328 		.data_type = QMI_STRING,
329 		.elem_len = SERVREG_NAME_LENGTH + 1,
330 		.elem_size = sizeof(char),
331 		.array_type = VAR_LEN_ARRAY,
332 		.tlv_type = 0x02,
333 		.offset = offsetof(struct servreg_loc_pfr_req, reason)
334 	},
335 	{}
336 };
337 EXPORT_SYMBOL_GPL(servreg_loc_pfr_req_ei);
338 
339 const struct qmi_elem_info servreg_loc_pfr_resp_ei[] = {
340 	{
341 		.data_type = QMI_STRUCT,
342 		.elem_len = 1,
343 		.elem_size = sizeof_field(struct servreg_loc_pfr_resp, rsp),
344 		.tlv_type = 0x02,
345 		.offset = offsetof(struct servreg_loc_pfr_resp, rsp),
346 		.ei_array = qmi_response_type_v01_ei,
347 	},
348 	{}
349 };
350 EXPORT_SYMBOL_GPL(servreg_loc_pfr_resp_ei);
351 
352 MODULE_LICENSE("GPL");
353 MODULE_DESCRIPTION("Qualcomm Protection Domain messages data");
354