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"
34 #include "../include/mc-cmd.h"
35 #include "../include/dprc.h"
40 * dprc_open() - Open DPRC object for use
41 * @mc_io: Pointer to MC portal's I/O object
42 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
43 * @container_id: Container ID to open
44 * @token: Returned token of DPRC object
46 * Return: '0' on Success; Error code otherwise.
48 * @warning Required before any operation on the object.
50 int dprc_open(struct fsl_mc_io *mc_io,
55 struct mc_command cmd = { 0 };
56 struct dprc_cmd_open *cmd_params;
60 cmd.header = mc_encode_cmd_header(DPRC_CMDID_OPEN, cmd_flags,
62 cmd_params = (struct dprc_cmd_open *)cmd.params;
63 cmd_params->container_id = cpu_to_le32(container_id);
65 /* send command to mc*/
66 err = mc_send_command(mc_io, &cmd);
70 /* retrieve response parameters */
71 *token = mc_cmd_hdr_read_token(&cmd);
75 EXPORT_SYMBOL(dprc_open);
78 * dprc_close() - Close the control session of the object
79 * @mc_io: Pointer to MC portal's I/O object
80 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
81 * @token: Token of DPRC object
83 * After this function is called, no further operations are
84 * allowed on the object without opening a new control session.
86 * Return: '0' on Success; Error code otherwise.
88 int dprc_close(struct fsl_mc_io *mc_io,
92 struct mc_command cmd = { 0 };
95 cmd.header = mc_encode_cmd_header(DPRC_CMDID_CLOSE, cmd_flags,
98 /* send command to mc*/
99 return mc_send_command(mc_io, &cmd);
101 EXPORT_SYMBOL(dprc_close);
104 * dprc_get_irq() - Get IRQ information from the DPRC.
105 * @mc_io: Pointer to MC portal's I/O object
106 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
107 * @token: Token of DPRC object
108 * @irq_index: The interrupt index to configure
109 * @type: Interrupt type: 0 represents message interrupt
110 * type (both irq_addr and irq_val are valid)
111 * @irq_cfg: IRQ attributes
113 * Return: '0' on Success; Error code otherwise.
115 int dprc_get_irq(struct fsl_mc_io *mc_io,
120 struct dprc_irq_cfg *irq_cfg)
122 struct mc_command cmd = { 0 };
123 struct dprc_cmd_get_irq *cmd_params;
124 struct dprc_rsp_get_irq *rsp_params;
127 /* prepare command */
128 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ,
131 cmd_params = (struct dprc_cmd_get_irq *)cmd.params;
132 cmd_params->irq_index = irq_index;
134 /* send command to mc*/
135 err = mc_send_command(mc_io, &cmd);
139 /* retrieve response parameters */
140 rsp_params = (struct dprc_rsp_get_irq *)cmd.params;
141 irq_cfg->val = le32_to_cpu(rsp_params->irq_val);
142 irq_cfg->paddr = le64_to_cpu(rsp_params->irq_addr);
143 irq_cfg->irq_num = le32_to_cpu(rsp_params->irq_num);
144 *type = le32_to_cpu(rsp_params->type);
150 * dprc_set_irq() - Set IRQ information for the DPRC to trigger an interrupt.
151 * @mc_io: Pointer to MC portal's I/O object
152 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
153 * @token: Token of DPRC object
154 * @irq_index: Identifies the interrupt index to configure
155 * @irq_cfg: IRQ configuration
157 * Return: '0' on Success; Error code otherwise.
159 int dprc_set_irq(struct fsl_mc_io *mc_io,
163 struct dprc_irq_cfg *irq_cfg)
165 struct mc_command cmd = { 0 };
166 struct dprc_cmd_set_irq *cmd_params;
168 /* prepare command */
169 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ,
172 cmd_params = (struct dprc_cmd_set_irq *)cmd.params;
173 cmd_params->irq_val = cpu_to_le32(irq_cfg->val);
174 cmd_params->irq_index = irq_index;
175 cmd_params->irq_addr = cpu_to_le64(irq_cfg->paddr);
176 cmd_params->irq_num = cpu_to_le32(irq_cfg->irq_num);
178 /* send command to mc*/
179 return mc_send_command(mc_io, &cmd);
183 * dprc_get_irq_enable() - Get overall interrupt state.
184 * @mc_io: Pointer to MC portal's I/O object
185 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
186 * @token: Token of DPRC object
187 * @irq_index: The interrupt index to configure
188 * @en: Returned interrupt state - enable = 1, disable = 0
190 * Return: '0' on Success; Error code otherwise.
192 int dprc_get_irq_enable(struct fsl_mc_io *mc_io,
198 struct mc_command cmd = { 0 };
199 struct dprc_cmd_get_irq_enable *cmd_params;
200 struct dprc_rsp_get_irq_enable *rsp_params;
203 /* prepare command */
204 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_ENABLE,
206 cmd_params = (struct dprc_cmd_get_irq_enable *)cmd.params;
207 cmd_params->irq_index = irq_index;
209 /* send command to mc*/
210 err = mc_send_command(mc_io, &cmd);
214 /* retrieve response parameters */
215 rsp_params = (struct dprc_rsp_get_irq_enable *)cmd.params;
216 *en = rsp_params->enabled & DPRC_ENABLE;
222 * dprc_set_irq_enable() - Set overall interrupt state.
223 * @mc_io: Pointer to MC portal's I/O object
224 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
225 * @token: Token of DPRC object
226 * @irq_index: The interrupt index to configure
227 * @en: Interrupt state - enable = 1, disable = 0
229 * Allows GPP software to control when interrupts are generated.
230 * Each interrupt can have up to 32 causes. The enable/disable control's the
231 * overall interrupt state. if the interrupt is disabled no causes will cause
234 * Return: '0' on Success; Error code otherwise.
236 int dprc_set_irq_enable(struct fsl_mc_io *mc_io,
242 struct mc_command cmd = { 0 };
243 struct dprc_cmd_set_irq_enable *cmd_params;
245 /* prepare command */
246 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ_ENABLE,
248 cmd_params = (struct dprc_cmd_set_irq_enable *)cmd.params;
249 cmd_params->enable = en & DPRC_ENABLE;
250 cmd_params->irq_index = irq_index;
252 /* send command to mc*/
253 return mc_send_command(mc_io, &cmd);
257 * dprc_get_irq_mask() - Get interrupt mask.
258 * @mc_io: Pointer to MC portal's I/O object
259 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
260 * @token: Token of DPRC object
261 * @irq_index: The interrupt index to configure
262 * @mask: Returned event mask to trigger interrupt
264 * Every interrupt can have up to 32 causes and the interrupt model supports
265 * masking/unmasking each cause independently
267 * Return: '0' on Success; Error code otherwise.
269 int dprc_get_irq_mask(struct fsl_mc_io *mc_io,
275 struct mc_command cmd = { 0 };
276 struct dprc_cmd_get_irq_mask *cmd_params;
277 struct dprc_rsp_get_irq_mask *rsp_params;
280 /* prepare command */
281 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_MASK,
283 cmd_params = (struct dprc_cmd_get_irq_mask *)cmd.params;
284 cmd_params->irq_index = irq_index;
286 /* send command to mc*/
287 err = mc_send_command(mc_io, &cmd);
291 /* retrieve response parameters */
292 rsp_params = (struct dprc_rsp_get_irq_mask *)cmd.params;
293 *mask = le32_to_cpu(rsp_params->mask);
299 * dprc_set_irq_mask() - Set interrupt mask.
300 * @mc_io: Pointer to MC portal's I/O object
301 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
302 * @token: Token of DPRC object
303 * @irq_index: The interrupt index to configure
304 * @mask: event mask to trigger interrupt;
307 * 1 = consider event for asserting irq
309 * Every interrupt can have up to 32 causes and the interrupt model supports
310 * masking/unmasking each cause independently
312 * Return: '0' on Success; Error code otherwise.
314 int dprc_set_irq_mask(struct fsl_mc_io *mc_io,
320 struct mc_command cmd = { 0 };
321 struct dprc_cmd_set_irq_mask *cmd_params;
323 /* prepare command */
324 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ_MASK,
326 cmd_params = (struct dprc_cmd_set_irq_mask *)cmd.params;
327 cmd_params->mask = cpu_to_le32(mask);
328 cmd_params->irq_index = irq_index;
330 /* send command to mc*/
331 return mc_send_command(mc_io, &cmd);
335 * dprc_get_irq_status() - Get the current status of any pending interrupts.
336 * @mc_io: Pointer to MC portal's I/O object
337 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
338 * @token: Token of DPRC object
339 * @irq_index: The interrupt index to configure
340 * @status: Returned interrupts status - one bit per cause:
341 * 0 = no interrupt pending
342 * 1 = interrupt pending
344 * Return: '0' on Success; Error code otherwise.
346 int dprc_get_irq_status(struct fsl_mc_io *mc_io,
352 struct mc_command cmd = { 0 };
353 struct dprc_cmd_get_irq_status *cmd_params;
354 struct dprc_rsp_get_irq_status *rsp_params;
357 /* prepare command */
358 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_STATUS,
360 cmd_params = (struct dprc_cmd_get_irq_status *)cmd.params;
361 cmd_params->status = cpu_to_le32(*status);
362 cmd_params->irq_index = irq_index;
364 /* send command to mc*/
365 err = mc_send_command(mc_io, &cmd);
369 /* retrieve response parameters */
370 rsp_params = (struct dprc_rsp_get_irq_status *)cmd.params;
371 *status = le32_to_cpu(rsp_params->status);
377 * dprc_clear_irq_status() - Clear a pending interrupt's status
378 * @mc_io: Pointer to MC portal's I/O object
379 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
380 * @token: Token of DPRC object
381 * @irq_index: The interrupt index to configure
382 * @status: bits to clear (W1C) - one bit per cause:
384 * 1 = clear status bit
386 * Return: '0' on Success; Error code otherwise.
388 int dprc_clear_irq_status(struct fsl_mc_io *mc_io,
394 struct mc_command cmd = { 0 };
395 struct dprc_cmd_clear_irq_status *cmd_params;
397 /* prepare command */
398 cmd.header = mc_encode_cmd_header(DPRC_CMDID_CLEAR_IRQ_STATUS,
400 cmd_params = (struct dprc_cmd_clear_irq_status *)cmd.params;
401 cmd_params->status = cpu_to_le32(status);
402 cmd_params->irq_index = irq_index;
404 /* send command to mc*/
405 return mc_send_command(mc_io, &cmd);
409 * dprc_get_attributes() - Obtains container attributes
410 * @mc_io: Pointer to MC portal's I/O object
411 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
412 * @token: Token of DPRC object
413 * @attributes Returned container attributes
415 * Return: '0' on Success; Error code otherwise.
417 int dprc_get_attributes(struct fsl_mc_io *mc_io,
420 struct dprc_attributes *attr)
422 struct mc_command cmd = { 0 };
423 struct dprc_rsp_get_attributes *rsp_params;
426 /* prepare command */
427 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_ATTR,
431 /* send command to mc*/
432 err = mc_send_command(mc_io, &cmd);
436 /* retrieve response parameters */
437 rsp_params = (struct dprc_rsp_get_attributes *)cmd.params;
438 attr->container_id = le32_to_cpu(rsp_params->container_id);
439 attr->icid = le16_to_cpu(rsp_params->icid);
440 attr->options = le32_to_cpu(rsp_params->options);
441 attr->portal_id = le32_to_cpu(rsp_params->portal_id);
447 * dprc_get_obj_count() - Obtains the number of objects in the DPRC
448 * @mc_io: Pointer to MC portal's I/O object
449 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
450 * @token: Token of DPRC object
451 * @obj_count: Number of objects assigned to the DPRC
453 * Return: '0' on Success; Error code otherwise.
455 int dprc_get_obj_count(struct fsl_mc_io *mc_io,
460 struct mc_command cmd = { 0 };
461 struct dprc_rsp_get_obj_count *rsp_params;
464 /* prepare command */
465 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_COUNT,
468 /* send command to mc*/
469 err = mc_send_command(mc_io, &cmd);
473 /* retrieve response parameters */
474 rsp_params = (struct dprc_rsp_get_obj_count *)cmd.params;
475 *obj_count = le32_to_cpu(rsp_params->obj_count);
479 EXPORT_SYMBOL(dprc_get_obj_count);
482 * dprc_get_obj() - Get general information on an object
483 * @mc_io: Pointer to MC portal's I/O object
484 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
485 * @token: Token of DPRC object
486 * @obj_index: Index of the object to be queried (< obj_count)
487 * @obj_desc: Returns the requested object descriptor
489 * The object descriptors are retrieved one by one by incrementing
490 * obj_index up to (not including) the value of obj_count returned
491 * from dprc_get_obj_count(). dprc_get_obj_count() must
492 * be called prior to dprc_get_obj().
494 * Return: '0' on Success; Error code otherwise.
496 int dprc_get_obj(struct fsl_mc_io *mc_io,
500 struct fsl_mc_obj_desc *obj_desc)
502 struct mc_command cmd = { 0 };
503 struct dprc_cmd_get_obj *cmd_params;
504 struct dprc_rsp_get_obj *rsp_params;
507 /* prepare command */
508 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ,
511 cmd_params = (struct dprc_cmd_get_obj *)cmd.params;
512 cmd_params->obj_index = cpu_to_le32(obj_index);
514 /* send command to mc*/
515 err = mc_send_command(mc_io, &cmd);
519 /* retrieve response parameters */
520 rsp_params = (struct dprc_rsp_get_obj *)cmd.params;
521 obj_desc->id = le32_to_cpu(rsp_params->id);
522 obj_desc->vendor = le16_to_cpu(rsp_params->vendor);
523 obj_desc->irq_count = rsp_params->irq_count;
524 obj_desc->region_count = rsp_params->region_count;
525 obj_desc->state = le32_to_cpu(rsp_params->state);
526 obj_desc->ver_major = le16_to_cpu(rsp_params->version_major);
527 obj_desc->ver_minor = le16_to_cpu(rsp_params->version_minor);
528 obj_desc->flags = le16_to_cpu(rsp_params->flags);
529 strncpy(obj_desc->type, rsp_params->type, 16);
530 obj_desc->type[15] = '\0';
531 strncpy(obj_desc->label, rsp_params->label, 16);
532 obj_desc->label[15] = '\0';
535 EXPORT_SYMBOL(dprc_get_obj);
538 * dprc_set_obj_irq() - Set IRQ information for object to trigger an interrupt.
539 * @mc_io: Pointer to MC portal's I/O object
540 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
541 * @token: Token of DPRC object
542 * @obj_type: Type of the object to set its IRQ
543 * @obj_id: ID of the object to set its IRQ
544 * @irq_index: The interrupt index to configure
545 * @irq_cfg: IRQ configuration
547 * Return: '0' on Success; Error code otherwise.
549 int dprc_set_obj_irq(struct fsl_mc_io *mc_io,
555 struct dprc_irq_cfg *irq_cfg)
557 struct mc_command cmd = { 0 };
558 struct dprc_cmd_set_obj_irq *cmd_params;
560 /* prepare command */
561 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_OBJ_IRQ,
564 cmd_params = (struct dprc_cmd_set_obj_irq *)cmd.params;
565 cmd_params->irq_val = cpu_to_le32(irq_cfg->val);
566 cmd_params->irq_index = irq_index;
567 cmd_params->irq_addr = cpu_to_le64(irq_cfg->paddr);
568 cmd_params->irq_num = cpu_to_le32(irq_cfg->irq_num);
569 cmd_params->obj_id = cpu_to_le32(obj_id);
570 strncpy(cmd_params->obj_type, obj_type, 16);
571 cmd_params->obj_type[15] = '\0';
573 /* send command to mc*/
574 return mc_send_command(mc_io, &cmd);
576 EXPORT_SYMBOL(dprc_set_obj_irq);
579 * dprc_get_obj_irq() - Get IRQ information from object.
580 * @mc_io: Pointer to MC portal's I/O object
581 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
582 * @token: Token of DPRC object
583 * @obj_type: Type od the object to get its IRQ
584 * @obj_id: ID of the object to get its IRQ
585 * @irq_index: The interrupt index to configure
586 * @type: Interrupt type: 0 represents message interrupt
587 * type (both irq_addr and irq_val are valid)
588 * @irq_cfg: The returned IRQ attributes
590 * Return: '0' on Success; Error code otherwise.
592 int dprc_get_obj_irq(struct fsl_mc_io *mc_io,
599 struct dprc_irq_cfg *irq_cfg)
601 struct mc_command cmd = { 0 };
602 struct dprc_cmd_get_obj_irq *cmd_params;
603 struct dprc_rsp_get_obj_irq *rsp_params;
606 /* prepare command */
607 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_IRQ,
610 cmd_params = (struct dprc_cmd_get_obj_irq *)cmd.params;
611 cmd_params->obj_id = cpu_to_le32(obj_id);
612 cmd_params->irq_index = irq_index;
613 strncpy(cmd_params->obj_type, obj_type, 16);
614 cmd_params->obj_type[15] = '\0';
616 /* send command to mc*/
617 err = mc_send_command(mc_io, &cmd);
621 /* retrieve response parameters */
622 rsp_params = (struct dprc_rsp_get_obj_irq *)cmd.params;
623 irq_cfg->val = le32_to_cpu(rsp_params->irq_val);
624 irq_cfg->paddr = le64_to_cpu(rsp_params->irq_addr);
625 irq_cfg->irq_num = le32_to_cpu(rsp_params->irq_num);
626 *type = le32_to_cpu(rsp_params->type);
630 EXPORT_SYMBOL(dprc_get_obj_irq);
633 * dprc_get_res_count() - Obtains the number of free resources that are assigned
634 * to this container, by pool type
635 * @mc_io: Pointer to MC portal's I/O object
636 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
637 * @token: Token of DPRC object
639 * @res_count: Returned number of free resources of the given
640 * resource type that are assigned to this DPRC
642 * Return: '0' on Success; Error code otherwise.
644 int dprc_get_res_count(struct fsl_mc_io *mc_io,
650 struct mc_command cmd = { 0 };
651 struct dprc_cmd_get_res_count *cmd_params;
652 struct dprc_rsp_get_res_count *rsp_params;
655 /* prepare command */
656 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_COUNT,
658 cmd_params = (struct dprc_cmd_get_res_count *)cmd.params;
659 strncpy(cmd_params->type, type, 16);
660 cmd_params->type[15] = '\0';
662 /* send command to mc*/
663 err = mc_send_command(mc_io, &cmd);
667 /* retrieve response parameters */
668 rsp_params = (struct dprc_rsp_get_res_count *)cmd.params;
669 *res_count = le32_to_cpu(rsp_params->res_count);
673 EXPORT_SYMBOL(dprc_get_res_count);
676 * dprc_get_obj_region() - Get region information for a specified object.
677 * @mc_io: Pointer to MC portal's I/O object
678 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
679 * @token: Token of DPRC object
680 * @obj_type; Object type as returned in dprc_get_obj()
681 * @obj_id: Unique object instance as returned in dprc_get_obj()
682 * @region_index: The specific region to query
683 * @region_desc: Returns the requested region descriptor
685 * Return: '0' on Success; Error code otherwise.
687 int dprc_get_obj_region(struct fsl_mc_io *mc_io,
693 struct dprc_region_desc *region_desc)
695 struct mc_command cmd = { 0 };
696 struct dprc_cmd_get_obj_region *cmd_params;
697 struct dprc_rsp_get_obj_region *rsp_params;
700 /* prepare command */
701 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_REG,
703 cmd_params = (struct dprc_cmd_get_obj_region *)cmd.params;
704 cmd_params->obj_id = cpu_to_le32(obj_id);
705 cmd_params->region_index = region_index;
706 strncpy(cmd_params->obj_type, obj_type, 16);
707 cmd_params->obj_type[15] = '\0';
709 /* send command to mc*/
710 err = mc_send_command(mc_io, &cmd);
714 /* retrieve response parameters */
715 rsp_params = (struct dprc_rsp_get_obj_region *)cmd.params;
716 region_desc->base_offset = le64_to_cpu(rsp_params->base_addr);
717 region_desc->size = le32_to_cpu(rsp_params->size);
721 EXPORT_SYMBOL(dprc_get_obj_region);
724 * dprc_get_api_version - Get Data Path Resource Container API version
725 * @mc_io: Pointer to Mc portal's I/O object
726 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
727 * @major_ver: Major version of Data Path Resource Container API
728 * @minor_ver: Minor version of Data Path Resource Container API
730 * Return: '0' on Success; Error code otherwise.
732 int dprc_get_api_version(struct fsl_mc_io *mc_io,
737 struct mc_command cmd = { 0 };
740 /* prepare command */
741 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_API_VERSION,
744 /* send command to mc */
745 err = mc_send_command(mc_io, &cmd);
749 /* retrieve response parameters */
750 mc_cmd_read_api_version(&cmd, major_ver, minor_ver);
756 * dprc_get_container_id - Get container ID associated with a given portal.
757 * @mc_io: Pointer to Mc portal's I/O object
758 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
759 * @container_id: Requested container id
761 * Return: '0' on Success; Error code otherwise.
763 int dprc_get_container_id(struct fsl_mc_io *mc_io,
767 struct mc_command cmd = { 0 };
770 /* prepare command */
771 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_CONT_ID,
775 /* send command to mc*/
776 err = mc_send_command(mc_io, &cmd);
780 /* retrieve response parameters */
781 *container_id = (int)mc_cmd_read_object_id(&cmd);