Branch data Line data Source code
1 : : /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
2 : : *
3 : : * Copyright 2013-2016 Freescale Semiconductor Inc.
4 : : * Copyright 2016-2023 NXP
5 : : *
6 : : */
7 : : #include <fsl_mc_sys.h>
8 : : #include <fsl_mc_cmd.h>
9 : : #include <fsl_dpio.h>
10 : : #include <fsl_dpio_cmd.h>
11 : :
12 : : #include <eal_export.h>
13 : :
14 : : /**
15 : : * dpio_open() - Open a control session for the specified object
16 : : * @mc_io: Pointer to MC portal's I/O object
17 : : * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
18 : : * @dpio_id: DPIO unique ID
19 : : * @token: Returned token; use in subsequent API calls
20 : : *
21 : : * This function can be used to open a control session for an
22 : : * already created object; an object may have been declared in
23 : : * the DPL or by calling the dpio_create() function.
24 : : * This function returns a unique authentication token,
25 : : * associated with the specific object ID and any MC portals
26 : : * assigned to the parent container; this token must be used in
27 : : * all subsequent commands for this specific object.
28 : : *
29 : : * Return: '0' on Success; Error code otherwise.
30 : : */
31 : : RTE_EXPORT_INTERNAL_SYMBOL(dpio_open)
32 : 0 : int dpio_open(struct fsl_mc_io *mc_io,
33 : : uint32_t cmd_flags,
34 : : int dpio_id,
35 : : uint16_t *token)
36 : : {
37 : : struct dpio_cmd_open *cmd_params;
38 : 0 : struct mc_command cmd = { 0 };
39 : : int err;
40 : :
41 : : /* prepare command */
42 : 0 : cmd.header = mc_encode_cmd_header(DPIO_CMDID_OPEN,
43 : : cmd_flags,
44 : : 0);
45 : : cmd_params = (struct dpio_cmd_open *)cmd.params;
46 : 0 : cmd_params->dpio_id = cpu_to_le32(dpio_id);
47 : :
48 : : /* send command to mc*/
49 : 0 : err = mc_send_command(mc_io, &cmd);
50 [ # # ]: 0 : if (err)
51 : : return err;
52 : :
53 : : /* retrieve response parameters */
54 : 0 : *token = mc_cmd_hdr_read_token(&cmd);
55 : :
56 : 0 : return 0;
57 : : }
58 : :
59 : : /**
60 : : * dpio_close() - Close the control session of the object
61 : : * @mc_io: Pointer to MC portal's I/O object
62 : : * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
63 : : * @token: Token of DPIO object
64 : : *
65 : : * Return: '0' on Success; Error code otherwise.
66 : : */
67 : : RTE_EXPORT_INTERNAL_SYMBOL(dpio_close)
68 : 0 : int dpio_close(struct fsl_mc_io *mc_io,
69 : : uint32_t cmd_flags,
70 : : uint16_t token)
71 : : {
72 : 0 : struct mc_command cmd = { 0 };
73 : :
74 : : /* prepare command */
75 : 0 : cmd.header = mc_encode_cmd_header(DPIO_CMDID_CLOSE,
76 : : cmd_flags,
77 : : token);
78 : :
79 : : /* send command to mc*/
80 : 0 : return mc_send_command(mc_io, &cmd);
81 : : }
82 : :
83 : : /**
84 : : * dpio_create() - Create the DPIO object.
85 : : * @mc_io: Pointer to MC portal's I/O object
86 : : * @dprc_token: Parent container token; '0' for default container
87 : : * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
88 : : * @cfg: Configuration structure
89 : : * @obj_id: Returned object id
90 : : *
91 : : * Create the DPIO object, allocate required resources and
92 : : * perform required initialization.
93 : : *
94 : : * The object can be created either by declaring it in the
95 : : * DPL file, or by calling this function.
96 : : *
97 : : * The function accepts an authentication token of a parent
98 : : * container that this object should be assigned to. The token
99 : : * can be '0' so the object will be assigned to the default container.
100 : : * The newly created object can be opened with the returned
101 : : * object id and using the container's associated tokens and MC portals.
102 : : *
103 : : * Return: '0' on Success; Error code otherwise.
104 : : */
105 : 0 : int dpio_create(struct fsl_mc_io *mc_io,
106 : : uint16_t dprc_token,
107 : : uint32_t cmd_flags,
108 : : const struct dpio_cfg *cfg,
109 : : uint32_t *obj_id)
110 : : {
111 : : struct dpio_cmd_create *cmd_params;
112 : 0 : struct mc_command cmd = { 0 };
113 : : int err;
114 : :
115 : : /* prepare command */
116 : 0 : cmd.header = mc_encode_cmd_header(DPIO_CMDID_CREATE,
117 : : cmd_flags,
118 : : dprc_token);
119 : : cmd_params = (struct dpio_cmd_create *)cmd.params;
120 : 0 : cmd_params->num_priorities = cfg->num_priorities;
121 : 0 : dpio_set_field(cmd_params->channel_mode,
122 : : CHANNEL_MODE,
123 : : cfg->channel_mode);
124 : :
125 : : /* send command to mc*/
126 : 0 : err = mc_send_command(mc_io, &cmd);
127 [ # # ]: 0 : if (err)
128 : : return err;
129 : :
130 : : /* retrieve response parameters */
131 : 0 : *obj_id = mc_cmd_read_object_id(&cmd);
132 : :
133 : 0 : return 0;
134 : : }
135 : :
136 : : /**
137 : : * dpio_destroy() - Destroy the DPIO object and release all its resources.
138 : : * @mc_io: Pointer to MC portal's I/O object
139 : : * @dprc_token: Parent container token; '0' for default container
140 : : * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
141 : : * @object_id: The object id; it must be a valid id within the container that
142 : : * created this object;
143 : : *
144 : : * The function accepts the authentication token of the parent container that
145 : : * created the object (not the one that currently owns the object). The object
146 : : * is searched within parent using the provided 'object_id'.
147 : : * All tokens to the object must be closed before calling destroy.
148 : : *
149 : : * Return: '0' on Success; Error code otherwise
150 : : */
151 : 0 : int dpio_destroy(struct fsl_mc_io *mc_io,
152 : : uint16_t dprc_token,
153 : : uint32_t cmd_flags,
154 : : uint32_t object_id)
155 : : {
156 : : struct dpio_cmd_destroy *cmd_params;
157 : 0 : struct mc_command cmd = { 0 };
158 : :
159 : : /* prepare command */
160 : 0 : cmd.header = mc_encode_cmd_header(DPIO_CMDID_DESTROY,
161 : : cmd_flags,
162 : : dprc_token);
163 : :
164 : : /* set object id to destroy */
165 : : cmd_params = (struct dpio_cmd_destroy *)cmd.params;
166 : 0 : cmd_params->dpio_id = cpu_to_le32(object_id);
167 : :
168 : : /* send command to mc*/
169 : 0 : return mc_send_command(mc_io, &cmd);
170 : : }
171 : :
172 : : /**
173 : : * dpio_enable() - Enable the DPIO, allow I/O portal operations.
174 : : * @mc_io: Pointer to MC portal's I/O object
175 : : * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
176 : : * @token: Token of DPIO object
177 : : *
178 : : * Return: '0' on Success; Error code otherwise
179 : : */
180 : : RTE_EXPORT_INTERNAL_SYMBOL(dpio_enable)
181 : 0 : int dpio_enable(struct fsl_mc_io *mc_io,
182 : : uint32_t cmd_flags,
183 : : uint16_t token)
184 : : {
185 : 0 : struct mc_command cmd = { 0 };
186 : :
187 : : /* prepare command */
188 : 0 : cmd.header = mc_encode_cmd_header(DPIO_CMDID_ENABLE,
189 : : cmd_flags,
190 : : token);
191 : :
192 : : /* send command to mc*/
193 : 0 : return mc_send_command(mc_io, &cmd);
194 : : }
195 : :
196 : : /**
197 : : * dpio_disable() - Disable the DPIO, stop any I/O portal operation.
198 : : * @mc_io: Pointer to MC portal's I/O object
199 : : * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
200 : : * @token: Token of DPIO object
201 : : *
202 : : * Return: '0' on Success; Error code otherwise
203 : : */
204 : : RTE_EXPORT_INTERNAL_SYMBOL(dpio_disable)
205 : 0 : int dpio_disable(struct fsl_mc_io *mc_io,
206 : : uint32_t cmd_flags,
207 : : uint16_t token)
208 : : {
209 : 0 : struct mc_command cmd = { 0 };
210 : :
211 : : /* prepare command */
212 : 0 : cmd.header = mc_encode_cmd_header(DPIO_CMDID_DISABLE,
213 : : cmd_flags,
214 : : token);
215 : :
216 : : /* send command to mc*/
217 : 0 : return mc_send_command(mc_io, &cmd);
218 : : }
219 : :
220 : : /**
221 : : * dpio_is_enabled() - Check if the DPIO is enabled.
222 : : * @mc_io: Pointer to MC portal's I/O object
223 : : * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
224 : : * @token: Token of DPIO object
225 : : * @en: Returns '1' if object is enabled; '0' otherwise
226 : : *
227 : : * Return: '0' on Success; Error code otherwise.
228 : : */
229 : 0 : int dpio_is_enabled(struct fsl_mc_io *mc_io,
230 : : uint32_t cmd_flags,
231 : : uint16_t token,
232 : : int *en)
233 : : {
234 : : struct dpio_rsp_is_enabled *rsp_params;
235 : 0 : struct mc_command cmd = { 0 };
236 : : int err;
237 : :
238 : : /* prepare command */
239 : 0 : cmd.header = mc_encode_cmd_header(DPIO_CMDID_IS_ENABLED, cmd_flags,
240 : : token);
241 : :
242 : : /* send command to mc*/
243 : 0 : err = mc_send_command(mc_io, &cmd);
244 [ # # ]: 0 : if (err)
245 : : return err;
246 : :
247 : : /* retrieve response parameters */
248 : : rsp_params = (struct dpio_rsp_is_enabled *)cmd.params;
249 : 0 : *en = dpio_get_field(rsp_params->en, ENABLE);
250 : :
251 : 0 : return 0;
252 : : }
253 : :
254 : : /**
255 : : * dpio_reset() - Reset the DPIO, returns the object to initial state.
256 : : * @mc_io: Pointer to MC portal's I/O object
257 : : * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
258 : : * @token: Token of DPIO object
259 : : *
260 : : * Return: '0' on Success; Error code otherwise.
261 : : */
262 : : RTE_EXPORT_INTERNAL_SYMBOL(dpio_reset)
263 : 0 : int dpio_reset(struct fsl_mc_io *mc_io,
264 : : uint32_t cmd_flags,
265 : : uint16_t token)
266 : : {
267 : 0 : struct mc_command cmd = { 0 };
268 : :
269 : : /* prepare command */
270 : 0 : cmd.header = mc_encode_cmd_header(DPIO_CMDID_RESET,
271 : : cmd_flags,
272 : : token);
273 : :
274 : : /* send command to mc*/
275 : 0 : return mc_send_command(mc_io, &cmd);
276 : : }
277 : :
278 : : /**
279 : : * dpio_get_attributes() - Retrieve DPIO attributes
280 : : * @mc_io: Pointer to MC portal's I/O object
281 : : * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
282 : : * @token: Token of DPIO object
283 : : * @attr: Returned object's attributes
284 : : *
285 : : * Return: '0' on Success; Error code otherwise
286 : : */
287 : : RTE_EXPORT_INTERNAL_SYMBOL(dpio_get_attributes)
288 : 0 : int dpio_get_attributes(struct fsl_mc_io *mc_io,
289 : : uint32_t cmd_flags,
290 : : uint16_t token,
291 : : struct dpio_attr *attr)
292 : : {
293 : : struct dpio_rsp_get_attr *rsp_params;
294 : 0 : struct mc_command cmd = { 0 };
295 : : int err;
296 : :
297 : : /* prepare command */
298 : 0 : cmd.header = mc_encode_cmd_header(DPIO_CMDID_GET_ATTR,
299 : : cmd_flags,
300 : : token);
301 : :
302 : : /* send command to mc*/
303 : 0 : err = mc_send_command(mc_io, &cmd);
304 [ # # ]: 0 : if (err)
305 : : return err;
306 : :
307 : : /* retrieve response parameters */
308 : : rsp_params = (struct dpio_rsp_get_attr *)cmd.params;
309 : 0 : attr->id = le32_to_cpu(rsp_params->id);
310 : 0 : attr->qbman_portal_id = le16_to_cpu(rsp_params->qbman_portal_id);
311 : 0 : attr->num_priorities = rsp_params->num_priorities;
312 : 0 : attr->qbman_portal_ce_offset =
313 : 0 : le64_to_cpu(rsp_params->qbman_portal_ce_offset);
314 : 0 : attr->qbman_portal_ci_offset =
315 : 0 : le64_to_cpu(rsp_params->qbman_portal_ci_offset);
316 : 0 : attr->qbman_version = le32_to_cpu(rsp_params->qbman_version);
317 : 0 : attr->clk = le32_to_cpu(rsp_params->clk);
318 : 0 : attr->channel_mode = dpio_get_field(rsp_params->channel_mode,
319 : : ATTR_CHANNEL_MODE);
320 : :
321 : 0 : return 0;
322 : : }
323 : :
324 : : /**
325 : : * dpio_set_stashing_destination() - Set the stashing destination.
326 : : * @mc_io: Pointer to MC portal's I/O object
327 : : * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
328 : : * @token: Token of DPIO object
329 : : * @sdest: Stashing destination value
330 : : *
331 : : * Return: '0' on Success; Error code otherwise.
332 : : */
333 : : RTE_EXPORT_INTERNAL_SYMBOL(dpio_set_stashing_destination)
334 : 0 : int dpio_set_stashing_destination(struct fsl_mc_io *mc_io,
335 : : uint32_t cmd_flags,
336 : : uint16_t token,
337 : : uint8_t sdest)
338 : : {
339 : : struct dpio_stashing_dest *cmd_params;
340 : 0 : struct mc_command cmd = { 0 };
341 : :
342 : : /* prepare command */
343 : 0 : cmd.header = mc_encode_cmd_header(DPIO_CMDID_SET_STASHING_DEST,
344 : : cmd_flags,
345 : : token);
346 : : cmd_params = (struct dpio_stashing_dest *)cmd.params;
347 : 0 : cmd_params->sdest = sdest;
348 : :
349 : : /* send command to mc*/
350 : 0 : return mc_send_command(mc_io, &cmd);
351 : : }
352 : :
353 : : /**
354 : : * dpio_get_stashing_destination() - Get the stashing destination..
355 : : * @mc_io: Pointer to MC portal's I/O object
356 : : * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
357 : : * @token: Token of DPIO object
358 : : * @sdest: Returns the stashing destination value
359 : : *
360 : : * Return: '0' on Success; Error code otherwise.
361 : : */
362 : : RTE_EXPORT_INTERNAL_SYMBOL(dpio_get_stashing_destination)
363 : 0 : int dpio_get_stashing_destination(struct fsl_mc_io *mc_io,
364 : : uint32_t cmd_flags,
365 : : uint16_t token,
366 : : uint8_t *sdest)
367 : : {
368 : : struct dpio_stashing_dest *rsp_params;
369 : 0 : struct mc_command cmd = { 0 };
370 : : int err;
371 : :
372 : : /* prepare command */
373 : 0 : cmd.header = mc_encode_cmd_header(DPIO_CMDID_GET_STASHING_DEST,
374 : : cmd_flags,
375 : : token);
376 : :
377 : : /* send command to mc*/
378 : 0 : err = mc_send_command(mc_io, &cmd);
379 [ # # ]: 0 : if (err)
380 : : return err;
381 : :
382 : : /* retrieve response parameters */
383 : : rsp_params = (struct dpio_stashing_dest *)cmd.params;
384 : 0 : *sdest = rsp_params->sdest;
385 : :
386 : 0 : return 0;
387 : : }
388 : :
389 : : /**
390 : : * dpio_set_stashing_destination_by_core_id() - Set the stashing destination source
391 : : * using the core id.
392 : : * @mc_io: Pointer to MC portal's I/O object
393 : : * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
394 : : * @token: Token of DPIO object
395 : : * @core_id: Core id stashing destination
396 : : *
397 : : * Return: '0' on Success; Error code otherwise.
398 : : */
399 : : RTE_EXPORT_INTERNAL_SYMBOL(dpio_set_stashing_destination_by_core_id)
400 : 0 : int dpio_set_stashing_destination_by_core_id(struct fsl_mc_io *mc_io,
401 : : uint32_t cmd_flags,
402 : : uint16_t token,
403 : : uint8_t core_id)
404 : : {
405 : : struct dpio_stashing_dest_by_core_id *cmd_params;
406 : 0 : struct mc_command cmd = { 0 };
407 : :
408 : : /* prepare command */
409 : 0 : cmd.header = mc_encode_cmd_header(DPIO_CMDID_SET_STASHING_DEST_BY_CORE_ID,
410 : : cmd_flags,
411 : : token);
412 : : cmd_params = (struct dpio_stashing_dest_by_core_id *)cmd.params;
413 : 0 : cmd_params->core_id = core_id;
414 : :
415 : : /* send command to mc*/
416 : 0 : return mc_send_command(mc_io, &cmd);
417 : : }
418 : :
419 : : /**
420 : : * dpio_set_stashing_destination_source() - Set the stashing destination source.
421 : : * @mc_io: Pointer to MC portal's I/O object
422 : : * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
423 : : * @token: Token of DPIO object
424 : : * @ss: Stashing destination source (0 manual/1 automatic)
425 : : *
426 : : * Return: '0' on Success; Error code otherwise.
427 : : */
428 : : RTE_EXPORT_INTERNAL_SYMBOL(dpio_set_stashing_destination_source)
429 : 0 : int dpio_set_stashing_destination_source(struct fsl_mc_io *mc_io,
430 : : uint32_t cmd_flags,
431 : : uint16_t token,
432 : : uint8_t ss)
433 : : {
434 : : struct dpio_stashing_dest_source *cmd_params;
435 : 0 : struct mc_command cmd = { 0 };
436 : :
437 : : /* prepare command */
438 : 0 : cmd.header = mc_encode_cmd_header(DPIO_CMDID_SET_STASHING_DEST_SOURCE,
439 : : cmd_flags,
440 : : token);
441 : : cmd_params = (struct dpio_stashing_dest_source *)cmd.params;
442 : 0 : cmd_params->ss = ss;
443 : :
444 : : /* send command to mc*/
445 : 0 : return mc_send_command(mc_io, &cmd);
446 : : }
447 : :
448 : : /**
449 : : * dpio_get_stashing_destination_source() - Get the stashing destination source.
450 : : * @mc_io: Pointer to MC portal's I/O object
451 : : * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
452 : : * @token: Token of DPIO object
453 : : * @ss: Returns the stashing destination source (0 manual/1 automatic)
454 : : *
455 : : * Return: '0' on Success; Error code otherwise.
456 : : */
457 : : RTE_EXPORT_INTERNAL_SYMBOL(dpio_get_stashing_destination_source)
458 : 0 : int dpio_get_stashing_destination_source(struct fsl_mc_io *mc_io,
459 : : uint32_t cmd_flags,
460 : : uint16_t token,
461 : : uint8_t *ss)
462 : : {
463 : : struct dpio_stashing_dest_source *rsp_params;
464 : 0 : struct mc_command cmd = { 0 };
465 : : int err;
466 : :
467 : : /* prepare command */
468 : 0 : cmd.header = mc_encode_cmd_header(DPIO_CMDID_GET_STASHING_DEST_SOURCE,
469 : : cmd_flags,
470 : : token);
471 : :
472 : : /* send command to mc*/
473 : 0 : err = mc_send_command(mc_io, &cmd);
474 [ # # ]: 0 : if (err)
475 : : return err;
476 : :
477 : : /* retrieve response parameters */
478 : : rsp_params = (struct dpio_stashing_dest_source *)cmd.params;
479 : 0 : *ss = rsp_params->ss;
480 : :
481 : 0 : return 0;
482 : : }
483 : :
484 : : /**
485 : : * dpio_add_static_dequeue_channel() - Add a static dequeue channel.
486 : : * @mc_io: Pointer to MC portal's I/O object
487 : : * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
488 : : * @token: Token of DPIO object
489 : : * @dpcon_id: DPCON object ID
490 : : * @channel_index: Returned channel index to be used in qbman API
491 : : *
492 : : * Return: '0' on Success; Error code otherwise.
493 : : */
494 : : RTE_EXPORT_INTERNAL_SYMBOL(dpio_add_static_dequeue_channel)
495 : 0 : int dpio_add_static_dequeue_channel(struct fsl_mc_io *mc_io,
496 : : uint32_t cmd_flags,
497 : : uint16_t token,
498 : : int dpcon_id,
499 : : uint8_t *channel_index)
500 : : {
501 : : struct dpio_rsp_add_static_dequeue_channel *rsp_params;
502 : : struct dpio_cmd_static_dequeue_channel *cmd_params;
503 : 0 : struct mc_command cmd = { 0 };
504 : : int err;
505 : :
506 : : /* prepare command */
507 : 0 : cmd.header = mc_encode_cmd_header(DPIO_CMDID_ADD_STATIC_DEQUEUE_CHANNEL,
508 : : cmd_flags,
509 : : token);
510 : : cmd_params = (struct dpio_cmd_static_dequeue_channel *)cmd.params;
511 : 0 : cmd_params->dpcon_id = cpu_to_le32(dpcon_id);
512 : :
513 : : /* send command to mc*/
514 : 0 : err = mc_send_command(mc_io, &cmd);
515 [ # # ]: 0 : if (err)
516 : : return err;
517 : :
518 : : /* retrieve response parameters */
519 : : rsp_params = (struct dpio_rsp_add_static_dequeue_channel *)cmd.params;
520 : 0 : *channel_index = rsp_params->channel_index;
521 : :
522 : 0 : return 0;
523 : : }
524 : :
525 : : /**
526 : : * dpio_remove_static_dequeue_channel() - Remove a static dequeue channel.
527 : : * @mc_io: Pointer to MC portal's I/O object
528 : : * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
529 : : * @token: Token of DPIO object
530 : : * @dpcon_id: DPCON object ID
531 : : *
532 : : * Return: '0' on Success; Error code otherwise.
533 : : */
534 : : RTE_EXPORT_INTERNAL_SYMBOL(dpio_remove_static_dequeue_channel)
535 : 0 : int dpio_remove_static_dequeue_channel(struct fsl_mc_io *mc_io,
536 : : uint32_t cmd_flags,
537 : : uint16_t token,
538 : : int dpcon_id)
539 : : {
540 : : struct dpio_cmd_static_dequeue_channel *cmd_params;
541 : 0 : struct mc_command cmd = { 0 };
542 : :
543 : : /* prepare command */
544 : 0 : cmd.header = mc_encode_cmd_header(
545 : : DPIO_CMDID_REMOVE_STATIC_DEQUEUE_CHANNEL,
546 : : cmd_flags,
547 : : token);
548 : : cmd_params = (struct dpio_cmd_static_dequeue_channel *)cmd.params;
549 : 0 : cmd_params->dpcon_id = cpu_to_le32(dpcon_id);
550 : :
551 : : /* send command to mc*/
552 : 0 : return mc_send_command(mc_io, &cmd);
553 : : }
554 : :
555 : : /**
556 : : * dpio_get_api_version() - Get Data Path I/O API version
557 : : * @mc_io: Pointer to MC portal's I/O object
558 : : * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
559 : : * @major_ver: Major version of data path i/o API
560 : : * @minor_ver: Minor version of data path i/o API
561 : : *
562 : : * Return: '0' on Success; Error code otherwise.
563 : : */
564 : 0 : int dpio_get_api_version(struct fsl_mc_io *mc_io,
565 : : uint32_t cmd_flags,
566 : : uint16_t *major_ver,
567 : : uint16_t *minor_ver)
568 : : {
569 : : struct dpio_rsp_get_api_version *rsp_params;
570 : 0 : struct mc_command cmd = { 0 };
571 : : int err;
572 : :
573 : 0 : cmd.header = mc_encode_cmd_header(DPIO_CMDID_GET_API_VERSION,
574 : : cmd_flags,
575 : : 0);
576 : :
577 : 0 : err = mc_send_command(mc_io, &cmd);
578 [ # # ]: 0 : if (err)
579 : : return err;
580 : :
581 : : rsp_params = (struct dpio_rsp_get_api_version *)cmd.params;
582 : 0 : *major_ver = le16_to_cpu(rsp_params->major);
583 : 0 : *minor_ver = le16_to_cpu(rsp_params->minor);
584 : :
585 : 0 : return 0;
586 : : }
|