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 "../include/mc-sys.h"
33 #include "../include/mc-cmd.h"
34 #include "../include/dprc.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_create_container() - Create child container
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 * @cfg: Child container configuration
108 * @child_container_id: Returned child container ID
109 * @child_portal_offset: Returned child portal offset from MC portal base
111 * Return: '0' on Success; Error code otherwise.
113 int dprc_create_container(struct fsl_mc_io *mc_io,
116 struct dprc_cfg *cfg,
117 int *child_container_id,
118 u64 *child_portal_offset)
120 struct mc_command cmd = { 0 };
121 struct dprc_cmd_create_container *cmd_params;
122 struct dprc_rsp_create_container *rsp_params;
125 /* prepare command */
126 cmd_params = (struct dprc_cmd_create_container *)cmd.params;
127 cmd_params->options = cpu_to_le32(cfg->options);
128 cmd_params->icid = cpu_to_le16(cfg->icid);
129 cmd_params->portal_id = cpu_to_le32(cfg->portal_id);
130 strncpy(cmd_params->label, cfg->label, 16);
131 cmd_params->label[15] = '\0';
133 cmd.header = mc_encode_cmd_header(DPRC_CMDID_CREATE_CONT,
136 /* send command to mc*/
137 err = mc_send_command(mc_io, &cmd);
141 /* retrieve response parameters */
142 rsp_params = (struct dprc_rsp_create_container *)cmd.params;
143 *child_container_id = le32_to_cpu(rsp_params->child_container_id);
144 *child_portal_offset = le64_to_cpu(rsp_params->child_portal_addr);
150 * dprc_destroy_container() - Destroy child container.
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 * @child_container_id: ID of the container to destroy
156 * This function terminates the child container, so following this call the
157 * child container ID becomes invalid.
160 * - All resources and objects of the destroyed container are returned to the
161 * parent container or destroyed if were created be the destroyed container.
162 * - This function destroy all the child containers of the specified
163 * container prior to destroying the container itself.
165 * warning: Only the parent container is allowed to destroy a child policy
166 * Container 0 can't be destroyed
168 * Return: '0' on Success; Error code otherwise.
171 int dprc_destroy_container(struct fsl_mc_io *mc_io,
174 int child_container_id)
176 struct mc_command cmd = { 0 };
177 struct dprc_cmd_destroy_container *cmd_params;
179 /* prepare command */
180 cmd.header = mc_encode_cmd_header(DPRC_CMDID_DESTROY_CONT,
182 cmd_params = (struct dprc_cmd_destroy_container *)cmd.params;
183 cmd_params->child_container_id = cpu_to_le32(child_container_id);
185 /* send command to mc*/
186 return mc_send_command(mc_io, &cmd);
190 * dprc_reset_container - Reset child container.
191 * @mc_io: Pointer to MC portal's I/O object
192 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
193 * @token: Token of DPRC object
194 * @child_container_id: ID of the container to reset
196 * In case a software context crashes or becomes non-responsive, the parent
197 * may wish to reset its resources container before the software context is
200 * This routine informs all objects assigned to the child container that the
201 * container is being reset, so they may perform any cleanup operations that are
202 * needed. All objects handles that were owned by the child container shall be
205 * Note that such request may be submitted even if the child software context
206 * has not crashed, but the resulting object cleanup operations will not be
209 * Return: '0' on Success; Error code otherwise.
211 int dprc_reset_container(struct fsl_mc_io *mc_io,
214 int child_container_id)
216 struct mc_command cmd = { 0 };
217 struct dprc_cmd_reset_container *cmd_params;
219 /* prepare command */
220 cmd.header = mc_encode_cmd_header(DPRC_CMDID_RESET_CONT,
222 cmd_params = (struct dprc_cmd_reset_container *)cmd.params;
223 cmd_params->child_container_id = cpu_to_le32(child_container_id);
225 /* send command to mc*/
226 return mc_send_command(mc_io, &cmd);
230 * dprc_get_irq() - Get IRQ information from the DPRC.
231 * @mc_io: Pointer to MC portal's I/O object
232 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
233 * @token: Token of DPRC object
234 * @irq_index: The interrupt index to configure
235 * @type: Interrupt type: 0 represents message interrupt
236 * type (both irq_addr and irq_val are valid)
237 * @irq_cfg: IRQ attributes
239 * Return: '0' on Success; Error code otherwise.
241 int dprc_get_irq(struct fsl_mc_io *mc_io,
246 struct dprc_irq_cfg *irq_cfg)
248 struct mc_command cmd = { 0 };
249 struct dprc_cmd_get_irq *cmd_params;
250 struct dprc_rsp_get_irq *rsp_params;
253 /* prepare command */
254 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ,
257 cmd_params = (struct dprc_cmd_get_irq *)cmd.params;
258 cmd_params->irq_index = irq_index;
260 /* send command to mc*/
261 err = mc_send_command(mc_io, &cmd);
265 /* retrieve response parameters */
266 rsp_params = (struct dprc_rsp_get_irq *)cmd.params;
267 irq_cfg->val = le32_to_cpu(rsp_params->irq_val);
268 irq_cfg->paddr = le64_to_cpu(rsp_params->irq_addr);
269 irq_cfg->irq_num = le32_to_cpu(rsp_params->irq_num);
270 *type = le32_to_cpu(rsp_params->type);
276 * dprc_set_irq() - Set IRQ information for the DPRC to trigger an interrupt.
277 * @mc_io: Pointer to MC portal's I/O object
278 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
279 * @token: Token of DPRC object
280 * @irq_index: Identifies the interrupt index to configure
281 * @irq_cfg: IRQ configuration
283 * Return: '0' on Success; Error code otherwise.
285 int dprc_set_irq(struct fsl_mc_io *mc_io,
289 struct dprc_irq_cfg *irq_cfg)
291 struct mc_command cmd = { 0 };
292 struct dprc_cmd_set_irq *cmd_params;
294 /* prepare command */
295 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ,
298 cmd_params = (struct dprc_cmd_set_irq *)cmd.params;
299 cmd_params->irq_val = cpu_to_le32(irq_cfg->val);
300 cmd_params->irq_index = irq_index;
301 cmd_params->irq_addr = cpu_to_le64(irq_cfg->paddr);
302 cmd_params->irq_num = cpu_to_le32(irq_cfg->irq_num);
304 /* send command to mc*/
305 return mc_send_command(mc_io, &cmd);
309 * dprc_get_irq_enable() - Get overall interrupt state.
310 * @mc_io: Pointer to MC portal's I/O object
311 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
312 * @token: Token of DPRC object
313 * @irq_index: The interrupt index to configure
314 * @en: Returned interrupt state - enable = 1, disable = 0
316 * Return: '0' on Success; Error code otherwise.
318 int dprc_get_irq_enable(struct fsl_mc_io *mc_io,
324 struct mc_command cmd = { 0 };
325 struct dprc_cmd_get_irq_enable *cmd_params;
326 struct dprc_rsp_get_irq_enable *rsp_params;
329 /* prepare command */
330 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_ENABLE,
332 cmd_params = (struct dprc_cmd_get_irq_enable *)cmd.params;
333 cmd_params->irq_index = irq_index;
335 /* send command to mc*/
336 err = mc_send_command(mc_io, &cmd);
340 /* retrieve response parameters */
341 rsp_params = (struct dprc_rsp_get_irq_enable *)cmd.params;
342 *en = rsp_params->enabled & DPRC_ENABLE;
348 * dprc_set_irq_enable() - Set overall interrupt state.
349 * @mc_io: Pointer to MC portal's I/O object
350 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
351 * @token: Token of DPRC object
352 * @irq_index: The interrupt index to configure
353 * @en: Interrupt state - enable = 1, disable = 0
355 * Allows GPP software to control when interrupts are generated.
356 * Each interrupt can have up to 32 causes. The enable/disable control's the
357 * overall interrupt state. if the interrupt is disabled no causes will cause
360 * Return: '0' on Success; Error code otherwise.
362 int dprc_set_irq_enable(struct fsl_mc_io *mc_io,
368 struct mc_command cmd = { 0 };
369 struct dprc_cmd_set_irq_enable *cmd_params;
371 /* prepare command */
372 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ_ENABLE,
374 cmd_params = (struct dprc_cmd_set_irq_enable *)cmd.params;
375 cmd_params->enable = en & DPRC_ENABLE;
376 cmd_params->irq_index = irq_index;
378 /* send command to mc*/
379 return mc_send_command(mc_io, &cmd);
383 * dprc_get_irq_mask() - Get interrupt mask.
384 * @mc_io: Pointer to MC portal's I/O object
385 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
386 * @token: Token of DPRC object
387 * @irq_index: The interrupt index to configure
388 * @mask: Returned event mask to trigger interrupt
390 * Every interrupt can have up to 32 causes and the interrupt model supports
391 * masking/unmasking each cause independently
393 * Return: '0' on Success; Error code otherwise.
395 int dprc_get_irq_mask(struct fsl_mc_io *mc_io,
401 struct mc_command cmd = { 0 };
402 struct dprc_cmd_get_irq_mask *cmd_params;
403 struct dprc_rsp_get_irq_mask *rsp_params;
406 /* prepare command */
407 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_MASK,
409 cmd_params = (struct dprc_cmd_get_irq_mask *)cmd.params;
410 cmd_params->irq_index = irq_index;
412 /* send command to mc*/
413 err = mc_send_command(mc_io, &cmd);
417 /* retrieve response parameters */
418 rsp_params = (struct dprc_rsp_get_irq_mask *)cmd.params;
419 *mask = le32_to_cpu(rsp_params->mask);
425 * dprc_set_irq_mask() - Set interrupt mask.
426 * @mc_io: Pointer to MC portal's I/O object
427 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
428 * @token: Token of DPRC object
429 * @irq_index: The interrupt index to configure
430 * @mask: event mask to trigger interrupt;
433 * 1 = consider event for asserting irq
435 * Every interrupt can have up to 32 causes and the interrupt model supports
436 * masking/unmasking each cause independently
438 * Return: '0' on Success; Error code otherwise.
440 int dprc_set_irq_mask(struct fsl_mc_io *mc_io,
446 struct mc_command cmd = { 0 };
447 struct dprc_cmd_set_irq_mask *cmd_params;
449 /* prepare command */
450 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ_MASK,
452 cmd_params = (struct dprc_cmd_set_irq_mask *)cmd.params;
453 cmd_params->mask = cpu_to_le32(mask);
454 cmd_params->irq_index = irq_index;
456 /* send command to mc*/
457 return mc_send_command(mc_io, &cmd);
461 * dprc_get_irq_status() - Get the current status of any pending interrupts.
462 * @mc_io: Pointer to MC portal's I/O object
463 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
464 * @token: Token of DPRC object
465 * @irq_index: The interrupt index to configure
466 * @status: Returned interrupts status - one bit per cause:
467 * 0 = no interrupt pending
468 * 1 = interrupt pending
470 * Return: '0' on Success; Error code otherwise.
472 int dprc_get_irq_status(struct fsl_mc_io *mc_io,
478 struct mc_command cmd = { 0 };
479 struct dprc_cmd_get_irq_status *cmd_params;
480 struct dprc_rsp_get_irq_status *rsp_params;
483 /* prepare command */
484 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_STATUS,
486 cmd_params = (struct dprc_cmd_get_irq_status *)cmd.params;
487 cmd_params->status = cpu_to_le32(*status);
488 cmd_params->irq_index = irq_index;
490 /* send command to mc*/
491 err = mc_send_command(mc_io, &cmd);
495 /* retrieve response parameters */
496 rsp_params = (struct dprc_rsp_get_irq_status *)cmd.params;
497 *status = le32_to_cpu(rsp_params->status);
503 * dprc_clear_irq_status() - Clear a pending interrupt's status
504 * @mc_io: Pointer to MC portal's I/O object
505 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
506 * @token: Token of DPRC object
507 * @irq_index: The interrupt index to configure
508 * @status: bits to clear (W1C) - one bit per cause:
510 * 1 = clear status bit
512 * Return: '0' on Success; Error code otherwise.
514 int dprc_clear_irq_status(struct fsl_mc_io *mc_io,
520 struct mc_command cmd = { 0 };
521 struct dprc_cmd_clear_irq_status *cmd_params;
523 /* prepare command */
524 cmd.header = mc_encode_cmd_header(DPRC_CMDID_CLEAR_IRQ_STATUS,
526 cmd_params = (struct dprc_cmd_clear_irq_status *)cmd.params;
527 cmd_params->status = cpu_to_le32(status);
528 cmd_params->irq_index = irq_index;
530 /* send command to mc*/
531 return mc_send_command(mc_io, &cmd);
535 * dprc_get_attributes() - Obtains container attributes
536 * @mc_io: Pointer to MC portal's I/O object
537 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
538 * @token: Token of DPRC object
539 * @attributes Returned container attributes
541 * Return: '0' on Success; Error code otherwise.
543 int dprc_get_attributes(struct fsl_mc_io *mc_io,
546 struct dprc_attributes *attr)
548 struct mc_command cmd = { 0 };
549 struct dprc_rsp_get_attributes *rsp_params;
552 /* prepare command */
553 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_ATTR,
557 /* send command to mc*/
558 err = mc_send_command(mc_io, &cmd);
562 /* retrieve response parameters */
563 rsp_params = (struct dprc_rsp_get_attributes *)cmd.params;
564 attr->container_id = le32_to_cpu(rsp_params->container_id);
565 attr->icid = le16_to_cpu(rsp_params->icid);
566 attr->options = le32_to_cpu(rsp_params->options);
567 attr->portal_id = le32_to_cpu(rsp_params->portal_id);
573 * dprc_set_res_quota() - Set allocation policy for a specific resource/object
574 * type in a child container
575 * @mc_io: Pointer to MC portal's I/O object
576 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
577 * @token: Token of DPRC object
578 * @child_container_id: ID of the child container
579 * @type: Resource/object type
580 * @quota: Sets the maximum number of resources of the selected type
581 * that the child container is allowed to allocate from its parent;
582 * when quota is set to -1, the policy is the same as container's
585 * Allocation policy determines whether or not a container may allocate
586 * resources from its parent. Each container has a 'global' allocation policy
587 * that is set when the container is created.
589 * This function sets allocation policy for a specific resource type.
590 * The default policy for all resource types matches the container's 'global'
593 * Return: '0' on Success; Error code otherwise.
595 * @warning Only the parent container is allowed to change a child policy.
597 int dprc_set_res_quota(struct fsl_mc_io *mc_io,
600 int child_container_id,
604 struct mc_command cmd = { 0 };
605 struct dprc_cmd_set_res_quota *cmd_params;
607 /* prepare command */
608 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_RES_QUOTA,
610 cmd_params = (struct dprc_cmd_set_res_quota *)cmd.params;
611 cmd_params->child_container_id = cpu_to_le32(child_container_id);
612 cmd_params->quota = cpu_to_le16(quota);
613 strncpy(cmd_params->type, type, 16);
614 cmd_params->type[15] = '\0';
616 /* send command to mc*/
617 return mc_send_command(mc_io, &cmd);
621 * dprc_get_res_quota() - Gets the allocation policy of a specific
622 * resource/object type in a child container
623 * @mc_io: Pointer to MC portal's I/O object
624 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
625 * @token: Token of DPRC object
626 * @child_container_id; ID of the child container
627 * @type: resource/object type
628 * @quota: Returnes the maximum number of resources of the selected type
629 * that the child container is allowed to allocate from the parent;
630 * when quota is set to -1, the policy is the same as container's
633 * Return: '0' on Success; Error code otherwise.
635 int dprc_get_res_quota(struct fsl_mc_io *mc_io,
638 int child_container_id,
642 struct mc_command cmd = { 0 };
643 struct dprc_cmd_get_res_quota *cmd_params;
644 struct dprc_rsp_get_res_quota *rsp_params;
647 /* prepare command */
648 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_QUOTA,
650 cmd_params = (struct dprc_cmd_get_res_quota *)cmd.params;
651 cmd_params->child_container_id = cpu_to_le32(child_container_id);
652 strncpy(cmd_params->type, type, 16);
653 cmd_params->type[15] = '\0';
655 /* send command to mc*/
656 err = mc_send_command(mc_io, &cmd);
660 /* retrieve response parameters */
661 rsp_params = (struct dprc_rsp_get_res_quota *)cmd.params;
662 *quota = le16_to_cpu(rsp_params->quota);
668 * dprc_assign() - Assigns objects or resource to a child container.
669 * @mc_io: Pointer to MC portal's I/O object
670 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
671 * @token: Token of DPRC object
672 * @container_id: ID of the child container
673 * @res_req: Describes the type and amount of resources to
674 * assign to the given container
676 * Assignment is usually done by a parent (this DPRC) to one of its child
679 * According to the DPRC allocation policy, the assigned resources may be taken
680 * (allocated) from the container's ancestors, if not enough resources are
681 * available in the container itself.
683 * The type of assignment depends on the dprc_res_req options, as follows:
684 * - DPRC_RES_REQ_OPT_EXPLICIT: indicates that assigned resources should have
685 * the explicit base ID specified at the id_base_align field of res_req.
686 * - DPRC_RES_REQ_OPT_ALIGNED: indicates that the assigned resources should be
687 * aligned to the value given at id_base_align field of res_req.
688 * - DPRC_RES_REQ_OPT_PLUGGED: Relevant only for object assignment,
689 * and indicates that the object must be set to the plugged state.
691 * A container may use this function with its own ID in order to change a
692 * object state to plugged or unplugged.
694 * If IRQ information has been set in the child DPRC, it will signal an
695 * interrupt following every change in its object assignment.
697 * Return: '0' on Success; Error code otherwise.
699 int dprc_assign(struct fsl_mc_io *mc_io,
703 struct dprc_res_req *res_req)
705 struct mc_command cmd = { 0 };
706 struct dprc_cmd_assign *cmd_params;
708 /* prepare command */
709 cmd.header = mc_encode_cmd_header(DPRC_CMDID_ASSIGN,
711 cmd_params = (struct dprc_cmd_assign *)cmd.params;
712 cmd_params->container_id = cpu_to_le32(container_id);
713 cmd_params->options = cpu_to_le32(res_req->options);
714 cmd_params->num = cpu_to_le32(res_req->num);
715 cmd_params->id_base_align = cpu_to_le32(res_req->id_base_align);
716 strncpy(cmd_params->type, res_req->type, 16);
717 cmd_params->type[15] = '\0';
719 /* send command to mc*/
720 return mc_send_command(mc_io, &cmd);
724 * dprc_unassign() - Un-assigns objects or resources from a child container
725 * and moves them into this (parent) DPRC.
726 * @mc_io: Pointer to MC portal's I/O object
727 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
728 * @token: Token of DPRC object
729 * @child_container_id: ID of the child container
730 * @res_req: Describes the type and amount of resources to un-assign from
731 * the child container
733 * Un-assignment of objects can succeed only if the object is not in the
734 * plugged or opened state.
736 * Return: '0' on Success; Error code otherwise.
738 int dprc_unassign(struct fsl_mc_io *mc_io,
741 int child_container_id,
742 struct dprc_res_req *res_req)
744 struct mc_command cmd = { 0 };
745 struct dprc_cmd_unassign *cmd_params;
747 /* prepare command */
748 cmd.header = mc_encode_cmd_header(DPRC_CMDID_UNASSIGN,
751 cmd_params = (struct dprc_cmd_unassign *)cmd.params;
752 cmd_params->child_container_id = cpu_to_le32(child_container_id);
753 cmd_params->options = cpu_to_le32(res_req->options);
754 cmd_params->num = cpu_to_le32(res_req->num);
755 cmd_params->id_base_align = cpu_to_le32(res_req->id_base_align);
756 strncpy(cmd_params->type, res_req->type, 16);
757 cmd_params->type[15] = '\0';
759 /* send command to mc*/
760 return mc_send_command(mc_io, &cmd);
764 * dprc_get_pool_count() - Get the number of dprc's pools
765 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
766 * @mc_io: Pointer to MC portal's I/O object
767 * @token: Token of DPRC object
768 * @pool_count: Returned number of resource pools in the dprc
770 * Return: '0' on Success; Error code otherwise.
772 int dprc_get_pool_count(struct fsl_mc_io *mc_io,
777 struct mc_command cmd = { 0 };
778 struct dprc_rsp_get_pool_count *rsp_params;
781 /* prepare command */
782 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_POOL_COUNT,
785 /* send command to mc*/
786 err = mc_send_command(mc_io, &cmd);
790 /* retrieve response parameters */
791 rsp_params = (struct dprc_rsp_get_pool_count *)cmd.params;
792 *pool_count = le32_to_cpu(rsp_params->pool_count);
798 * dprc_get_pool() - Get the type (string) of a certain dprc's pool
799 * @mc_io: Pointer to MC portal's I/O object
800 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
801 * @token: Token of DPRC object
802 * @pool_index; Index of the pool to be queried (< pool_count)
803 * @type: The type of the pool
805 * The pool types retrieved one by one by incrementing
806 * pool_index up to (not including) the value of pool_count returned
807 * from dprc_get_pool_count(). dprc_get_pool_count() must
808 * be called prior to dprc_get_pool().
810 * Return: '0' on Success; Error code otherwise.
812 int dprc_get_pool(struct fsl_mc_io *mc_io,
818 struct mc_command cmd = { 0 };
819 struct dprc_cmd_get_pool *cmd_params;
820 struct dprc_rsp_get_pool *rsp_params;
823 /* prepare command */
824 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_POOL,
827 cmd_params = (struct dprc_cmd_get_pool *)cmd.params;
828 cmd_params->pool_index = cpu_to_le32(pool_index);
830 /* send command to mc*/
831 err = mc_send_command(mc_io, &cmd);
835 /* retrieve response parameters */
836 rsp_params = (struct dprc_rsp_get_pool *)cmd.params;
837 strncpy(type, rsp_params->type, 16);
844 * dprc_get_obj_count() - Obtains the number of objects in the DPRC
845 * @mc_io: Pointer to MC portal's I/O object
846 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
847 * @token: Token of DPRC object
848 * @obj_count: Number of objects assigned to the DPRC
850 * Return: '0' on Success; Error code otherwise.
852 int dprc_get_obj_count(struct fsl_mc_io *mc_io,
857 struct mc_command cmd = { 0 };
858 struct dprc_rsp_get_obj_count *rsp_params;
861 /* prepare command */
862 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_COUNT,
865 /* send command to mc*/
866 err = mc_send_command(mc_io, &cmd);
870 /* retrieve response parameters */
871 rsp_params = (struct dprc_rsp_get_obj_count *)cmd.params;
872 *obj_count = le32_to_cpu(rsp_params->obj_count);
876 EXPORT_SYMBOL(dprc_get_obj_count);
879 * dprc_get_obj() - Get general information on an object
880 * @mc_io: Pointer to MC portal's I/O object
881 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
882 * @token: Token of DPRC object
883 * @obj_index: Index of the object to be queried (< obj_count)
884 * @obj_desc: Returns the requested object descriptor
886 * The object descriptors are retrieved one by one by incrementing
887 * obj_index up to (not including) the value of obj_count returned
888 * from dprc_get_obj_count(). dprc_get_obj_count() must
889 * be called prior to dprc_get_obj().
891 * Return: '0' on Success; Error code otherwise.
893 int dprc_get_obj(struct fsl_mc_io *mc_io,
897 struct dprc_obj_desc *obj_desc)
899 struct mc_command cmd = { 0 };
900 struct dprc_cmd_get_obj *cmd_params;
901 struct dprc_rsp_get_obj *rsp_params;
904 /* prepare command */
905 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ,
908 cmd_params = (struct dprc_cmd_get_obj *)cmd.params;
909 cmd_params->obj_index = cpu_to_le32(obj_index);
911 /* send command to mc*/
912 err = mc_send_command(mc_io, &cmd);
916 /* retrieve response parameters */
917 rsp_params = (struct dprc_rsp_get_obj *)cmd.params;
918 obj_desc->id = le32_to_cpu(rsp_params->id);
919 obj_desc->vendor = le16_to_cpu(rsp_params->vendor);
920 obj_desc->irq_count = rsp_params->irq_count;
921 obj_desc->region_count = rsp_params->region_count;
922 obj_desc->state = le32_to_cpu(rsp_params->state);
923 obj_desc->ver_major = le16_to_cpu(rsp_params->version_major);
924 obj_desc->ver_minor = le16_to_cpu(rsp_params->version_minor);
925 obj_desc->flags = le16_to_cpu(rsp_params->flags);
926 strncpy(obj_desc->type, rsp_params->type, 16);
927 obj_desc->type[15] = '\0';
928 strncpy(obj_desc->label, rsp_params->label, 16);
929 obj_desc->label[15] = '\0';
932 EXPORT_SYMBOL(dprc_get_obj);
935 * dprc_get_obj_desc() - Get object descriptor.
937 * @mc_io: Pointer to MC portal's I/O object
938 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
939 * @token: Token of DPRC object
940 * @obj_type: The type of the object to get its descriptor.
941 * @obj_id: The id of the object to get its descriptor
942 * @obj_desc: The returned descriptor to fill and return to the user
944 * Return: '0' on Success; Error code otherwise.
947 int dprc_get_obj_desc(struct fsl_mc_io *mc_io,
952 struct dprc_obj_desc *obj_desc)
954 struct mc_command cmd = { 0 };
955 struct dprc_cmd_get_obj_desc *cmd_params;
956 struct dprc_rsp_get_obj_desc *rsp_params;
959 /* prepare command */
960 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_DESC,
963 cmd_params = (struct dprc_cmd_get_obj_desc *)cmd.params;
964 cmd_params->obj_id = cpu_to_le32(obj_id);
965 strncpy(cmd_params->type, obj_type, 16);
966 cmd_params->type[15] = '\0';
968 /* send command to mc*/
969 err = mc_send_command(mc_io, &cmd);
973 /* retrieve response parameters */
974 rsp_params = (struct dprc_rsp_get_obj_desc *)cmd.params;
975 obj_desc->id = le32_to_cpu(rsp_params->id);
976 obj_desc->vendor = le16_to_cpu(rsp_params->vendor);
977 obj_desc->irq_count = rsp_params->irq_count;
978 obj_desc->region_count = rsp_params->region_count;
979 obj_desc->state = le32_to_cpu(rsp_params->state);
980 obj_desc->ver_major = le16_to_cpu(rsp_params->version_major);
981 obj_desc->ver_minor = le16_to_cpu(rsp_params->version_minor);
982 obj_desc->flags = le16_to_cpu(rsp_params->flags);
983 strncpy(obj_desc->type, rsp_params->type, 16);
984 obj_desc->type[15] = '\0';
985 strncpy(obj_desc->label, rsp_params->label, 16);
986 obj_desc->label[15] = '\0';
990 EXPORT_SYMBOL(dprc_get_obj_desc);
993 * dprc_set_obj_irq() - Set IRQ information for object to trigger an interrupt.
994 * @mc_io: Pointer to MC portal's I/O object
995 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
996 * @token: Token of DPRC object
997 * @obj_type: Type of the object to set its IRQ
998 * @obj_id: ID of the object to set its IRQ
999 * @irq_index: The interrupt index to configure
1000 * @irq_cfg: IRQ configuration
1002 * Return: '0' on Success; Error code otherwise.
1004 int dprc_set_obj_irq(struct fsl_mc_io *mc_io,
1010 struct dprc_irq_cfg *irq_cfg)
1012 struct mc_command cmd = { 0 };
1013 struct dprc_cmd_set_obj_irq *cmd_params;
1015 /* prepare command */
1016 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_OBJ_IRQ,
1019 cmd_params = (struct dprc_cmd_set_obj_irq *)cmd.params;
1020 cmd_params->irq_val = cpu_to_le32(irq_cfg->val);
1021 cmd_params->irq_index = irq_index;
1022 cmd_params->irq_addr = cpu_to_le64(irq_cfg->paddr);
1023 cmd_params->irq_num = cpu_to_le32(irq_cfg->irq_num);
1024 cmd_params->obj_id = cpu_to_le32(obj_id);
1025 strncpy(cmd_params->obj_type, obj_type, 16);
1026 cmd_params->obj_type[15] = '\0';
1028 /* send command to mc*/
1029 return mc_send_command(mc_io, &cmd);
1031 EXPORT_SYMBOL(dprc_set_obj_irq);
1034 * dprc_get_obj_irq() - Get IRQ information from object.
1035 * @mc_io: Pointer to MC portal's I/O object
1036 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1037 * @token: Token of DPRC object
1038 * @obj_type: Type od the object to get its IRQ
1039 * @obj_id: ID of the object to get its IRQ
1040 * @irq_index: The interrupt index to configure
1041 * @type: Interrupt type: 0 represents message interrupt
1042 * type (both irq_addr and irq_val are valid)
1043 * @irq_cfg: The returned IRQ attributes
1045 * Return: '0' on Success; Error code otherwise.
1047 int dprc_get_obj_irq(struct fsl_mc_io *mc_io,
1054 struct dprc_irq_cfg *irq_cfg)
1056 struct mc_command cmd = { 0 };
1057 struct dprc_cmd_get_obj_irq *cmd_params;
1058 struct dprc_rsp_get_obj_irq *rsp_params;
1061 /* prepare command */
1062 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_IRQ,
1065 cmd_params = (struct dprc_cmd_get_obj_irq *)cmd.params;
1066 cmd_params->obj_id = cpu_to_le32(obj_id);
1067 cmd_params->irq_index = irq_index;
1068 strncpy(cmd_params->obj_type, obj_type, 16);
1069 cmd_params->obj_type[15] = '\0';
1071 /* send command to mc*/
1072 err = mc_send_command(mc_io, &cmd);
1076 /* retrieve response parameters */
1077 rsp_params = (struct dprc_rsp_get_obj_irq *)cmd.params;
1078 irq_cfg->val = le32_to_cpu(rsp_params->irq_val);
1079 irq_cfg->paddr = le64_to_cpu(rsp_params->irq_addr);
1080 irq_cfg->irq_num = le32_to_cpu(rsp_params->irq_num);
1081 *type = le32_to_cpu(rsp_params->type);
1085 EXPORT_SYMBOL(dprc_get_obj_irq);
1088 * dprc_get_res_count() - Obtains the number of free resources that are assigned
1089 * to this container, by pool type
1090 * @mc_io: Pointer to MC portal's I/O object
1091 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1092 * @token: Token of DPRC object
1094 * @res_count: Returned number of free resources of the given
1095 * resource type that are assigned to this DPRC
1097 * Return: '0' on Success; Error code otherwise.
1099 int dprc_get_res_count(struct fsl_mc_io *mc_io,
1105 struct mc_command cmd = { 0 };
1106 struct dprc_cmd_get_res_count *cmd_params;
1107 struct dprc_rsp_get_res_count *rsp_params;
1110 /* prepare command */
1111 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_COUNT,
1113 cmd_params = (struct dprc_cmd_get_res_count *)cmd.params;
1114 strncpy(cmd_params->type, type, 16);
1115 cmd_params->type[15] = '\0';
1117 /* send command to mc*/
1118 err = mc_send_command(mc_io, &cmd);
1122 /* retrieve response parameters */
1123 rsp_params = (struct dprc_rsp_get_res_count *)cmd.params;
1124 *res_count = le32_to_cpu(rsp_params->res_count);
1128 EXPORT_SYMBOL(dprc_get_res_count);
1131 * dprc_get_res_ids() - Obtains IDs of free resources in the container
1132 * @mc_io: Pointer to MC portal's I/O object
1133 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1134 * @token: Token of DPRC object
1136 * @range_desc: range descriptor
1138 * Return: '0' on Success; Error code otherwise.
1140 int dprc_get_res_ids(struct fsl_mc_io *mc_io,
1144 struct dprc_res_ids_range_desc *range_desc)
1146 struct mc_command cmd = { 0 };
1147 struct dprc_cmd_get_res_ids *cmd_params;
1148 struct dprc_rsp_get_res_ids *rsp_params;
1151 /* prepare command */
1152 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_IDS,
1154 cmd_params = (struct dprc_cmd_get_res_ids *)cmd.params;
1155 cmd_params->iter_status = range_desc->iter_status;
1156 cmd_params->base_id = cpu_to_le32(range_desc->base_id);
1157 cmd_params->last_id = cpu_to_le32(range_desc->last_id);
1158 strncpy(cmd_params->type, type, 16);
1159 cmd_params->type[15] = '\0';
1161 /* send command to mc*/
1162 err = mc_send_command(mc_io, &cmd);
1166 /* retrieve response parameters */
1167 rsp_params = (struct dprc_rsp_get_res_ids *)cmd.params;
1168 range_desc->iter_status = rsp_params->iter_status;
1169 range_desc->base_id = le32_to_cpu(rsp_params->base_id);
1170 range_desc->last_id = le32_to_cpu(rsp_params->last_id);
1174 EXPORT_SYMBOL(dprc_get_res_ids);
1177 * dprc_get_obj_region() - Get region information for a specified object.
1178 * @mc_io: Pointer to MC portal's I/O object
1179 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1180 * @token: Token of DPRC object
1181 * @obj_type; Object type as returned in dprc_get_obj()
1182 * @obj_id: Unique object instance as returned in dprc_get_obj()
1183 * @region_index: The specific region to query
1184 * @region_desc: Returns the requested region descriptor
1186 * Return: '0' on Success; Error code otherwise.
1188 int dprc_get_obj_region(struct fsl_mc_io *mc_io,
1194 struct dprc_region_desc *region_desc)
1196 struct mc_command cmd = { 0 };
1197 struct dprc_cmd_get_obj_region *cmd_params;
1198 struct dprc_rsp_get_obj_region *rsp_params;
1201 /* prepare command */
1202 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_REG,
1204 cmd_params = (struct dprc_cmd_get_obj_region *)cmd.params;
1205 cmd_params->obj_id = cpu_to_le32(obj_id);
1206 cmd_params->region_index = region_index;
1207 strncpy(cmd_params->obj_type, obj_type, 16);
1208 cmd_params->obj_type[15] = '\0';
1210 /* send command to mc*/
1211 err = mc_send_command(mc_io, &cmd);
1215 /* retrieve response parameters */
1216 rsp_params = (struct dprc_rsp_get_obj_region *)cmd.params;
1217 region_desc->base_offset = le64_to_cpu(rsp_params->base_addr);
1218 region_desc->size = le32_to_cpu(rsp_params->size);
1222 EXPORT_SYMBOL(dprc_get_obj_region);
1225 * dprc_set_obj_label() - Set object label.
1226 * @mc_io: Pointer to MC portal's I/O object
1227 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1228 * @token: Token of DPRC object
1229 * @obj_type: Object's type
1230 * @obj_id: Object's ID
1231 * @label: The required label. The maximum length is 16 chars.
1233 * Return: '0' on Success; Error code otherwise.
1235 int dprc_set_obj_label(struct fsl_mc_io *mc_io,
1242 struct mc_command cmd = { 0 };
1243 struct dprc_cmd_set_obj_label *cmd_params;
1245 /* prepare command */
1246 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_OBJ_LABEL,
1249 cmd_params = (struct dprc_cmd_set_obj_label *)cmd.params;
1250 cmd_params->obj_id = cpu_to_le32(obj_id);
1251 strncpy(cmd_params->label, label, 16);
1252 cmd_params->label[15] = '\0';
1253 strncpy(cmd_params->obj_type, obj_type, 16);
1254 cmd_params->obj_type[15] = '\0';
1256 /* send command to mc*/
1257 return mc_send_command(mc_io, &cmd);
1259 EXPORT_SYMBOL(dprc_set_obj_label);
1262 * dprc_connect() - Connect two endpoints to create a network link between them
1263 * @mc_io: Pointer to MC portal's I/O object
1264 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1265 * @token: Token of DPRC object
1266 * @endpoint1: Endpoint 1 configuration parameters
1267 * @endpoint2: Endpoint 2 configuration parameters
1268 * @cfg: Connection configuration. The connection configuration is ignored for
1269 * connections made to DPMAC objects, where rate is retrieved from the
1270 * MAC configuration.
1272 * Return: '0' on Success; Error code otherwise.
1274 int dprc_connect(struct fsl_mc_io *mc_io,
1277 const struct dprc_endpoint *endpoint1,
1278 const struct dprc_endpoint *endpoint2,
1279 const struct dprc_connection_cfg *cfg)
1281 struct mc_command cmd = { 0 };
1282 struct dprc_cmd_connect *cmd_params;
1284 /* prepare command */
1285 cmd.header = mc_encode_cmd_header(DPRC_CMDID_CONNECT,
1288 cmd_params = (struct dprc_cmd_connect *)cmd.params;
1289 cmd_params->ep1_id = cpu_to_le32(endpoint1->id);
1290 cmd_params->ep1_interface_id = cpu_to_le32(endpoint1->if_id);
1291 cmd_params->ep2_id = cpu_to_le32(endpoint2->id);
1292 cmd_params->ep2_interface_id = cpu_to_le32(endpoint2->if_id);
1293 strncpy(cmd_params->ep1_type, endpoint1->type, 16);
1294 cmd_params->ep1_type[15] = '\0';
1295 cmd_params->max_rate = cpu_to_le32(cfg->max_rate);
1296 cmd_params->committed_rate = cpu_to_le32(cfg->committed_rate);
1297 strncpy(cmd_params->ep2_type, endpoint2->type, 16);
1298 cmd_params->ep2_type[15] = '\0';
1300 /* send command to mc*/
1301 return mc_send_command(mc_io, &cmd);
1305 * dprc_disconnect() - Disconnect one endpoint to remove its network connection
1306 * @mc_io: Pointer to MC portal's I/O object
1307 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1308 * @token: Token of DPRC object
1309 * @endpoint: Endpoint configuration parameters
1311 * Return: '0' on Success; Error code otherwise.
1313 int dprc_disconnect(struct fsl_mc_io *mc_io,
1316 const struct dprc_endpoint *endpoint)
1318 struct mc_command cmd = { 0 };
1319 struct dprc_cmd_disconnect *cmd_params;
1321 /* prepare command */
1322 cmd.header = mc_encode_cmd_header(DPRC_CMDID_DISCONNECT,
1325 cmd_params = (struct dprc_cmd_disconnect *)cmd.params;
1326 cmd_params->id = cpu_to_le32(endpoint->id);
1327 cmd_params->interface_id = cpu_to_le32(endpoint->if_id);
1328 strncpy(cmd_params->type, endpoint->type, 16);
1329 cmd_params->type[15] = '\0';
1331 /* send command to mc*/
1332 return mc_send_command(mc_io, &cmd);
1336 * dprc_get_connection() - Get connected endpoint and link status if connection
1338 * @mc_io: Pointer to MC portal's I/O object
1339 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1340 * @token: Token of DPRC object
1341 * @endpoint1: Endpoint 1 configuration parameters
1342 * @endpoint2: Returned endpoint 2 configuration parameters
1343 * @state: Returned link state:
1346 * -1 - no connection (endpoint2 information is irrelevant)
1348 * Return: '0' on Success; -ENAVAIL if connection does not exist.
1350 int dprc_get_connection(struct fsl_mc_io *mc_io,
1353 const struct dprc_endpoint *endpoint1,
1354 struct dprc_endpoint *endpoint2,
1357 struct mc_command cmd = { 0 };
1358 struct dprc_cmd_get_connection *cmd_params;
1359 struct dprc_rsp_get_connection *rsp_params;
1362 /* prepare command */
1363 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_CONNECTION,
1366 cmd_params = (struct dprc_cmd_get_connection *)cmd.params;
1367 cmd_params->ep1_id = cpu_to_le32(endpoint1->id);
1368 cmd_params->ep1_interface_id = cpu_to_le32(endpoint1->if_id);
1369 strncpy(cmd_params->ep1_type, endpoint1->type, 16);
1370 cmd_params->ep1_type[15] = '\0';
1372 /* send command to mc*/
1373 err = mc_send_command(mc_io, &cmd);
1377 /* retrieve response parameters */
1378 rsp_params = (struct dprc_rsp_get_connection *)cmd.params;
1379 endpoint2->id = le32_to_cpu(rsp_params->ep2_id);
1380 endpoint2->if_id = le32_to_cpu(rsp_params->ep2_interface_id);
1381 strncpy(endpoint2->type, rsp_params->ep2_type, 16);
1382 endpoint2->type[15] = '\0';
1383 *state = le32_to_cpu(rsp_params->state);
1389 * dprc_get_api_version - Get Data Path Resource Container API version
1390 * @mc_io: Pointer to Mc portal's I/O object
1391 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1392 * @major_ver: Major version of Data Path Resource Container API
1393 * @minor_ver: Minor version of Data Path Resource Container API
1395 * Return: '0' on Success; Error code otherwise.
1397 int dprc_get_api_version(struct fsl_mc_io *mc_io,
1402 struct mc_command cmd = { 0 };
1405 /* prepare command */
1406 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_API_VERSION,
1409 /* send command to mc */
1410 err = mc_send_command(mc_io, &cmd);
1414 /* retrieve response parameters */
1415 mc_cmd_read_api_version(&cmd, major_ver, minor_ver);
1421 * dprc_get_container_id - Get container ID associated with a given portal.
1422 * @mc_io: Pointer to Mc portal's I/O object
1423 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1424 * @container_id: Requested container id
1426 * Return: '0' on Success; Error code otherwise.
1428 int dprc_get_container_id(struct fsl_mc_io *mc_io,
1432 struct mc_command cmd = { 0 };
1435 /* prepare command */
1436 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_CONT_ID,
1440 /* send command to mc*/
1441 err = mc_send_command(mc_io, &cmd);
1445 /* retrieve response parameters */
1446 *container_id = (int)mc_cmd_read_object_id(&cmd);