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-sys.h"
35 #include "../include/mc-cmd.h"
36 #include "../include/dprc.h"
41 * dprc_open() - Open DPRC object for use
42 * @mc_io: Pointer to MC portal's I/O object
43 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
44 * @container_id: Container ID to open
45 * @token: Returned token of DPRC object
47 * Return: '0' on Success; Error code otherwise.
49 * @warning Required before any operation on the object.
51 int dprc_open(struct fsl_mc_io *mc_io,
56 struct mc_command cmd = { 0 };
57 struct dprc_cmd_open *cmd_params;
61 cmd.header = mc_encode_cmd_header(DPRC_CMDID_OPEN, cmd_flags,
63 cmd_params = (struct dprc_cmd_open *)cmd.params;
64 cmd_params->container_id = cpu_to_le32(container_id);
66 /* send command to mc*/
67 err = mc_send_command(mc_io, &cmd);
71 /* retrieve response parameters */
72 *token = mc_cmd_hdr_read_token(&cmd);
76 EXPORT_SYMBOL(dprc_open);
79 * dprc_close() - Close the control session of the object
80 * @mc_io: Pointer to MC portal's I/O object
81 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
82 * @token: Token of DPRC object
84 * After this function is called, no further operations are
85 * allowed on the object without opening a new control session.
87 * Return: '0' on Success; Error code otherwise.
89 int dprc_close(struct fsl_mc_io *mc_io,
93 struct mc_command cmd = { 0 };
96 cmd.header = mc_encode_cmd_header(DPRC_CMDID_CLOSE, cmd_flags,
99 /* send command to mc*/
100 return mc_send_command(mc_io, &cmd);
102 EXPORT_SYMBOL(dprc_close);
105 * dprc_get_irq() - Get IRQ information from the DPRC.
106 * @mc_io: Pointer to MC portal's I/O object
107 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
108 * @token: Token of DPRC object
109 * @irq_index: The interrupt index to configure
110 * @type: Interrupt type: 0 represents message interrupt
111 * type (both irq_addr and irq_val are valid)
112 * @irq_cfg: IRQ attributes
114 * Return: '0' on Success; Error code otherwise.
116 int dprc_get_irq(struct fsl_mc_io *mc_io,
121 struct dprc_irq_cfg *irq_cfg)
123 struct mc_command cmd = { 0 };
124 struct dprc_cmd_get_irq *cmd_params;
125 struct dprc_rsp_get_irq *rsp_params;
128 /* prepare command */
129 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ,
132 cmd_params = (struct dprc_cmd_get_irq *)cmd.params;
133 cmd_params->irq_index = irq_index;
135 /* send command to mc*/
136 err = mc_send_command(mc_io, &cmd);
140 /* retrieve response parameters */
141 rsp_params = (struct dprc_rsp_get_irq *)cmd.params;
142 irq_cfg->val = le32_to_cpu(rsp_params->irq_val);
143 irq_cfg->paddr = le64_to_cpu(rsp_params->irq_addr);
144 irq_cfg->irq_num = le32_to_cpu(rsp_params->irq_num);
145 *type = le32_to_cpu(rsp_params->type);
151 * dprc_set_irq() - Set IRQ information for the DPRC to trigger an interrupt.
152 * @mc_io: Pointer to MC portal's I/O object
153 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
154 * @token: Token of DPRC object
155 * @irq_index: Identifies the interrupt index to configure
156 * @irq_cfg: IRQ configuration
158 * Return: '0' on Success; Error code otherwise.
160 int dprc_set_irq(struct fsl_mc_io *mc_io,
164 struct dprc_irq_cfg *irq_cfg)
166 struct mc_command cmd = { 0 };
167 struct dprc_cmd_set_irq *cmd_params;
169 /* prepare command */
170 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ,
173 cmd_params = (struct dprc_cmd_set_irq *)cmd.params;
174 cmd_params->irq_val = cpu_to_le32(irq_cfg->val);
175 cmd_params->irq_index = irq_index;
176 cmd_params->irq_addr = cpu_to_le64(irq_cfg->paddr);
177 cmd_params->irq_num = cpu_to_le32(irq_cfg->irq_num);
179 /* send command to mc*/
180 return mc_send_command(mc_io, &cmd);
184 * dprc_get_irq_enable() - Get overall interrupt state.
185 * @mc_io: Pointer to MC portal's I/O object
186 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
187 * @token: Token of DPRC object
188 * @irq_index: The interrupt index to configure
189 * @en: Returned interrupt state - enable = 1, disable = 0
191 * Return: '0' on Success; Error code otherwise.
193 int dprc_get_irq_enable(struct fsl_mc_io *mc_io,
199 struct mc_command cmd = { 0 };
200 struct dprc_cmd_get_irq_enable *cmd_params;
201 struct dprc_rsp_get_irq_enable *rsp_params;
204 /* prepare command */
205 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_ENABLE,
207 cmd_params = (struct dprc_cmd_get_irq_enable *)cmd.params;
208 cmd_params->irq_index = irq_index;
210 /* send command to mc*/
211 err = mc_send_command(mc_io, &cmd);
215 /* retrieve response parameters */
216 rsp_params = (struct dprc_rsp_get_irq_enable *)cmd.params;
217 *en = rsp_params->enabled & DPRC_ENABLE;
223 * dprc_set_irq_enable() - Set overall interrupt state.
224 * @mc_io: Pointer to MC portal's I/O object
225 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
226 * @token: Token of DPRC object
227 * @irq_index: The interrupt index to configure
228 * @en: Interrupt state - enable = 1, disable = 0
230 * Allows GPP software to control when interrupts are generated.
231 * Each interrupt can have up to 32 causes. The enable/disable control's the
232 * overall interrupt state. if the interrupt is disabled no causes will cause
235 * Return: '0' on Success; Error code otherwise.
237 int dprc_set_irq_enable(struct fsl_mc_io *mc_io,
243 struct mc_command cmd = { 0 };
244 struct dprc_cmd_set_irq_enable *cmd_params;
246 /* prepare command */
247 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ_ENABLE,
249 cmd_params = (struct dprc_cmd_set_irq_enable *)cmd.params;
250 cmd_params->enable = en & DPRC_ENABLE;
251 cmd_params->irq_index = irq_index;
253 /* send command to mc*/
254 return mc_send_command(mc_io, &cmd);
258 * dprc_get_irq_mask() - Get interrupt mask.
259 * @mc_io: Pointer to MC portal's I/O object
260 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
261 * @token: Token of DPRC object
262 * @irq_index: The interrupt index to configure
263 * @mask: Returned event mask to trigger interrupt
265 * Every interrupt can have up to 32 causes and the interrupt model supports
266 * masking/unmasking each cause independently
268 * Return: '0' on Success; Error code otherwise.
270 int dprc_get_irq_mask(struct fsl_mc_io *mc_io,
276 struct mc_command cmd = { 0 };
277 struct dprc_cmd_get_irq_mask *cmd_params;
278 struct dprc_rsp_get_irq_mask *rsp_params;
281 /* prepare command */
282 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_MASK,
284 cmd_params = (struct dprc_cmd_get_irq_mask *)cmd.params;
285 cmd_params->irq_index = irq_index;
287 /* send command to mc*/
288 err = mc_send_command(mc_io, &cmd);
292 /* retrieve response parameters */
293 rsp_params = (struct dprc_rsp_get_irq_mask *)cmd.params;
294 *mask = le32_to_cpu(rsp_params->mask);
300 * dprc_set_irq_mask() - Set interrupt mask.
301 * @mc_io: Pointer to MC portal's I/O object
302 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
303 * @token: Token of DPRC object
304 * @irq_index: The interrupt index to configure
305 * @mask: event mask to trigger interrupt;
308 * 1 = consider event for asserting irq
310 * Every interrupt can have up to 32 causes and the interrupt model supports
311 * masking/unmasking each cause independently
313 * Return: '0' on Success; Error code otherwise.
315 int dprc_set_irq_mask(struct fsl_mc_io *mc_io,
321 struct mc_command cmd = { 0 };
322 struct dprc_cmd_set_irq_mask *cmd_params;
324 /* prepare command */
325 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ_MASK,
327 cmd_params = (struct dprc_cmd_set_irq_mask *)cmd.params;
328 cmd_params->mask = cpu_to_le32(mask);
329 cmd_params->irq_index = irq_index;
331 /* send command to mc*/
332 return mc_send_command(mc_io, &cmd);
336 * dprc_get_irq_status() - Get the current status of any pending interrupts.
337 * @mc_io: Pointer to MC portal's I/O object
338 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
339 * @token: Token of DPRC object
340 * @irq_index: The interrupt index to configure
341 * @status: Returned interrupts status - one bit per cause:
342 * 0 = no interrupt pending
343 * 1 = interrupt pending
345 * Return: '0' on Success; Error code otherwise.
347 int dprc_get_irq_status(struct fsl_mc_io *mc_io,
353 struct mc_command cmd = { 0 };
354 struct dprc_cmd_get_irq_status *cmd_params;
355 struct dprc_rsp_get_irq_status *rsp_params;
358 /* prepare command */
359 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_STATUS,
361 cmd_params = (struct dprc_cmd_get_irq_status *)cmd.params;
362 cmd_params->status = cpu_to_le32(*status);
363 cmd_params->irq_index = irq_index;
365 /* send command to mc*/
366 err = mc_send_command(mc_io, &cmd);
370 /* retrieve response parameters */
371 rsp_params = (struct dprc_rsp_get_irq_status *)cmd.params;
372 *status = le32_to_cpu(rsp_params->status);
378 * dprc_clear_irq_status() - Clear a pending interrupt's status
379 * @mc_io: Pointer to MC portal's I/O object
380 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
381 * @token: Token of DPRC object
382 * @irq_index: The interrupt index to configure
383 * @status: bits to clear (W1C) - one bit per cause:
385 * 1 = clear status bit
387 * Return: '0' on Success; Error code otherwise.
389 int dprc_clear_irq_status(struct fsl_mc_io *mc_io,
395 struct mc_command cmd = { 0 };
396 struct dprc_cmd_clear_irq_status *cmd_params;
398 /* prepare command */
399 cmd.header = mc_encode_cmd_header(DPRC_CMDID_CLEAR_IRQ_STATUS,
401 cmd_params = (struct dprc_cmd_clear_irq_status *)cmd.params;
402 cmd_params->status = cpu_to_le32(status);
403 cmd_params->irq_index = irq_index;
405 /* send command to mc*/
406 return mc_send_command(mc_io, &cmd);
410 * dprc_get_attributes() - Obtains container attributes
411 * @mc_io: Pointer to MC portal's I/O object
412 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
413 * @token: Token of DPRC object
414 * @attributes Returned container attributes
416 * Return: '0' on Success; Error code otherwise.
418 int dprc_get_attributes(struct fsl_mc_io *mc_io,
421 struct dprc_attributes *attr)
423 struct mc_command cmd = { 0 };
424 struct dprc_rsp_get_attributes *rsp_params;
427 /* prepare command */
428 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_ATTR,
432 /* send command to mc*/
433 err = mc_send_command(mc_io, &cmd);
437 /* retrieve response parameters */
438 rsp_params = (struct dprc_rsp_get_attributes *)cmd.params;
439 attr->container_id = le32_to_cpu(rsp_params->container_id);
440 attr->icid = le16_to_cpu(rsp_params->icid);
441 attr->options = le32_to_cpu(rsp_params->options);
442 attr->portal_id = le32_to_cpu(rsp_params->portal_id);
448 * dprc_get_obj_count() - Obtains the number of objects in the DPRC
449 * @mc_io: Pointer to MC portal's I/O object
450 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
451 * @token: Token of DPRC object
452 * @obj_count: Number of objects assigned to the DPRC
454 * Return: '0' on Success; Error code otherwise.
456 int dprc_get_obj_count(struct fsl_mc_io *mc_io,
461 struct mc_command cmd = { 0 };
462 struct dprc_rsp_get_obj_count *rsp_params;
465 /* prepare command */
466 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_COUNT,
469 /* send command to mc*/
470 err = mc_send_command(mc_io, &cmd);
474 /* retrieve response parameters */
475 rsp_params = (struct dprc_rsp_get_obj_count *)cmd.params;
476 *obj_count = le32_to_cpu(rsp_params->obj_count);
480 EXPORT_SYMBOL(dprc_get_obj_count);
483 * dprc_get_obj() - Get general information on an object
484 * @mc_io: Pointer to MC portal's I/O object
485 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
486 * @token: Token of DPRC object
487 * @obj_index: Index of the object to be queried (< obj_count)
488 * @obj_desc: Returns the requested object descriptor
490 * The object descriptors are retrieved one by one by incrementing
491 * obj_index up to (not including) the value of obj_count returned
492 * from dprc_get_obj_count(). dprc_get_obj_count() must
493 * be called prior to dprc_get_obj().
495 * Return: '0' on Success; Error code otherwise.
497 int dprc_get_obj(struct fsl_mc_io *mc_io,
501 struct fsl_mc_obj_desc *obj_desc)
503 struct mc_command cmd = { 0 };
504 struct dprc_cmd_get_obj *cmd_params;
505 struct dprc_rsp_get_obj *rsp_params;
508 /* prepare command */
509 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ,
512 cmd_params = (struct dprc_cmd_get_obj *)cmd.params;
513 cmd_params->obj_index = cpu_to_le32(obj_index);
515 /* send command to mc*/
516 err = mc_send_command(mc_io, &cmd);
520 /* retrieve response parameters */
521 rsp_params = (struct dprc_rsp_get_obj *)cmd.params;
522 obj_desc->id = le32_to_cpu(rsp_params->id);
523 obj_desc->vendor = le16_to_cpu(rsp_params->vendor);
524 obj_desc->irq_count = rsp_params->irq_count;
525 obj_desc->region_count = rsp_params->region_count;
526 obj_desc->state = le32_to_cpu(rsp_params->state);
527 obj_desc->ver_major = le16_to_cpu(rsp_params->version_major);
528 obj_desc->ver_minor = le16_to_cpu(rsp_params->version_minor);
529 obj_desc->flags = le16_to_cpu(rsp_params->flags);
530 strncpy(obj_desc->type, rsp_params->type, 16);
531 obj_desc->type[15] = '\0';
532 strncpy(obj_desc->label, rsp_params->label, 16);
533 obj_desc->label[15] = '\0';
536 EXPORT_SYMBOL(dprc_get_obj);
539 * dprc_set_obj_irq() - Set IRQ information for object to trigger an interrupt.
540 * @mc_io: Pointer to MC portal's I/O object
541 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
542 * @token: Token of DPRC object
543 * @obj_type: Type of the object to set its IRQ
544 * @obj_id: ID of the object to set its IRQ
545 * @irq_index: The interrupt index to configure
546 * @irq_cfg: IRQ configuration
548 * Return: '0' on Success; Error code otherwise.
550 int dprc_set_obj_irq(struct fsl_mc_io *mc_io,
556 struct dprc_irq_cfg *irq_cfg)
558 struct mc_command cmd = { 0 };
559 struct dprc_cmd_set_obj_irq *cmd_params;
561 /* prepare command */
562 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_OBJ_IRQ,
565 cmd_params = (struct dprc_cmd_set_obj_irq *)cmd.params;
566 cmd_params->irq_val = cpu_to_le32(irq_cfg->val);
567 cmd_params->irq_index = irq_index;
568 cmd_params->irq_addr = cpu_to_le64(irq_cfg->paddr);
569 cmd_params->irq_num = cpu_to_le32(irq_cfg->irq_num);
570 cmd_params->obj_id = cpu_to_le32(obj_id);
571 strncpy(cmd_params->obj_type, obj_type, 16);
572 cmd_params->obj_type[15] = '\0';
574 /* send command to mc*/
575 return mc_send_command(mc_io, &cmd);
577 EXPORT_SYMBOL(dprc_set_obj_irq);
580 * dprc_get_obj_irq() - Get IRQ information from object.
581 * @mc_io: Pointer to MC portal's I/O object
582 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
583 * @token: Token of DPRC object
584 * @obj_type: Type od the object to get its IRQ
585 * @obj_id: ID of the object to get its IRQ
586 * @irq_index: The interrupt index to configure
587 * @type: Interrupt type: 0 represents message interrupt
588 * type (both irq_addr and irq_val are valid)
589 * @irq_cfg: The returned IRQ attributes
591 * Return: '0' on Success; Error code otherwise.
593 int dprc_get_obj_irq(struct fsl_mc_io *mc_io,
600 struct dprc_irq_cfg *irq_cfg)
602 struct mc_command cmd = { 0 };
603 struct dprc_cmd_get_obj_irq *cmd_params;
604 struct dprc_rsp_get_obj_irq *rsp_params;
607 /* prepare command */
608 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_IRQ,
611 cmd_params = (struct dprc_cmd_get_obj_irq *)cmd.params;
612 cmd_params->obj_id = cpu_to_le32(obj_id);
613 cmd_params->irq_index = irq_index;
614 strncpy(cmd_params->obj_type, obj_type, 16);
615 cmd_params->obj_type[15] = '\0';
617 /* send command to mc*/
618 err = mc_send_command(mc_io, &cmd);
622 /* retrieve response parameters */
623 rsp_params = (struct dprc_rsp_get_obj_irq *)cmd.params;
624 irq_cfg->val = le32_to_cpu(rsp_params->irq_val);
625 irq_cfg->paddr = le64_to_cpu(rsp_params->irq_addr);
626 irq_cfg->irq_num = le32_to_cpu(rsp_params->irq_num);
627 *type = le32_to_cpu(rsp_params->type);
631 EXPORT_SYMBOL(dprc_get_obj_irq);
634 * dprc_get_res_count() - Obtains the number of free resources that are assigned
635 * to this container, by pool type
636 * @mc_io: Pointer to MC portal's I/O object
637 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
638 * @token: Token of DPRC object
640 * @res_count: Returned number of free resources of the given
641 * resource type that are assigned to this DPRC
643 * Return: '0' on Success; Error code otherwise.
645 int dprc_get_res_count(struct fsl_mc_io *mc_io,
651 struct mc_command cmd = { 0 };
652 struct dprc_cmd_get_res_count *cmd_params;
653 struct dprc_rsp_get_res_count *rsp_params;
656 /* prepare command */
657 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_COUNT,
659 cmd_params = (struct dprc_cmd_get_res_count *)cmd.params;
660 strncpy(cmd_params->type, type, 16);
661 cmd_params->type[15] = '\0';
663 /* send command to mc*/
664 err = mc_send_command(mc_io, &cmd);
668 /* retrieve response parameters */
669 rsp_params = (struct dprc_rsp_get_res_count *)cmd.params;
670 *res_count = le32_to_cpu(rsp_params->res_count);
674 EXPORT_SYMBOL(dprc_get_res_count);
677 * dprc_get_obj_region() - Get region information for a specified object.
678 * @mc_io: Pointer to MC portal's I/O object
679 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
680 * @token: Token of DPRC object
681 * @obj_type; Object type as returned in dprc_get_obj()
682 * @obj_id: Unique object instance as returned in dprc_get_obj()
683 * @region_index: The specific region to query
684 * @region_desc: Returns the requested region descriptor
686 * Return: '0' on Success; Error code otherwise.
688 int dprc_get_obj_region(struct fsl_mc_io *mc_io,
694 struct dprc_region_desc *region_desc)
696 struct mc_command cmd = { 0 };
697 struct dprc_cmd_get_obj_region *cmd_params;
698 struct dprc_rsp_get_obj_region *rsp_params;
701 /* prepare command */
702 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_REG,
704 cmd_params = (struct dprc_cmd_get_obj_region *)cmd.params;
705 cmd_params->obj_id = cpu_to_le32(obj_id);
706 cmd_params->region_index = region_index;
707 strncpy(cmd_params->obj_type, obj_type, 16);
708 cmd_params->obj_type[15] = '\0';
710 /* send command to mc*/
711 err = mc_send_command(mc_io, &cmd);
715 /* retrieve response parameters */
716 rsp_params = (struct dprc_rsp_get_obj_region *)cmd.params;
717 region_desc->base_offset = le64_to_cpu(rsp_params->base_addr);
718 region_desc->size = le32_to_cpu(rsp_params->size);
722 EXPORT_SYMBOL(dprc_get_obj_region);
725 * dprc_get_api_version - Get Data Path Resource Container API version
726 * @mc_io: Pointer to Mc portal's I/O object
727 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
728 * @major_ver: Major version of Data Path Resource Container API
729 * @minor_ver: Minor version of Data Path Resource Container API
731 * Return: '0' on Success; Error code otherwise.
733 int dprc_get_api_version(struct fsl_mc_io *mc_io,
738 struct mc_command cmd = { 0 };
741 /* prepare command */
742 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_API_VERSION,
745 /* send command to mc */
746 err = mc_send_command(mc_io, &cmd);
750 /* retrieve response parameters */
751 mc_cmd_read_api_version(&cmd, major_ver, minor_ver);
757 * dprc_get_container_id - Get container ID associated with a given portal.
758 * @mc_io: Pointer to Mc portal's I/O object
759 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
760 * @container_id: Requested container id
762 * Return: '0' on Success; Error code otherwise.
764 int dprc_get_container_id(struct fsl_mc_io *mc_io,
768 struct mc_command cmd = { 0 };
771 /* prepare command */
772 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_CONT_ID,
776 /* send command to mc*/
777 err = mc_send_command(mc_io, &cmd);
781 /* retrieve response parameters */
782 *container_id = (int)mc_cmd_read_object_id(&cmd);