2 * Copyright 2013-2016 Freescale Semiconductor Inc.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above copyright
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution.
11 * * Neither the name of the above-listed copyright holders nor the
12 * names of any contributors may be used to endorse or promote products
13 * derived from this software without specific prior written permission.
15 * ALTERNATIVELY, this software may be distributed under the terms of the
16 * GNU General Public License ("GPL") as published by the Free Software
17 * Foundation, either version 2 of that License or (at your option) any
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
32 #include <linux/kernel.h>
33 #include "../include/mc.h"
39 * dprc_open() - Open DPRC object for use
40 * @mc_io: Pointer to MC portal's I/O object
41 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
42 * @container_id: Container ID to open
43 * @token: Returned token of DPRC object
45 * Return: '0' on Success; Error code otherwise.
47 * @warning Required before any operation on the object.
49 int dprc_open(struct fsl_mc_io *mc_io,
54 struct mc_command cmd = { 0 };
55 struct dprc_cmd_open *cmd_params;
59 cmd.header = mc_encode_cmd_header(DPRC_CMDID_OPEN, cmd_flags,
61 cmd_params = (struct dprc_cmd_open *)cmd.params;
62 cmd_params->container_id = cpu_to_le32(container_id);
64 /* send command to mc*/
65 err = mc_send_command(mc_io, &cmd);
69 /* retrieve response parameters */
70 *token = mc_cmd_hdr_read_token(&cmd);
74 EXPORT_SYMBOL(dprc_open);
77 * dprc_close() - Close the control session of the object
78 * @mc_io: Pointer to MC portal's I/O object
79 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
80 * @token: Token of DPRC object
82 * After this function is called, no further operations are
83 * allowed on the object without opening a new control session.
85 * Return: '0' on Success; Error code otherwise.
87 int dprc_close(struct fsl_mc_io *mc_io,
91 struct mc_command cmd = { 0 };
94 cmd.header = mc_encode_cmd_header(DPRC_CMDID_CLOSE, cmd_flags,
97 /* send command to mc*/
98 return mc_send_command(mc_io, &cmd);
100 EXPORT_SYMBOL(dprc_close);
103 * dprc_get_irq() - Get IRQ information from the DPRC.
104 * @mc_io: Pointer to MC portal's I/O object
105 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
106 * @token: Token of DPRC object
107 * @irq_index: The interrupt index to configure
108 * @type: Interrupt type: 0 represents message interrupt
109 * type (both irq_addr and irq_val are valid)
110 * @irq_cfg: IRQ attributes
112 * Return: '0' on Success; Error code otherwise.
114 int dprc_get_irq(struct fsl_mc_io *mc_io,
119 struct dprc_irq_cfg *irq_cfg)
121 struct mc_command cmd = { 0 };
122 struct dprc_cmd_get_irq *cmd_params;
123 struct dprc_rsp_get_irq *rsp_params;
126 /* prepare command */
127 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ,
130 cmd_params = (struct dprc_cmd_get_irq *)cmd.params;
131 cmd_params->irq_index = irq_index;
133 /* send command to mc*/
134 err = mc_send_command(mc_io, &cmd);
138 /* retrieve response parameters */
139 rsp_params = (struct dprc_rsp_get_irq *)cmd.params;
140 irq_cfg->val = le32_to_cpu(rsp_params->irq_val);
141 irq_cfg->paddr = le64_to_cpu(rsp_params->irq_addr);
142 irq_cfg->irq_num = le32_to_cpu(rsp_params->irq_num);
143 *type = le32_to_cpu(rsp_params->type);
149 * dprc_set_irq() - Set IRQ information for the DPRC to trigger an interrupt.
150 * @mc_io: Pointer to MC portal's I/O object
151 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
152 * @token: Token of DPRC object
153 * @irq_index: Identifies the interrupt index to configure
154 * @irq_cfg: IRQ configuration
156 * Return: '0' on Success; Error code otherwise.
158 int dprc_set_irq(struct fsl_mc_io *mc_io,
162 struct dprc_irq_cfg *irq_cfg)
164 struct mc_command cmd = { 0 };
165 struct dprc_cmd_set_irq *cmd_params;
167 /* prepare command */
168 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ,
171 cmd_params = (struct dprc_cmd_set_irq *)cmd.params;
172 cmd_params->irq_val = cpu_to_le32(irq_cfg->val);
173 cmd_params->irq_index = irq_index;
174 cmd_params->irq_addr = cpu_to_le64(irq_cfg->paddr);
175 cmd_params->irq_num = cpu_to_le32(irq_cfg->irq_num);
177 /* send command to mc*/
178 return mc_send_command(mc_io, &cmd);
182 * dprc_get_irq_enable() - Get overall interrupt state.
183 * @mc_io: Pointer to MC portal's I/O object
184 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
185 * @token: Token of DPRC object
186 * @irq_index: The interrupt index to configure
187 * @en: Returned interrupt state - enable = 1, disable = 0
189 * Return: '0' on Success; Error code otherwise.
191 int dprc_get_irq_enable(struct fsl_mc_io *mc_io,
197 struct mc_command cmd = { 0 };
198 struct dprc_cmd_get_irq_enable *cmd_params;
199 struct dprc_rsp_get_irq_enable *rsp_params;
202 /* prepare command */
203 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_ENABLE,
205 cmd_params = (struct dprc_cmd_get_irq_enable *)cmd.params;
206 cmd_params->irq_index = irq_index;
208 /* send command to mc*/
209 err = mc_send_command(mc_io, &cmd);
213 /* retrieve response parameters */
214 rsp_params = (struct dprc_rsp_get_irq_enable *)cmd.params;
215 *en = rsp_params->enabled & DPRC_ENABLE;
221 * dprc_set_irq_enable() - Set overall interrupt state.
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 DPRC object
225 * @irq_index: The interrupt index to configure
226 * @en: Interrupt state - enable = 1, disable = 0
228 * Allows GPP software to control when interrupts are generated.
229 * Each interrupt can have up to 32 causes. The enable/disable control's the
230 * overall interrupt state. if the interrupt is disabled no causes will cause
233 * Return: '0' on Success; Error code otherwise.
235 int dprc_set_irq_enable(struct fsl_mc_io *mc_io,
241 struct mc_command cmd = { 0 };
242 struct dprc_cmd_set_irq_enable *cmd_params;
244 /* prepare command */
245 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ_ENABLE,
247 cmd_params = (struct dprc_cmd_set_irq_enable *)cmd.params;
248 cmd_params->enable = en & DPRC_ENABLE;
249 cmd_params->irq_index = irq_index;
251 /* send command to mc*/
252 return mc_send_command(mc_io, &cmd);
256 * dprc_get_irq_mask() - Get interrupt mask.
257 * @mc_io: Pointer to MC portal's I/O object
258 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
259 * @token: Token of DPRC object
260 * @irq_index: The interrupt index to configure
261 * @mask: Returned event mask to trigger interrupt
263 * Every interrupt can have up to 32 causes and the interrupt model supports
264 * masking/unmasking each cause independently
266 * Return: '0' on Success; Error code otherwise.
268 int dprc_get_irq_mask(struct fsl_mc_io *mc_io,
274 struct mc_command cmd = { 0 };
275 struct dprc_cmd_get_irq_mask *cmd_params;
276 struct dprc_rsp_get_irq_mask *rsp_params;
279 /* prepare command */
280 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_MASK,
282 cmd_params = (struct dprc_cmd_get_irq_mask *)cmd.params;
283 cmd_params->irq_index = irq_index;
285 /* send command to mc*/
286 err = mc_send_command(mc_io, &cmd);
290 /* retrieve response parameters */
291 rsp_params = (struct dprc_rsp_get_irq_mask *)cmd.params;
292 *mask = le32_to_cpu(rsp_params->mask);
298 * dprc_set_irq_mask() - Set interrupt mask.
299 * @mc_io: Pointer to MC portal's I/O object
300 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
301 * @token: Token of DPRC object
302 * @irq_index: The interrupt index to configure
303 * @mask: event mask to trigger interrupt;
306 * 1 = consider event for asserting irq
308 * Every interrupt can have up to 32 causes and the interrupt model supports
309 * masking/unmasking each cause independently
311 * Return: '0' on Success; Error code otherwise.
313 int dprc_set_irq_mask(struct fsl_mc_io *mc_io,
319 struct mc_command cmd = { 0 };
320 struct dprc_cmd_set_irq_mask *cmd_params;
322 /* prepare command */
323 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ_MASK,
325 cmd_params = (struct dprc_cmd_set_irq_mask *)cmd.params;
326 cmd_params->mask = cpu_to_le32(mask);
327 cmd_params->irq_index = irq_index;
329 /* send command to mc*/
330 return mc_send_command(mc_io, &cmd);
334 * dprc_get_irq_status() - Get the current status of any pending interrupts.
335 * @mc_io: Pointer to MC portal's I/O object
336 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
337 * @token: Token of DPRC object
338 * @irq_index: The interrupt index to configure
339 * @status: Returned interrupts status - one bit per cause:
340 * 0 = no interrupt pending
341 * 1 = interrupt pending
343 * Return: '0' on Success; Error code otherwise.
345 int dprc_get_irq_status(struct fsl_mc_io *mc_io,
351 struct mc_command cmd = { 0 };
352 struct dprc_cmd_get_irq_status *cmd_params;
353 struct dprc_rsp_get_irq_status *rsp_params;
356 /* prepare command */
357 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_STATUS,
359 cmd_params = (struct dprc_cmd_get_irq_status *)cmd.params;
360 cmd_params->status = cpu_to_le32(*status);
361 cmd_params->irq_index = irq_index;
363 /* send command to mc*/
364 err = mc_send_command(mc_io, &cmd);
368 /* retrieve response parameters */
369 rsp_params = (struct dprc_rsp_get_irq_status *)cmd.params;
370 *status = le32_to_cpu(rsp_params->status);
376 * dprc_clear_irq_status() - Clear a pending interrupt's status
377 * @mc_io: Pointer to MC portal's I/O object
378 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
379 * @token: Token of DPRC object
380 * @irq_index: The interrupt index to configure
381 * @status: bits to clear (W1C) - one bit per cause:
383 * 1 = clear status bit
385 * Return: '0' on Success; Error code otherwise.
387 int dprc_clear_irq_status(struct fsl_mc_io *mc_io,
393 struct mc_command cmd = { 0 };
394 struct dprc_cmd_clear_irq_status *cmd_params;
396 /* prepare command */
397 cmd.header = mc_encode_cmd_header(DPRC_CMDID_CLEAR_IRQ_STATUS,
399 cmd_params = (struct dprc_cmd_clear_irq_status *)cmd.params;
400 cmd_params->status = cpu_to_le32(status);
401 cmd_params->irq_index = irq_index;
403 /* send command to mc*/
404 return mc_send_command(mc_io, &cmd);
408 * dprc_get_attributes() - Obtains container attributes
409 * @mc_io: Pointer to MC portal's I/O object
410 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
411 * @token: Token of DPRC object
412 * @attributes Returned container attributes
414 * Return: '0' on Success; Error code otherwise.
416 int dprc_get_attributes(struct fsl_mc_io *mc_io,
419 struct dprc_attributes *attr)
421 struct mc_command cmd = { 0 };
422 struct dprc_rsp_get_attributes *rsp_params;
425 /* prepare command */
426 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_ATTR,
430 /* send command to mc*/
431 err = mc_send_command(mc_io, &cmd);
435 /* retrieve response parameters */
436 rsp_params = (struct dprc_rsp_get_attributes *)cmd.params;
437 attr->container_id = le32_to_cpu(rsp_params->container_id);
438 attr->icid = le16_to_cpu(rsp_params->icid);
439 attr->options = le32_to_cpu(rsp_params->options);
440 attr->portal_id = le32_to_cpu(rsp_params->portal_id);
446 * dprc_get_obj_count() - Obtains the number of objects in the DPRC
447 * @mc_io: Pointer to MC portal's I/O object
448 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
449 * @token: Token of DPRC object
450 * @obj_count: Number of objects assigned to the DPRC
452 * Return: '0' on Success; Error code otherwise.
454 int dprc_get_obj_count(struct fsl_mc_io *mc_io,
459 struct mc_command cmd = { 0 };
460 struct dprc_rsp_get_obj_count *rsp_params;
463 /* prepare command */
464 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_COUNT,
467 /* send command to mc*/
468 err = mc_send_command(mc_io, &cmd);
472 /* retrieve response parameters */
473 rsp_params = (struct dprc_rsp_get_obj_count *)cmd.params;
474 *obj_count = le32_to_cpu(rsp_params->obj_count);
478 EXPORT_SYMBOL(dprc_get_obj_count);
481 * dprc_get_obj() - Get general information on an object
482 * @mc_io: Pointer to MC portal's I/O object
483 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
484 * @token: Token of DPRC object
485 * @obj_index: Index of the object to be queried (< obj_count)
486 * @obj_desc: Returns the requested object descriptor
488 * The object descriptors are retrieved one by one by incrementing
489 * obj_index up to (not including) the value of obj_count returned
490 * from dprc_get_obj_count(). dprc_get_obj_count() must
491 * be called prior to dprc_get_obj().
493 * Return: '0' on Success; Error code otherwise.
495 int dprc_get_obj(struct fsl_mc_io *mc_io,
499 struct fsl_mc_obj_desc *obj_desc)
501 struct mc_command cmd = { 0 };
502 struct dprc_cmd_get_obj *cmd_params;
503 struct dprc_rsp_get_obj *rsp_params;
506 /* prepare command */
507 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ,
510 cmd_params = (struct dprc_cmd_get_obj *)cmd.params;
511 cmd_params->obj_index = cpu_to_le32(obj_index);
513 /* send command to mc*/
514 err = mc_send_command(mc_io, &cmd);
518 /* retrieve response parameters */
519 rsp_params = (struct dprc_rsp_get_obj *)cmd.params;
520 obj_desc->id = le32_to_cpu(rsp_params->id);
521 obj_desc->vendor = le16_to_cpu(rsp_params->vendor);
522 obj_desc->irq_count = rsp_params->irq_count;
523 obj_desc->region_count = rsp_params->region_count;
524 obj_desc->state = le32_to_cpu(rsp_params->state);
525 obj_desc->ver_major = le16_to_cpu(rsp_params->version_major);
526 obj_desc->ver_minor = le16_to_cpu(rsp_params->version_minor);
527 obj_desc->flags = le16_to_cpu(rsp_params->flags);
528 strncpy(obj_desc->type, rsp_params->type, 16);
529 obj_desc->type[15] = '\0';
530 strncpy(obj_desc->label, rsp_params->label, 16);
531 obj_desc->label[15] = '\0';
534 EXPORT_SYMBOL(dprc_get_obj);
537 * dprc_set_obj_irq() - Set IRQ information for object to trigger an interrupt.
538 * @mc_io: Pointer to MC portal's I/O object
539 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
540 * @token: Token of DPRC object
541 * @obj_type: Type of the object to set its IRQ
542 * @obj_id: ID of the object to set its IRQ
543 * @irq_index: The interrupt index to configure
544 * @irq_cfg: IRQ configuration
546 * Return: '0' on Success; Error code otherwise.
548 int dprc_set_obj_irq(struct fsl_mc_io *mc_io,
554 struct dprc_irq_cfg *irq_cfg)
556 struct mc_command cmd = { 0 };
557 struct dprc_cmd_set_obj_irq *cmd_params;
559 /* prepare command */
560 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_OBJ_IRQ,
563 cmd_params = (struct dprc_cmd_set_obj_irq *)cmd.params;
564 cmd_params->irq_val = cpu_to_le32(irq_cfg->val);
565 cmd_params->irq_index = irq_index;
566 cmd_params->irq_addr = cpu_to_le64(irq_cfg->paddr);
567 cmd_params->irq_num = cpu_to_le32(irq_cfg->irq_num);
568 cmd_params->obj_id = cpu_to_le32(obj_id);
569 strncpy(cmd_params->obj_type, obj_type, 16);
570 cmd_params->obj_type[15] = '\0';
572 /* send command to mc*/
573 return mc_send_command(mc_io, &cmd);
575 EXPORT_SYMBOL(dprc_set_obj_irq);
578 * dprc_get_obj_irq() - Get IRQ information from object.
579 * @mc_io: Pointer to MC portal's I/O object
580 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
581 * @token: Token of DPRC object
582 * @obj_type: Type od the object to get its IRQ
583 * @obj_id: ID of the object to get its IRQ
584 * @irq_index: The interrupt index to configure
585 * @type: Interrupt type: 0 represents message interrupt
586 * type (both irq_addr and irq_val are valid)
587 * @irq_cfg: The returned IRQ attributes
589 * Return: '0' on Success; Error code otherwise.
591 int dprc_get_obj_irq(struct fsl_mc_io *mc_io,
598 struct dprc_irq_cfg *irq_cfg)
600 struct mc_command cmd = { 0 };
601 struct dprc_cmd_get_obj_irq *cmd_params;
602 struct dprc_rsp_get_obj_irq *rsp_params;
605 /* prepare command */
606 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_IRQ,
609 cmd_params = (struct dprc_cmd_get_obj_irq *)cmd.params;
610 cmd_params->obj_id = cpu_to_le32(obj_id);
611 cmd_params->irq_index = irq_index;
612 strncpy(cmd_params->obj_type, obj_type, 16);
613 cmd_params->obj_type[15] = '\0';
615 /* send command to mc*/
616 err = mc_send_command(mc_io, &cmd);
620 /* retrieve response parameters */
621 rsp_params = (struct dprc_rsp_get_obj_irq *)cmd.params;
622 irq_cfg->val = le32_to_cpu(rsp_params->irq_val);
623 irq_cfg->paddr = le64_to_cpu(rsp_params->irq_addr);
624 irq_cfg->irq_num = le32_to_cpu(rsp_params->irq_num);
625 *type = le32_to_cpu(rsp_params->type);
629 EXPORT_SYMBOL(dprc_get_obj_irq);
632 * dprc_get_res_count() - Obtains the number of free resources that are assigned
633 * to this container, by pool type
634 * @mc_io: Pointer to MC portal's I/O object
635 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
636 * @token: Token of DPRC object
638 * @res_count: Returned number of free resources of the given
639 * resource type that are assigned to this DPRC
641 * Return: '0' on Success; Error code otherwise.
643 int dprc_get_res_count(struct fsl_mc_io *mc_io,
649 struct mc_command cmd = { 0 };
650 struct dprc_cmd_get_res_count *cmd_params;
651 struct dprc_rsp_get_res_count *rsp_params;
654 /* prepare command */
655 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_COUNT,
657 cmd_params = (struct dprc_cmd_get_res_count *)cmd.params;
658 strncpy(cmd_params->type, type, 16);
659 cmd_params->type[15] = '\0';
661 /* send command to mc*/
662 err = mc_send_command(mc_io, &cmd);
666 /* retrieve response parameters */
667 rsp_params = (struct dprc_rsp_get_res_count *)cmd.params;
668 *res_count = le32_to_cpu(rsp_params->res_count);
672 EXPORT_SYMBOL(dprc_get_res_count);
675 * dprc_get_obj_region() - Get region information for a specified object.
676 * @mc_io: Pointer to MC portal's I/O object
677 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
678 * @token: Token of DPRC object
679 * @obj_type; Object type as returned in dprc_get_obj()
680 * @obj_id: Unique object instance as returned in dprc_get_obj()
681 * @region_index: The specific region to query
682 * @region_desc: Returns the requested region descriptor
684 * Return: '0' on Success; Error code otherwise.
686 int dprc_get_obj_region(struct fsl_mc_io *mc_io,
692 struct dprc_region_desc *region_desc)
694 struct mc_command cmd = { 0 };
695 struct dprc_cmd_get_obj_region *cmd_params;
696 struct dprc_rsp_get_obj_region *rsp_params;
699 /* prepare command */
700 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_REG,
702 cmd_params = (struct dprc_cmd_get_obj_region *)cmd.params;
703 cmd_params->obj_id = cpu_to_le32(obj_id);
704 cmd_params->region_index = region_index;
705 strncpy(cmd_params->obj_type, obj_type, 16);
706 cmd_params->obj_type[15] = '\0';
708 /* send command to mc*/
709 err = mc_send_command(mc_io, &cmd);
713 /* retrieve response parameters */
714 rsp_params = (struct dprc_rsp_get_obj_region *)cmd.params;
715 region_desc->base_offset = le64_to_cpu(rsp_params->base_addr);
716 region_desc->size = le32_to_cpu(rsp_params->size);
720 EXPORT_SYMBOL(dprc_get_obj_region);
723 * dprc_get_api_version - Get Data Path Resource Container API version
724 * @mc_io: Pointer to Mc portal's I/O object
725 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
726 * @major_ver: Major version of Data Path Resource Container API
727 * @minor_ver: Minor version of Data Path Resource Container API
729 * Return: '0' on Success; Error code otherwise.
731 int dprc_get_api_version(struct fsl_mc_io *mc_io,
736 struct mc_command cmd = { 0 };
739 /* prepare command */
740 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_API_VERSION,
743 /* send command to mc */
744 err = mc_send_command(mc_io, &cmd);
748 /* retrieve response parameters */
749 mc_cmd_read_api_version(&cmd, major_ver, minor_ver);
755 * dprc_get_container_id - Get container ID associated with a given portal.
756 * @mc_io: Pointer to Mc portal's I/O object
757 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
758 * @container_id: Requested container id
760 * Return: '0' on Success; Error code otherwise.
762 int dprc_get_container_id(struct fsl_mc_io *mc_io,
766 struct mc_command cmd = { 0 };
769 /* prepare command */
770 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_CONT_ID,
774 /* send command to mc*/
775 err = mc_send_command(mc_io, &cmd);
779 /* retrieve response parameters */
780 *container_id = (int)mc_cmd_read_object_id(&cmd);