1 From e8dd5b8ee227cc60f10073faaa0f74b36aa4f40f Mon Sep 17 00:00:00 2001
2 From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
3 Date: Mon, 16 Apr 2018 12:26:38 +0300
4 Subject: [PATCH] bus: fsl-mc: Some apis are made public for vfio
6 Some of the APIs and data-structures are required for VFIO.
7 This patch moves dprc.h to public header files.
8 Also some APIs of mc-bus are made public for vfio.
10 Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
11 Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
13 drivers/bus/fsl-mc/fsl-mc-allocator.c | 2 +
14 drivers/bus/fsl-mc/fsl-mc-bus.c | 5 +-
15 drivers/bus/fsl-mc/fsl-mc-private.h | 414 ---------------------------------
16 include/linux/fsl/mc.h | 420 ++++++++++++++++++++++++++++++++++
17 4 files changed, 425 insertions(+), 416 deletions(-)
19 --- a/drivers/bus/fsl-mc/fsl-mc-allocator.c
20 +++ b/drivers/bus/fsl-mc/fsl-mc-allocator.c
21 @@ -547,6 +547,7 @@ void fsl_mc_init_all_resource_pools(stru
22 mutex_init(&res_pool->mutex);
25 +EXPORT_SYMBOL_GPL(fsl_mc_init_all_resource_pools);
27 static void fsl_mc_cleanup_resource_pool(struct fsl_mc_device *mc_bus_dev,
28 enum fsl_mc_pool_type pool_type)
29 @@ -571,6 +572,7 @@ void fsl_mc_cleanup_all_resource_pools(s
30 for (pool_type = 0; pool_type < FSL_MC_NUM_POOL_TYPES; pool_type++)
31 fsl_mc_cleanup_resource_pool(mc_bus_dev, pool_type);
33 +EXPORT_SYMBOL_GPL(fsl_mc_cleanup_all_resource_pools);
36 * fsl_mc_allocator_probe - callback invoked when an allocatable device is
37 --- a/drivers/bus/fsl-mc/fsl-mc-bus.c
38 +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
39 @@ -447,8 +447,8 @@ static int mc_get_version(struct fsl_mc_
41 * fsl_mc_get_root_dprc - function to traverse to the root dprc
43 -static void fsl_mc_get_root_dprc(struct device *dev,
44 - struct device **root_dprc_dev)
45 +void fsl_mc_get_root_dprc(struct device *dev,
46 + struct device **root_dprc_dev)
49 *root_dprc_dev = NULL;
50 @@ -460,6 +460,7 @@ static void fsl_mc_get_root_dprc(struct
51 *root_dprc_dev = (*root_dprc_dev)->parent;
54 +EXPORT_SYMBOL_GPL(fsl_mc_get_root_dprc);
56 static int get_dprc_attr(struct fsl_mc_io *mc_io,
57 int container_id, struct dprc_attributes *attr)
58 --- a/drivers/bus/fsl-mc/fsl-mc-private.h
59 +++ b/drivers/bus/fsl-mc/fsl-mc-private.h
62 #include <linux/fsl/mc.h>
63 #include <linux/mutex.h>
64 -#include <linux/ioctl.h>
65 -#include <linux/miscdevice.h>
68 * Data Path Management Complex (DPMNG) General API
69 @@ -72,339 +70,6 @@ int dpmcp_reset(struct fsl_mc_io *mc_io,
73 - * Data Path Resource Container (DPRC) API
76 -/* Minimal supported DPRC Version */
77 -#define DPRC_MIN_VER_MAJOR 6
78 -#define DPRC_MIN_VER_MINOR 0
80 -/* DPRC command versioning */
81 -#define DPRC_CMD_BASE_VERSION 1
82 -#define DPRC_CMD_2ND_VERSION 2
83 -#define DPRC_CMD_ID_OFFSET 4
85 -#define DPRC_CMD(id) (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_BASE_VERSION)
86 -#define DPRC_CMD_V2(id) (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_2ND_VERSION)
88 -/* DPRC command IDs */
89 -#define DPRC_CMDID_CLOSE DPRC_CMD(0x800)
90 -#define DPRC_CMDID_OPEN DPRC_CMD(0x805)
91 -#define DPRC_CMDID_GET_API_VERSION DPRC_CMD(0xa05)
93 -#define DPRC_CMDID_GET_ATTR DPRC_CMD(0x004)
94 -#define DPRC_CMDID_RESET_CONT DPRC_CMD(0x005)
96 -#define DPRC_CMDID_SET_IRQ DPRC_CMD(0x010)
97 -#define DPRC_CMDID_SET_IRQ_ENABLE DPRC_CMD(0x012)
98 -#define DPRC_CMDID_SET_IRQ_MASK DPRC_CMD(0x014)
99 -#define DPRC_CMDID_GET_IRQ_STATUS DPRC_CMD(0x016)
100 -#define DPRC_CMDID_CLEAR_IRQ_STATUS DPRC_CMD(0x017)
102 -#define DPRC_CMDID_GET_CONT_ID DPRC_CMD(0x830)
103 -#define DPRC_CMDID_GET_OBJ_COUNT DPRC_CMD(0x159)
104 -#define DPRC_CMDID_GET_OBJ DPRC_CMD(0x15A)
105 -#define DPRC_CMDID_GET_OBJ_REG DPRC_CMD(0x15E)
106 -#define DPRC_CMDID_GET_OBJ_REG_V2 DPRC_CMD_V2(0x15E)
107 -#define DPRC_CMDID_SET_OBJ_IRQ DPRC_CMD(0x15F)
109 -struct dprc_cmd_open {
110 - __le32 container_id;
113 -struct dprc_cmd_reset_container {
114 - __le32 child_container_id;
117 -struct dprc_cmd_set_irq {
128 -#define DPRC_ENABLE 0x1
130 -struct dprc_cmd_set_irq_enable {
136 -struct dprc_cmd_set_irq_mask {
141 -struct dprc_cmd_get_irq_status {
146 -struct dprc_rsp_get_irq_status {
150 -struct dprc_cmd_clear_irq_status {
155 -struct dprc_rsp_get_attributes {
156 - /* response word 0 */
157 - __le32 container_id;
159 - /* response word 1 */
164 -struct dprc_rsp_get_obj_count {
169 -struct dprc_cmd_get_obj {
173 -struct dprc_rsp_get_obj {
174 - /* response word 0 */
177 - /* response word 1 */
182 - /* response word 2 */
183 - __le16 version_major;
184 - __le16 version_minor;
187 - /* response word 3-4 */
189 - /* response word 5-6 */
193 -struct dprc_cmd_get_obj_region {
205 -struct dprc_rsp_get_obj_region {
206 - /* response word 0 */
208 - /* response word 1 */
209 - __le64 base_offset;
210 - /* response word 2 */
214 - /* response word 3 */
217 - /* response word 4 */
218 - /* base_addr may be zero if older MC firmware is used */
222 -struct dprc_cmd_set_obj_irq {
237 - * DPRC API for managing and querying DPAA resources
239 -int dprc_open(struct fsl_mc_io *mc_io,
244 -int dprc_close(struct fsl_mc_io *mc_io,
248 -/* DPRC IRQ events */
250 -/* IRQ event - Indicates that a new object added to the container */
251 -#define DPRC_IRQ_EVENT_OBJ_ADDED 0x00000001
252 -/* IRQ event - Indicates that an object was removed from the container */
253 -#define DPRC_IRQ_EVENT_OBJ_REMOVED 0x00000002
255 - * IRQ event - Indicates that one of the descendant containers that opened by
256 - * this container is destroyed
258 -#define DPRC_IRQ_EVENT_CONTAINER_DESTROYED 0x00000010
261 - * IRQ event - Indicates that on one of the container's opened object is
264 -#define DPRC_IRQ_EVENT_OBJ_DESTROYED 0x00000020
266 -/* Irq event - Indicates that object is created at the container */
267 -#define DPRC_IRQ_EVENT_OBJ_CREATED 0x00000040
270 - * struct dprc_irq_cfg - IRQ configuration
271 - * @paddr: Address that must be written to signal a message-based interrupt
272 - * @val: Value to write into irq_addr address
273 - * @irq_num: A user defined number associated with this IRQ
275 -struct dprc_irq_cfg {
281 -int dprc_set_irq(struct fsl_mc_io *mc_io,
285 - struct dprc_irq_cfg *irq_cfg);
287 -int dprc_set_irq_enable(struct fsl_mc_io *mc_io,
293 -int dprc_set_irq_mask(struct fsl_mc_io *mc_io,
299 -int dprc_get_irq_status(struct fsl_mc_io *mc_io,
305 -int dprc_clear_irq_status(struct fsl_mc_io *mc_io,
312 - * struct dprc_attributes - Container attributes
313 - * @container_id: Container's ID
314 - * @icid: Container's ICID
315 - * @portal_id: Container's portal ID
316 - * @options: Container's options as set at container's creation
318 -struct dprc_attributes {
325 -int dprc_get_attributes(struct fsl_mc_io *mc_io,
328 - struct dprc_attributes *attributes);
330 -int dprc_get_obj_count(struct fsl_mc_io *mc_io,
335 -int dprc_get_obj(struct fsl_mc_io *mc_io,
339 - struct fsl_mc_obj_desc *obj_desc);
341 -int dprc_set_obj_irq(struct fsl_mc_io *mc_io,
347 - struct dprc_irq_cfg *irq_cfg);
350 -/* Cacheable - Indicates that region should be mapped as cacheable */
351 -#define DPRC_REGION_CACHEABLE 0x00000001
352 -#define DPRC_REGION_SHAREABLE 0x00000002
355 - * enum dprc_region_type - Region type
356 - * @DPRC_REGION_TYPE_MC_PORTAL: MC portal region
357 - * @DPRC_REGION_TYPE_QBMAN_PORTAL: Qbman portal region
359 -enum dprc_region_type {
360 - DPRC_REGION_TYPE_MC_PORTAL,
361 - DPRC_REGION_TYPE_QBMAN_PORTAL,
362 - DPRC_REGION_TYPE_QBMAN_MEM_BACKED_PORTAL
366 - * struct dprc_region_desc - Mappable region descriptor
367 - * @base_offset: Region offset from region's base address.
368 - * For DPMCP and DPRC objects, region base is offset from SoC MC portals
369 - * base address; For DPIO, region base is offset from SoC QMan portals
371 - * @size: Region size (in bytes)
372 - * @flags: Region attributes
373 - * @type: Portal region type
375 -struct dprc_region_desc {
379 - enum dprc_region_type type;
383 -int dprc_get_obj_region(struct fsl_mc_io *mc_io,
389 - struct dprc_region_desc *region_desc);
391 -int dprc_get_api_version(struct fsl_mc_io *mc_io,
396 -int dprc_get_container_id(struct fsl_mc_io *mc_io,
398 - int *container_id);
400 -int dprc_reset_container(struct fsl_mc_io *mc_io,
403 - int child_container_id);
406 * Data Path Buffer Pool (DPBP) API
409 @@ -491,70 +156,6 @@ struct dpcon_cmd_set_notification {
414 - * Maximum number of total IRQs that can be pre-allocated for an MC bus'
417 -#define FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS 256
420 - * struct fsl_mc_resource_pool - Pool of MC resources of a given
422 - * @type: type of resources in the pool
423 - * @max_count: maximum number of resources in the pool
424 - * @free_count: number of free resources in the pool
425 - * @mutex: mutex to serialize access to the pool's free list
426 - * @free_list: anchor node of list of free resources in the pool
427 - * @mc_bus: pointer to the MC bus that owns this resource pool
429 -struct fsl_mc_resource_pool {
430 - enum fsl_mc_pool_type type;
433 - struct mutex mutex; /* serializes access to free_list */
434 - struct list_head free_list;
435 - struct fsl_mc_bus *mc_bus;
439 - * struct fsl_mc_uapi - information associated with a device file
440 - * @misc: struct miscdevice linked to the root dprc
441 - * @device: newly created device in /dev
442 - * @mutex: mutex lock to serialize the open/release operations
443 - * @local_instance_in_use: local MC I/O instance in use or not
444 - * @static_mc_io: pointer to the static MC I/O object
446 -struct fsl_mc_uapi {
447 - struct miscdevice misc;
448 - struct device *device;
449 - struct mutex mutex; /* serialize open/release operations */
450 - u32 local_instance_in_use;
451 - struct fsl_mc_io *static_mc_io;
455 - * struct fsl_mc_bus - logical bus that corresponds to a physical DPRC
456 - * @mc_dev: fsl-mc device for the bus device itself.
457 - * @resource_pools: array of resource pools (one pool per resource type)
458 - * for this MC bus. These resources represent allocatable entities
459 - * from the physical DPRC.
460 - * @irq_resources: Pointer to array of IRQ objects for the IRQ pool
461 - * @scan_mutex: Serializes bus scanning
462 - * @dprc_attr: DPRC attributes
463 - * @uapi_misc: struct that abstracts the interaction with userspace
466 - struct fsl_mc_device mc_dev;
467 - struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES];
468 - struct fsl_mc_device_irq *irq_resources;
469 - struct mutex scan_mutex; /* serializes bus scanning */
470 - struct dprc_attributes dprc_attr;
471 - struct fsl_mc_uapi uapi_misc;
474 -#define to_fsl_mc_bus(_mc_dev) \
475 - container_of(_mc_dev, struct fsl_mc_bus, mc_dev)
477 int __must_check fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc,
478 struct fsl_mc_io *mc_io,
479 struct device *parent_dev,
480 @@ -565,17 +166,10 @@ int __init dprc_driver_init(void);
482 void dprc_driver_exit(void);
484 -int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev,
485 - const char *driver_override,
486 - unsigned int *total_irq_count);
487 int __init fsl_mc_allocator_driver_init(void);
489 void fsl_mc_allocator_driver_exit(void);
491 -void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
493 -void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
495 int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus,
496 enum fsl_mc_pool_type pool_type,
497 struct fsl_mc_resource
498 @@ -588,14 +182,6 @@ int fsl_mc_msi_domain_alloc_irqs(struct
500 void fsl_mc_msi_domain_free_irqs(struct device *dev);
502 -int fsl_mc_find_msi_domain(struct device *mc_platform_dev,
503 - struct irq_domain **mc_msi_domain);
505 -int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus,
506 - unsigned int irq_count);
508 -void fsl_mc_cleanup_irq_pool(struct fsl_mc_bus *mc_bus);
510 int __must_check fsl_create_mc_io(struct device *dev,
511 phys_addr_t mc_portal_phys_addr,
513 --- a/include/linux/fsl/mc.h
514 +++ b/include/linux/fsl/mc.h
516 #include <linux/device.h>
517 #include <linux/mod_devicetable.h>
518 #include <linux/interrupt.h>
519 +#include <linux/ioctl.h>
520 +#include <linux/miscdevice.h>
521 #include <uapi/linux/fsl_mc.h>
523 #define FSL_MC_VENDOR_FREESCALE 0x1957
524 @@ -49,6 +51,9 @@ struct fsl_mc_driver {
525 #define to_fsl_mc_driver(_drv) \
526 container_of(_drv, struct fsl_mc_driver, driver)
528 +#define to_fsl_mc_bus(_mc_dev) \
529 + container_of(_mc_dev, struct fsl_mc_bus, mc_dev)
532 * enum fsl_mc_pool_type - Types of allocatable MC bus resources
534 @@ -469,6 +474,339 @@ static inline bool is_fsl_mc_bus_dpseci(
538 + * Data Path Resource Container (DPRC) API
541 +/* Minimal supported DPRC Version */
542 +#define DPRC_MIN_VER_MAJOR 6
543 +#define DPRC_MIN_VER_MINOR 0
545 +/* DPRC command versioning */
546 +#define DPRC_CMD_BASE_VERSION 1
547 +#define DPRC_CMD_2ND_VERSION 2
548 +#define DPRC_CMD_ID_OFFSET 4
550 +#define DPRC_CMD(id) (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_BASE_VERSION)
551 +#define DPRC_CMD_V2(id) (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_2ND_VERSION)
553 +/* DPRC command IDs */
554 +#define DPRC_CMDID_CLOSE DPRC_CMD(0x800)
555 +#define DPRC_CMDID_OPEN DPRC_CMD(0x805)
556 +#define DPRC_CMDID_GET_API_VERSION DPRC_CMD(0xa05)
558 +#define DPRC_CMDID_GET_ATTR DPRC_CMD(0x004)
559 +#define DPRC_CMDID_RESET_CONT DPRC_CMD(0x005)
561 +#define DPRC_CMDID_SET_IRQ DPRC_CMD(0x010)
562 +#define DPRC_CMDID_SET_IRQ_ENABLE DPRC_CMD(0x012)
563 +#define DPRC_CMDID_SET_IRQ_MASK DPRC_CMD(0x014)
564 +#define DPRC_CMDID_GET_IRQ_STATUS DPRC_CMD(0x016)
565 +#define DPRC_CMDID_CLEAR_IRQ_STATUS DPRC_CMD(0x017)
567 +#define DPRC_CMDID_GET_CONT_ID DPRC_CMD(0x830)
568 +#define DPRC_CMDID_GET_OBJ_COUNT DPRC_CMD(0x159)
569 +#define DPRC_CMDID_GET_OBJ DPRC_CMD(0x15A)
570 +#define DPRC_CMDID_GET_OBJ_REG DPRC_CMD(0x15E)
571 +#define DPRC_CMDID_GET_OBJ_REG_V2 DPRC_CMD_V2(0x15E)
572 +#define DPRC_CMDID_SET_OBJ_IRQ DPRC_CMD(0x15F)
574 +struct dprc_cmd_open {
575 + __le32 container_id;
578 +struct dprc_cmd_reset_container {
579 + __le32 child_container_id;
582 +struct dprc_cmd_set_irq {
593 +#define DPRC_ENABLE 0x1
595 +struct dprc_cmd_set_irq_enable {
601 +struct dprc_cmd_set_irq_mask {
606 +struct dprc_cmd_get_irq_status {
611 +struct dprc_rsp_get_irq_status {
615 +struct dprc_cmd_clear_irq_status {
620 +struct dprc_rsp_get_attributes {
621 + /* response word 0 */
622 + __le32 container_id;
624 + /* response word 1 */
629 +struct dprc_rsp_get_obj_count {
634 +struct dprc_cmd_get_obj {
638 +struct dprc_rsp_get_obj {
639 + /* response word 0 */
642 + /* response word 1 */
647 + /* response word 2 */
648 + __le16 version_major;
649 + __le16 version_minor;
652 + /* response word 3-4 */
654 + /* response word 5-6 */
658 +struct dprc_cmd_get_obj_region {
670 +struct dprc_rsp_get_obj_region {
671 + /* response word 0 */
673 + /* response word 1 */
674 + __le64 base_offset;
675 + /* response word 2 */
679 + /* response word 3 */
682 + /* response word 4 */
683 + /* base_addr may be zero if older MC firmware is used */
687 +struct dprc_cmd_set_obj_irq {
702 + * DPRC API for managing and querying DPAA resources
704 +int dprc_open(struct fsl_mc_io *mc_io,
709 +int dprc_close(struct fsl_mc_io *mc_io,
713 +/* DPRC IRQ events */
715 +/* IRQ event - Indicates that a new object added to the container */
716 +#define DPRC_IRQ_EVENT_OBJ_ADDED 0x00000001
717 +/* IRQ event - Indicates that an object was removed from the container */
718 +#define DPRC_IRQ_EVENT_OBJ_REMOVED 0x00000002
720 + * IRQ event - Indicates that one of the descendant containers that opened by
721 + * this container is destroyed
723 +#define DPRC_IRQ_EVENT_CONTAINER_DESTROYED 0x00000010
726 + * IRQ event - Indicates that on one of the container's opened object is
729 +#define DPRC_IRQ_EVENT_OBJ_DESTROYED 0x00000020
731 +/* Irq event - Indicates that object is created at the container */
732 +#define DPRC_IRQ_EVENT_OBJ_CREATED 0x00000040
735 + * struct dprc_irq_cfg - IRQ configuration
736 + * @paddr: Address that must be written to signal a message-based interrupt
737 + * @val: Value to write into irq_addr address
738 + * @irq_num: A user defined number associated with this IRQ
740 +struct dprc_irq_cfg {
746 +int dprc_set_irq(struct fsl_mc_io *mc_io,
750 + struct dprc_irq_cfg *irq_cfg);
752 +int dprc_set_irq_enable(struct fsl_mc_io *mc_io,
758 +int dprc_set_irq_mask(struct fsl_mc_io *mc_io,
764 +int dprc_get_irq_status(struct fsl_mc_io *mc_io,
770 +int dprc_clear_irq_status(struct fsl_mc_io *mc_io,
777 + * struct dprc_attributes - Container attributes
778 + * @container_id: Container's ID
779 + * @icid: Container's ICID
780 + * @portal_id: Container's portal ID
781 + * @options: Container's options as set at container's creation
783 +struct dprc_attributes {
790 +int dprc_get_attributes(struct fsl_mc_io *mc_io,
793 + struct dprc_attributes *attributes);
795 +int dprc_get_obj_count(struct fsl_mc_io *mc_io,
800 +int dprc_get_obj(struct fsl_mc_io *mc_io,
804 + struct fsl_mc_obj_desc *obj_desc);
806 +int dprc_set_obj_irq(struct fsl_mc_io *mc_io,
812 + struct dprc_irq_cfg *irq_cfg);
815 +/* Cacheable - Indicates that region should be mapped as cacheable */
816 +#define DPRC_REGION_CACHEABLE 0x00000001
817 +#define DPRC_REGION_SHAREABLE 0x00000002
820 + * enum dprc_region_type - Region type
821 + * @DPRC_REGION_TYPE_MC_PORTAL: MC portal region
822 + * @DPRC_REGION_TYPE_QBMAN_PORTAL: Qbman portal region
824 +enum dprc_region_type {
825 + DPRC_REGION_TYPE_MC_PORTAL,
826 + DPRC_REGION_TYPE_QBMAN_PORTAL,
827 + DPRC_REGION_TYPE_QBMAN_MEM_BACKED_PORTAL
831 + * struct dprc_region_desc - Mappable region descriptor
832 + * @base_offset: Region offset from region's base address.
833 + * For DPMCP and DPRC objects, region base is offset from SoC MC portals
834 + * base address; For DPIO, region base is offset from SoC QMan portals
836 + * @size: Region size (in bytes)
837 + * @flags: Region attributes
838 + * @type: Portal region type
840 +struct dprc_region_desc {
844 + enum dprc_region_type type;
848 +int dprc_get_obj_region(struct fsl_mc_io *mc_io,
854 + struct dprc_region_desc *region_desc);
856 +int dprc_get_api_version(struct fsl_mc_io *mc_io,
861 +int dprc_get_container_id(struct fsl_mc_io *mc_io,
863 + int *container_id);
865 +int dprc_reset_container(struct fsl_mc_io *mc_io,
868 + int child_container_id);
871 * Data Path Buffer Pool (DPBP) API
872 * Contains initialization APIs and runtime control APIs for DPBP
874 @@ -576,4 +914,86 @@ int dpcon_set_notification(struct fsl_mc
876 struct dpcon_notification_cfg *cfg);
879 +struct msi_domain_info;
882 + * Maximum number of total IRQs that can be pre-allocated for an MC bus'
885 +#define FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS 256
888 + * struct fsl_mc_resource_pool - Pool of MC resources of a given
890 + * @type: type of resources in the pool
891 + * @max_count: maximum number of resources in the pool
892 + * @free_count: number of free resources in the pool
893 + * @mutex: mutex to serialize access to the pool's free list
894 + * @free_list: anchor node of list of free resources in the pool
895 + * @mc_bus: pointer to the MC bus that owns this resource pool
897 +struct fsl_mc_resource_pool {
898 + enum fsl_mc_pool_type type;
901 + struct mutex mutex; /* serializes access to free_list */
902 + struct list_head free_list;
903 + struct fsl_mc_bus *mc_bus;
907 + * struct fsl_mc_uapi - information associated with a device file
908 + * @misc: struct miscdevice linked to the root dprc
909 + * @device: newly created device in /dev
910 + * @mutex: mutex lock to serialize the open/release operations
911 + * @local_instance_in_use: local MC I/O instance in use or not
912 + * @static_mc_io: pointer to the static MC I/O object
914 +struct fsl_mc_uapi {
915 + struct miscdevice misc;
916 + struct device *device;
917 + struct mutex mutex; /* serialize open/release operations */
918 + u32 local_instance_in_use;
919 + struct fsl_mc_io *static_mc_io;
923 + * struct fsl_mc_bus - logical bus that corresponds to a physical DPRC
924 + * @mc_dev: fsl-mc device for the bus device itself.
925 + * @resource_pools: array of resource pools (one pool per resource type)
926 + * for this MC bus. These resources represent allocatable entities
927 + * from the physical DPRC.
928 + * @irq_resources: Pointer to array of IRQ objects for the IRQ pool
929 + * @scan_mutex: Serializes bus scanning
930 + * @dprc_attr: DPRC attributes
931 + * @uapi_misc: struct that abstracts the interaction with userspace
934 + struct fsl_mc_device mc_dev;
935 + struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES];
936 + struct fsl_mc_device_irq *irq_resources;
937 + struct mutex scan_mutex; /* serializes bus scanning */
938 + struct dprc_attributes dprc_attr;
939 + struct fsl_mc_uapi uapi_misc;
942 +int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev,
943 + const char *driver_override,
944 + unsigned int *total_irq_count);
946 +int fsl_mc_find_msi_domain(struct device *mc_platform_dev,
947 + struct irq_domain **mc_msi_domain);
949 +int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus,
950 + unsigned int irq_count);
952 +void fsl_mc_cleanup_irq_pool(struct fsl_mc_bus *mc_bus);
954 +void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
956 +void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
958 +void fsl_mc_get_root_dprc(struct device *dev, struct device **root_dprc_dev);
960 #endif /* _FSL_MC_H_ */