1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Freescale Management Complex (MC) bus private declarations
4  *
5  * Copyright (C) 2016 Freescale Semiconductor, Inc.
6  *
7  */
8 #ifndef _FSL_MC_PRIVATE_H_
9 #define _FSL_MC_PRIVATE_H_
10 
11 #include <linux/fsl/mc.h>
12 #include <linux/mutex.h>
13 #include <linux/ioctl.h>
14 #include <linux/miscdevice.h>
15 
16 /*
17  * Data Path Management Complex (DPMNG) General API
18  */
19 
20 /* DPMNG command versioning */
21 #define DPMNG_CMD_BASE_VERSION		1
22 #define DPMNG_CMD_ID_OFFSET		4
23 
24 #define DPMNG_CMD(id)	(((id) << DPMNG_CMD_ID_OFFSET) | DPMNG_CMD_BASE_VERSION)
25 
26 /* DPMNG command IDs */
27 #define DPMNG_CMDID_GET_VERSION		DPMNG_CMD(0x831)
28 
29 struct dpmng_rsp_get_version {
30 	__le32 revision;
31 	__le32 version_major;
32 	__le32 version_minor;
33 };
34 
35 /*
36  * Data Path Management Command Portal (DPMCP) API
37  */
38 
39 /* Minimal supported DPMCP Version */
40 #define DPMCP_MIN_VER_MAJOR		3
41 #define DPMCP_MIN_VER_MINOR		0
42 
43 /* DPMCP command versioning */
44 #define DPMCP_CMD_BASE_VERSION		1
45 #define DPMCP_CMD_ID_OFFSET		4
46 
47 #define DPMCP_CMD(id)	(((id) << DPMCP_CMD_ID_OFFSET) | DPMCP_CMD_BASE_VERSION)
48 
49 /* DPMCP command IDs */
50 #define DPMCP_CMDID_CLOSE		DPMCP_CMD(0x800)
51 #define DPMCP_CMDID_RESET		DPMCP_CMD(0x005)
52 
53 struct dpmcp_cmd_open {
54 	__le32 dpmcp_id;
55 };
56 
57 /*
58  * Initialization and runtime control APIs for DPMCP
59  */
60 int dpmcp_open(struct fsl_mc_io *mc_io,
61 	       u32 cmd_flags,
62 	       int dpmcp_id,
63 	       u16 *token);
64 
65 int dpmcp_close(struct fsl_mc_io *mc_io,
66 		u32 cmd_flags,
67 		u16 token);
68 
69 int dpmcp_reset(struct fsl_mc_io *mc_io,
70 		u32 cmd_flags,
71 		u16 token);
72 
73 /*
74  * Data Path Resource Container (DPRC) API
75  */
76 
77 /* Minimal supported DPRC Version */
78 #define DPRC_MIN_VER_MAJOR			6
79 #define DPRC_MIN_VER_MINOR			0
80 
81 /* DPRC command versioning */
82 #define DPRC_CMD_BASE_VERSION			1
83 #define DPRC_CMD_2ND_VERSION			2
84 #define DPRC_CMD_3RD_VERSION			3
85 #define DPRC_CMD_ID_OFFSET			4
86 
87 #define DPRC_CMD(id)	(((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_BASE_VERSION)
88 #define DPRC_CMD_V2(id)	(((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_2ND_VERSION)
89 #define DPRC_CMD_V3(id)	(((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_3RD_VERSION)
90 
91 /* DPRC command IDs */
92 #define DPRC_CMDID_CLOSE                        DPRC_CMD(0x800)
93 #define DPRC_CMDID_GET_API_VERSION              DPRC_CMD(0xa05)
94 
95 #define DPRC_CMDID_GET_ATTR                     DPRC_CMD(0x004)
96 #define DPRC_CMDID_RESET_CONT                   DPRC_CMD(0x005)
97 #define DPRC_CMDID_RESET_CONT_V2                DPRC_CMD_V2(0x005)
98 
99 #define DPRC_CMDID_SET_IRQ                      DPRC_CMD(0x010)
100 #define DPRC_CMDID_SET_IRQ_ENABLE               DPRC_CMD(0x012)
101 #define DPRC_CMDID_SET_IRQ_MASK                 DPRC_CMD(0x014)
102 #define DPRC_CMDID_GET_IRQ_STATUS               DPRC_CMD(0x016)
103 #define DPRC_CMDID_CLEAR_IRQ_STATUS             DPRC_CMD(0x017)
104 
105 #define DPRC_CMDID_GET_CONT_ID                  DPRC_CMD(0x830)
106 #define DPRC_CMDID_GET_OBJ_COUNT                DPRC_CMD(0x159)
107 #define DPRC_CMDID_GET_OBJ                      DPRC_CMD(0x15A)
108 #define DPRC_CMDID_GET_OBJ_REG                  DPRC_CMD(0x15E)
109 #define DPRC_CMDID_GET_OBJ_REG_V2               DPRC_CMD_V2(0x15E)
110 #define DPRC_CMDID_GET_OBJ_REG_V3               DPRC_CMD_V3(0x15E)
111 #define DPRC_CMDID_SET_OBJ_IRQ                  DPRC_CMD(0x15F)
112 
113 #define DPRC_CMDID_GET_CONNECTION               DPRC_CMD(0x16C)
114 
115 struct dprc_cmd_open {
116 	__le32 container_id;
117 };
118 
119 struct dprc_cmd_reset_container {
120 	__le32 child_container_id;
121 	__le32 options;
122 };
123 
124 struct dprc_cmd_set_irq {
125 	/* cmd word 0 */
126 	__le32 irq_val;
127 	u8 irq_index;
128 	u8 pad[3];
129 	/* cmd word 1 */
130 	__le64 irq_addr;
131 	/* cmd word 2 */
132 	__le32 irq_num;
133 };
134 
135 #define DPRC_ENABLE		0x1
136 
137 struct dprc_cmd_set_irq_enable {
138 	u8 enable;
139 	u8 pad[3];
140 	u8 irq_index;
141 };
142 
143 struct dprc_cmd_set_irq_mask {
144 	__le32 mask;
145 	u8 irq_index;
146 };
147 
148 struct dprc_cmd_get_irq_status {
149 	__le32 status;
150 	u8 irq_index;
151 };
152 
153 struct dprc_rsp_get_irq_status {
154 	__le32 status;
155 };
156 
157 struct dprc_cmd_clear_irq_status {
158 	__le32 status;
159 	u8 irq_index;
160 };
161 
162 struct dprc_rsp_get_attributes {
163 	/* response word 0 */
164 	__le32 container_id;
165 	__le32 icid;
166 	/* response word 1 */
167 	__le32 options;
168 	__le32 portal_id;
169 };
170 
171 struct dprc_rsp_get_obj_count {
172 	__le32 pad;
173 	__le32 obj_count;
174 };
175 
176 struct dprc_cmd_get_obj {
177 	__le32 obj_index;
178 };
179 
180 struct dprc_rsp_get_obj {
181 	/* response word 0 */
182 	__le32 pad0;
183 	__le32 id;
184 	/* response word 1 */
185 	__le16 vendor;
186 	u8 irq_count;
187 	u8 region_count;
188 	__le32 state;
189 	/* response word 2 */
190 	__le16 version_major;
191 	__le16 version_minor;
192 	__le16 flags;
193 	__le16 pad1;
194 	/* response word 3-4 */
195 	u8 type[16];
196 	/* response word 5-6 */
197 	u8 label[16];
198 };
199 
200 struct dprc_cmd_get_obj_region {
201 	/* cmd word 0 */
202 	__le32 obj_id;
203 	__le16 pad0;
204 	u8 region_index;
205 	u8 pad1;
206 	/* cmd word 1-2 */
207 	__le64 pad2[2];
208 	/* cmd word 3-4 */
209 	u8 obj_type[16];
210 };
211 
212 struct dprc_rsp_get_obj_region {
213 	/* response word 0 */
214 	__le64 pad0;
215 	/* response word 1 */
216 	__le64 base_offset;
217 	/* response word 2 */
218 	__le32 size;
219 	u8 type;
220 	u8 pad2[3];
221 	/* response word 3 */
222 	__le32 flags;
223 	__le32 pad3;
224 	/* response word 4 */
225 	/* base_addr may be zero if older MC firmware is used */
226 	__le64 base_addr;
227 };
228 
229 struct dprc_cmd_set_obj_irq {
230 	/* cmd word 0 */
231 	__le32 irq_val;
232 	u8 irq_index;
233 	u8 pad[3];
234 	/* cmd word 1 */
235 	__le64 irq_addr;
236 	/* cmd word 2 */
237 	__le32 irq_num;
238 	__le32 obj_id;
239 	/* cmd word 3-4 */
240 	u8 obj_type[16];
241 };
242 
243 struct dprc_cmd_get_connection {
244 	__le32 ep1_id;
245 	__le16 ep1_interface_id;
246 	u8 pad[2];
247 	u8 ep1_type[16];
248 };
249 
250 struct dprc_rsp_get_connection {
251 	__le64 pad[3];
252 	__le32 ep2_id;
253 	__le16 ep2_interface_id;
254 	__le16 pad1;
255 	u8 ep2_type[16];
256 	__le32 state;
257 };
258 
259 /*
260  * DPRC API for managing and querying DPAA resources
261  */
262 int dprc_open(struct fsl_mc_io *mc_io,
263 	      u32 cmd_flags,
264 	      int container_id,
265 	      u16 *token);
266 
267 int dprc_close(struct fsl_mc_io *mc_io,
268 	       u32 cmd_flags,
269 	       u16 token);
270 
271 /* DPRC IRQ events */
272 
273 /* IRQ event - Indicates that a new object added to the container */
274 #define DPRC_IRQ_EVENT_OBJ_ADDED		0x00000001
275 /* IRQ event - Indicates that an object was removed from the container */
276 #define DPRC_IRQ_EVENT_OBJ_REMOVED		0x00000002
277 /*
278  * IRQ event - Indicates that one of the descendant containers that opened by
279  * this container is destroyed
280  */
281 #define DPRC_IRQ_EVENT_CONTAINER_DESTROYED	0x00000010
282 
283 /*
284  * IRQ event - Indicates that on one of the container's opened object is
285  * destroyed
286  */
287 #define DPRC_IRQ_EVENT_OBJ_DESTROYED		0x00000020
288 
289 /* Irq event - Indicates that object is created at the container */
290 #define DPRC_IRQ_EVENT_OBJ_CREATED		0x00000040
291 
292 /**
293  * struct dprc_irq_cfg - IRQ configuration
294  * @paddr:	Address that must be written to signal a message-based interrupt
295  * @val:	Value to write into irq_addr address
296  * @irq_num:	A user defined number associated with this IRQ
297  */
298 struct dprc_irq_cfg {
299 	     phys_addr_t paddr;
300 	     u32 val;
301 	     int irq_num;
302 };
303 
304 int dprc_set_irq(struct fsl_mc_io *mc_io,
305 		 u32 cmd_flags,
306 		 u16 token,
307 		 u8 irq_index,
308 		 struct dprc_irq_cfg *irq_cfg);
309 
310 int dprc_set_irq_enable(struct fsl_mc_io *mc_io,
311 			u32 cmd_flags,
312 			u16 token,
313 			u8 irq_index,
314 			u8 en);
315 
316 int dprc_set_irq_mask(struct fsl_mc_io *mc_io,
317 		      u32 cmd_flags,
318 		      u16 token,
319 		      u8 irq_index,
320 		      u32 mask);
321 
322 int dprc_get_irq_status(struct fsl_mc_io *mc_io,
323 			u32 cmd_flags,
324 			u16 token,
325 			u8 irq_index,
326 			u32 *status);
327 
328 int dprc_clear_irq_status(struct fsl_mc_io *mc_io,
329 			  u32 cmd_flags,
330 			  u16 token,
331 			  u8 irq_index,
332 			  u32 status);
333 
334 /**
335  * struct dprc_attributes - Container attributes
336  * @container_id: Container's ID
337  * @icid: Container's ICID
338  * @portal_id: Container's portal ID
339  * @options: Container's options as set at container's creation
340  */
341 struct dprc_attributes {
342 	int container_id;
343 	u32 icid;
344 	int portal_id;
345 	u64 options;
346 };
347 
348 int dprc_get_attributes(struct fsl_mc_io *mc_io,
349 			u32 cmd_flags,
350 			u16 token,
351 			struct dprc_attributes *attributes);
352 
353 int dprc_get_obj_count(struct fsl_mc_io *mc_io,
354 		       u32 cmd_flags,
355 		       u16 token,
356 		       int *obj_count);
357 
358 int dprc_get_obj(struct fsl_mc_io *mc_io,
359 		 u32 cmd_flags,
360 		 u16 token,
361 		 int obj_index,
362 		 struct fsl_mc_obj_desc *obj_desc);
363 
364 int dprc_set_obj_irq(struct fsl_mc_io *mc_io,
365 		     u32 cmd_flags,
366 		     u16 token,
367 		     char *obj_type,
368 		     int obj_id,
369 		     u8 irq_index,
370 		     struct dprc_irq_cfg *irq_cfg);
371 /**
372  * enum dprc_region_type - Region type
373  * @DPRC_REGION_TYPE_MC_PORTAL: MC portal region
374  * @DPRC_REGION_TYPE_QBMAN_PORTAL: Qbman portal region
375  */
376 enum dprc_region_type {
377 	DPRC_REGION_TYPE_MC_PORTAL,
378 	DPRC_REGION_TYPE_QBMAN_PORTAL,
379 	DPRC_REGION_TYPE_QBMAN_MEM_BACKED_PORTAL
380 };
381 
382 /**
383  * struct dprc_region_desc - Mappable region descriptor
384  * @base_offset: Region offset from region's base address.
385  *	For DPMCP and DPRC objects, region base is offset from SoC MC portals
386  *	base address; For DPIO, region base is offset from SoC QMan portals
387  *	base address
388  * @size: Region size (in bytes)
389  * @flags: Region attributes
390  * @type: Portal region type
391  */
392 struct dprc_region_desc {
393 	u32 base_offset;
394 	u32 size;
395 	u32 flags;
396 	enum dprc_region_type type;
397 	u64 base_address;
398 };
399 
400 int dprc_get_obj_region(struct fsl_mc_io *mc_io,
401 			u32 cmd_flags,
402 			u16 token,
403 			char *obj_type,
404 			int obj_id,
405 			u8 region_index,
406 			struct dprc_region_desc *region_desc);
407 
408 int dprc_get_api_version(struct fsl_mc_io *mc_io,
409 			 u32 cmd_flags,
410 			 u16 *major_ver,
411 			 u16 *minor_ver);
412 
413 int dprc_get_container_id(struct fsl_mc_io *mc_io,
414 			  u32 cmd_flags,
415 			  int *container_id);
416 
417 /**
418  * struct dprc_endpoint - Endpoint description for link connect/disconnect
419  *			operations
420  * @type:	Endpoint object type: NULL terminated string
421  * @id:		Endpoint object ID
422  * @if_id:	Interface ID; should be set for endpoints with multiple
423  *		interfaces ("dpsw", "dpdmux"); for others, always set to 0
424  */
425 struct dprc_endpoint {
426 	char type[16];
427 	int id;
428 	u16 if_id;
429 };
430 
431 int dprc_get_connection(struct fsl_mc_io *mc_io,
432 			u32 cmd_flags,
433 			u16 token,
434 			const struct dprc_endpoint *endpoint1,
435 			struct dprc_endpoint *endpoint2,
436 			int *state);
437 
438 /*
439  * Data Path Buffer Pool (DPBP) API
440  */
441 
442 /* DPBP Version */
443 #define DPBP_VER_MAJOR				3
444 #define DPBP_VER_MINOR				2
445 
446 /* Command versioning */
447 #define DPBP_CMD_BASE_VERSION			1
448 #define DPBP_CMD_ID_OFFSET			4
449 
450 #define DPBP_CMD(id)	(((id) << DPBP_CMD_ID_OFFSET) | DPBP_CMD_BASE_VERSION)
451 
452 /* Command IDs */
453 #define DPBP_CMDID_CLOSE		DPBP_CMD(0x800)
454 
455 #define DPBP_CMDID_ENABLE		DPBP_CMD(0x002)
456 #define DPBP_CMDID_DISABLE		DPBP_CMD(0x003)
457 #define DPBP_CMDID_GET_ATTR		DPBP_CMD(0x004)
458 #define DPBP_CMDID_RESET		DPBP_CMD(0x005)
459 
460 struct dpbp_cmd_open {
461 	__le32 dpbp_id;
462 };
463 
464 #define DPBP_ENABLE			0x1
465 
466 struct dpbp_rsp_get_attributes {
467 	/* response word 0 */
468 	__le16 pad;
469 	__le16 bpid;
470 	__le32 id;
471 	/* response word 1 */
472 	__le16 version_major;
473 	__le16 version_minor;
474 };
475 
476 /*
477  * Data Path Concentrator (DPCON) API
478  */
479 
480 /* DPCON Version */
481 #define DPCON_VER_MAJOR				3
482 #define DPCON_VER_MINOR				2
483 
484 /* Command versioning */
485 #define DPCON_CMD_BASE_VERSION			1
486 #define DPCON_CMD_ID_OFFSET			4
487 
488 #define DPCON_CMD(id)	(((id) << DPCON_CMD_ID_OFFSET) | DPCON_CMD_BASE_VERSION)
489 
490 /* Command IDs */
491 #define DPCON_CMDID_CLOSE			DPCON_CMD(0x800)
492 
493 #define DPCON_CMDID_ENABLE			DPCON_CMD(0x002)
494 #define DPCON_CMDID_DISABLE			DPCON_CMD(0x003)
495 #define DPCON_CMDID_GET_ATTR			DPCON_CMD(0x004)
496 #define DPCON_CMDID_RESET			DPCON_CMD(0x005)
497 
498 #define DPCON_CMDID_SET_NOTIFICATION		DPCON_CMD(0x100)
499 
500 struct dpcon_cmd_open {
501 	__le32 dpcon_id;
502 };
503 
504 #define DPCON_ENABLE			1
505 
506 struct dpcon_rsp_get_attr {
507 	/* response word 0 */
508 	__le32 id;
509 	__le16 qbman_ch_id;
510 	u8 num_priorities;
511 	u8 pad;
512 };
513 
514 struct dpcon_cmd_set_notification {
515 	/* cmd word 0 */
516 	__le32 dpio_id;
517 	u8 priority;
518 	u8 pad[3];
519 	/* cmd word 1 */
520 	__le64 user_ctx;
521 };
522 
523 /*
524  * Generic FSL MC API
525  */
526 
527 /* generic command versioning */
528 #define OBJ_CMD_BASE_VERSION		1
529 #define OBJ_CMD_ID_OFFSET		4
530 
531 #define OBJ_CMD(id)	(((id) << OBJ_CMD_ID_OFFSET) | OBJ_CMD_BASE_VERSION)
532 
533 /* open command codes */
534 #define DPRTC_CMDID_OPEN		OBJ_CMD(0x810)
535 #define DPNI_CMDID_OPEN		OBJ_CMD(0x801)
536 #define DPSW_CMDID_OPEN		OBJ_CMD(0x802)
537 #define DPIO_CMDID_OPEN		OBJ_CMD(0x803)
538 #define DPBP_CMDID_OPEN		OBJ_CMD(0x804)
539 #define DPRC_CMDID_OPEN		OBJ_CMD(0x805)
540 #define DPDMUX_CMDID_OPEN		OBJ_CMD(0x806)
541 #define DPCI_CMDID_OPEN		OBJ_CMD(0x807)
542 #define DPCON_CMDID_OPEN		OBJ_CMD(0x808)
543 #define DPSECI_CMDID_OPEN		OBJ_CMD(0x809)
544 #define DPAIOP_CMDID_OPEN		OBJ_CMD(0x80a)
545 #define DPMCP_CMDID_OPEN		OBJ_CMD(0x80b)
546 #define DPMAC_CMDID_OPEN		OBJ_CMD(0x80c)
547 #define DPDCEI_CMDID_OPEN		OBJ_CMD(0x80d)
548 #define DPDMAI_CMDID_OPEN		OBJ_CMD(0x80e)
549 #define DPDBG_CMDID_OPEN		OBJ_CMD(0x80f)
550 
551 /* Generic object command IDs */
552 #define OBJ_CMDID_CLOSE		OBJ_CMD(0x800)
553 #define OBJ_CMDID_RESET		OBJ_CMD(0x005)
554 
555 struct fsl_mc_obj_cmd_open {
556 	__le32 obj_id;
557 };
558 
559 /**
560  * struct fsl_mc_resource_pool - Pool of MC resources of a given
561  * type
562  * @type: type of resources in the pool
563  * @max_count: maximum number of resources in the pool
564  * @free_count: number of free resources in the pool
565  * @mutex: mutex to serialize access to the pool's free list
566  * @free_list: anchor node of list of free resources in the pool
567  * @mc_bus: pointer to the MC bus that owns this resource pool
568  */
569 struct fsl_mc_resource_pool {
570 	enum fsl_mc_pool_type type;
571 	int max_count;
572 	int free_count;
573 	struct mutex mutex;	/* serializes access to free_list */
574 	struct list_head free_list;
575 	struct fsl_mc_bus *mc_bus;
576 };
577 
578 /**
579  * struct fsl_mc_uapi - information associated with a device file
580  * @misc: struct miscdevice linked to the root dprc
581  * @device: newly created device in /dev
582  * @mutex: mutex lock to serialize the open/release operations
583  * @local_instance_in_use: local MC I/O instance in use or not
584  * @static_mc_io: pointer to the static MC I/O object
585  */
586 struct fsl_mc_uapi {
587 	struct miscdevice misc;
588 	struct device *device;
589 	struct mutex mutex; /* serialize open/release operations */
590 	u32 local_instance_in_use;
591 	struct fsl_mc_io *static_mc_io;
592 };
593 
594 /**
595  * struct fsl_mc_bus - logical bus that corresponds to a physical DPRC
596  * @mc_dev: fsl-mc device for the bus device itself.
597  * @resource_pools: array of resource pools (one pool per resource type)
598  * for this MC bus. These resources represent allocatable entities
599  * from the physical DPRC.
600  * @irq_resources: Pointer to array of IRQ objects for the IRQ pool
601  * @scan_mutex: Serializes bus scanning
602  * @dprc_attr: DPRC attributes
603  * @uapi_misc: struct that abstracts the interaction with userspace
604  */
605 struct fsl_mc_bus {
606 	struct fsl_mc_device mc_dev;
607 	struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES];
608 	struct fsl_mc_device_irq *irq_resources;
609 	struct mutex scan_mutex;    /* serializes bus scanning */
610 	struct dprc_attributes dprc_attr;
611 	struct fsl_mc_uapi uapi_misc;
612 	int irq_enabled;
613 };
614 
615 #define to_fsl_mc_bus(_mc_dev) \
616 	container_of(_mc_dev, struct fsl_mc_bus, mc_dev)
617 
618 int __must_check fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc,
619 				   struct fsl_mc_io *mc_io,
620 				   struct device *parent_dev,
621 				   struct fsl_mc_device **new_mc_dev);
622 
623 void fsl_mc_device_remove(struct fsl_mc_device *mc_dev);
624 
625 int __init dprc_driver_init(void);
626 
627 void dprc_driver_exit(void);
628 
629 int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev,
630 		      bool alloc_interrupts);
631 
632 int __init fsl_mc_allocator_driver_init(void);
633 
634 void fsl_mc_allocator_driver_exit(void);
635 
636 void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
637 
638 void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
639 
640 int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus,
641 					  enum fsl_mc_pool_type pool_type,
642 					  struct fsl_mc_resource
643 							  **new_resource);
644 
645 void fsl_mc_resource_free(struct fsl_mc_resource *resource);
646 
647 int fsl_mc_msi_domain_alloc_irqs(struct device *dev,
648 				 unsigned int irq_count);
649 
650 void fsl_mc_msi_domain_free_irqs(struct device *dev);
651 
652 struct irq_domain *fsl_mc_find_msi_domain(struct device *dev);
653 
654 int __must_check fsl_create_mc_io(struct device *dev,
655 				  phys_addr_t mc_portal_phys_addr,
656 				  u32 mc_portal_size,
657 				  struct fsl_mc_device *dpmcp_dev,
658 				  u32 flags, struct fsl_mc_io **new_mc_io);
659 
660 void fsl_destroy_mc_io(struct fsl_mc_io *mc_io);
661 
662 bool fsl_mc_is_root_dprc(struct device *dev);
663 
664 void fsl_mc_get_root_dprc(struct device *dev,
665 			 struct device **root_dprc_dev);
666 
667 struct fsl_mc_device *fsl_mc_device_lookup(struct fsl_mc_obj_desc *obj_desc,
668 					   struct fsl_mc_device *mc_bus_dev);
669 
670 u16 mc_cmd_hdr_read_cmdid(struct fsl_mc_command *cmd);
671 
672 #ifdef CONFIG_FSL_MC_UAPI_SUPPORT
673 
674 int fsl_mc_uapi_create_device_file(struct fsl_mc_bus *mc_bus);
675 
676 void fsl_mc_uapi_remove_device_file(struct fsl_mc_bus *mc_bus);
677 
678 #else
679 
680 static inline int fsl_mc_uapi_create_device_file(struct fsl_mc_bus *mc_bus)
681 {
682 	return 0;
683 }
684 
685 static inline void fsl_mc_uapi_remove_device_file(struct fsl_mc_bus *mc_bus)
686 {
687 }
688 
689 #endif
690 
691 int disable_dprc_irq(struct fsl_mc_device *mc_dev);
692 int enable_dprc_irq(struct fsl_mc_device *mc_dev);
693 int get_dprc_irq_state(struct fsl_mc_device *mc_dev);
694 
695 #endif /* _FSL_MC_PRIVATE_H_ */
696