Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Freescale Management Complex (MC) bus private declarations
0004  *
0005  * Copyright (C) 2016 Freescale Semiconductor, Inc.
0006  *
0007  */
0008 #ifndef _FSL_MC_PRIVATE_H_
0009 #define _FSL_MC_PRIVATE_H_
0010 
0011 #include <linux/fsl/mc.h>
0012 #include <linux/mutex.h>
0013 #include <linux/ioctl.h>
0014 #include <linux/miscdevice.h>
0015 
0016 /*
0017  * Data Path Management Complex (DPMNG) General API
0018  */
0019 
0020 /* DPMNG command versioning */
0021 #define DPMNG_CMD_BASE_VERSION      1
0022 #define DPMNG_CMD_ID_OFFSET     4
0023 
0024 #define DPMNG_CMD(id)   (((id) << DPMNG_CMD_ID_OFFSET) | DPMNG_CMD_BASE_VERSION)
0025 
0026 /* DPMNG command IDs */
0027 #define DPMNG_CMDID_GET_VERSION     DPMNG_CMD(0x831)
0028 
0029 struct dpmng_rsp_get_version {
0030     __le32 revision;
0031     __le32 version_major;
0032     __le32 version_minor;
0033 };
0034 
0035 /*
0036  * Data Path Management Command Portal (DPMCP) API
0037  */
0038 
0039 /* Minimal supported DPMCP Version */
0040 #define DPMCP_MIN_VER_MAJOR     3
0041 #define DPMCP_MIN_VER_MINOR     0
0042 
0043 /* DPMCP command versioning */
0044 #define DPMCP_CMD_BASE_VERSION      1
0045 #define DPMCP_CMD_ID_OFFSET     4
0046 
0047 #define DPMCP_CMD(id)   (((id) << DPMCP_CMD_ID_OFFSET) | DPMCP_CMD_BASE_VERSION)
0048 
0049 /* DPMCP command IDs */
0050 #define DPMCP_CMDID_CLOSE       DPMCP_CMD(0x800)
0051 #define DPMCP_CMDID_RESET       DPMCP_CMD(0x005)
0052 
0053 struct dpmcp_cmd_open {
0054     __le32 dpmcp_id;
0055 };
0056 
0057 /*
0058  * Initialization and runtime control APIs for DPMCP
0059  */
0060 int dpmcp_open(struct fsl_mc_io *mc_io,
0061            u32 cmd_flags,
0062            int dpmcp_id,
0063            u16 *token);
0064 
0065 int dpmcp_close(struct fsl_mc_io *mc_io,
0066         u32 cmd_flags,
0067         u16 token);
0068 
0069 int dpmcp_reset(struct fsl_mc_io *mc_io,
0070         u32 cmd_flags,
0071         u16 token);
0072 
0073 /*
0074  * Data Path Resource Container (DPRC) API
0075  */
0076 
0077 /* Minimal supported DPRC Version */
0078 #define DPRC_MIN_VER_MAJOR          6
0079 #define DPRC_MIN_VER_MINOR          0
0080 
0081 /* DPRC command versioning */
0082 #define DPRC_CMD_BASE_VERSION           1
0083 #define DPRC_CMD_2ND_VERSION            2
0084 #define DPRC_CMD_3RD_VERSION            3
0085 #define DPRC_CMD_ID_OFFSET          4
0086 
0087 #define DPRC_CMD(id)    (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_BASE_VERSION)
0088 #define DPRC_CMD_V2(id) (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_2ND_VERSION)
0089 #define DPRC_CMD_V3(id) (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_3RD_VERSION)
0090 
0091 /* DPRC command IDs */
0092 #define DPRC_CMDID_CLOSE                        DPRC_CMD(0x800)
0093 #define DPRC_CMDID_GET_API_VERSION              DPRC_CMD(0xa05)
0094 
0095 #define DPRC_CMDID_GET_ATTR                     DPRC_CMD(0x004)
0096 #define DPRC_CMDID_RESET_CONT                   DPRC_CMD(0x005)
0097 #define DPRC_CMDID_RESET_CONT_V2                DPRC_CMD_V2(0x005)
0098 
0099 #define DPRC_CMDID_SET_IRQ                      DPRC_CMD(0x010)
0100 #define DPRC_CMDID_SET_IRQ_ENABLE               DPRC_CMD(0x012)
0101 #define DPRC_CMDID_SET_IRQ_MASK                 DPRC_CMD(0x014)
0102 #define DPRC_CMDID_GET_IRQ_STATUS               DPRC_CMD(0x016)
0103 #define DPRC_CMDID_CLEAR_IRQ_STATUS             DPRC_CMD(0x017)
0104 
0105 #define DPRC_CMDID_GET_CONT_ID                  DPRC_CMD(0x830)
0106 #define DPRC_CMDID_GET_OBJ_COUNT                DPRC_CMD(0x159)
0107 #define DPRC_CMDID_GET_OBJ                      DPRC_CMD(0x15A)
0108 #define DPRC_CMDID_GET_OBJ_REG                  DPRC_CMD(0x15E)
0109 #define DPRC_CMDID_GET_OBJ_REG_V2               DPRC_CMD_V2(0x15E)
0110 #define DPRC_CMDID_GET_OBJ_REG_V3               DPRC_CMD_V3(0x15E)
0111 #define DPRC_CMDID_SET_OBJ_IRQ                  DPRC_CMD(0x15F)
0112 
0113 #define DPRC_CMDID_GET_CONNECTION               DPRC_CMD(0x16C)
0114 
0115 struct dprc_cmd_open {
0116     __le32 container_id;
0117 };
0118 
0119 struct dprc_cmd_reset_container {
0120     __le32 child_container_id;
0121     __le32 options;
0122 };
0123 
0124 struct dprc_cmd_set_irq {
0125     /* cmd word 0 */
0126     __le32 irq_val;
0127     u8 irq_index;
0128     u8 pad[3];
0129     /* cmd word 1 */
0130     __le64 irq_addr;
0131     /* cmd word 2 */
0132     __le32 irq_num;
0133 };
0134 
0135 #define DPRC_ENABLE     0x1
0136 
0137 struct dprc_cmd_set_irq_enable {
0138     u8 enable;
0139     u8 pad[3];
0140     u8 irq_index;
0141 };
0142 
0143 struct dprc_cmd_set_irq_mask {
0144     __le32 mask;
0145     u8 irq_index;
0146 };
0147 
0148 struct dprc_cmd_get_irq_status {
0149     __le32 status;
0150     u8 irq_index;
0151 };
0152 
0153 struct dprc_rsp_get_irq_status {
0154     __le32 status;
0155 };
0156 
0157 struct dprc_cmd_clear_irq_status {
0158     __le32 status;
0159     u8 irq_index;
0160 };
0161 
0162 struct dprc_rsp_get_attributes {
0163     /* response word 0 */
0164     __le32 container_id;
0165     __le32 icid;
0166     /* response word 1 */
0167     __le32 options;
0168     __le32 portal_id;
0169 };
0170 
0171 struct dprc_rsp_get_obj_count {
0172     __le32 pad;
0173     __le32 obj_count;
0174 };
0175 
0176 struct dprc_cmd_get_obj {
0177     __le32 obj_index;
0178 };
0179 
0180 struct dprc_rsp_get_obj {
0181     /* response word 0 */
0182     __le32 pad0;
0183     __le32 id;
0184     /* response word 1 */
0185     __le16 vendor;
0186     u8 irq_count;
0187     u8 region_count;
0188     __le32 state;
0189     /* response word 2 */
0190     __le16 version_major;
0191     __le16 version_minor;
0192     __le16 flags;
0193     __le16 pad1;
0194     /* response word 3-4 */
0195     u8 type[16];
0196     /* response word 5-6 */
0197     u8 label[16];
0198 };
0199 
0200 struct dprc_cmd_get_obj_region {
0201     /* cmd word 0 */
0202     __le32 obj_id;
0203     __le16 pad0;
0204     u8 region_index;
0205     u8 pad1;
0206     /* cmd word 1-2 */
0207     __le64 pad2[2];
0208     /* cmd word 3-4 */
0209     u8 obj_type[16];
0210 };
0211 
0212 struct dprc_rsp_get_obj_region {
0213     /* response word 0 */
0214     __le64 pad0;
0215     /* response word 1 */
0216     __le64 base_offset;
0217     /* response word 2 */
0218     __le32 size;
0219     u8 type;
0220     u8 pad2[3];
0221     /* response word 3 */
0222     __le32 flags;
0223     __le32 pad3;
0224     /* response word 4 */
0225     /* base_addr may be zero if older MC firmware is used */
0226     __le64 base_addr;
0227 };
0228 
0229 struct dprc_cmd_set_obj_irq {
0230     /* cmd word 0 */
0231     __le32 irq_val;
0232     u8 irq_index;
0233     u8 pad[3];
0234     /* cmd word 1 */
0235     __le64 irq_addr;
0236     /* cmd word 2 */
0237     __le32 irq_num;
0238     __le32 obj_id;
0239     /* cmd word 3-4 */
0240     u8 obj_type[16];
0241 };
0242 
0243 struct dprc_cmd_get_connection {
0244     __le32 ep1_id;
0245     __le16 ep1_interface_id;
0246     u8 pad[2];
0247     u8 ep1_type[16];
0248 };
0249 
0250 struct dprc_rsp_get_connection {
0251     __le64 pad[3];
0252     __le32 ep2_id;
0253     __le16 ep2_interface_id;
0254     __le16 pad1;
0255     u8 ep2_type[16];
0256     __le32 state;
0257 };
0258 
0259 /*
0260  * DPRC API for managing and querying DPAA resources
0261  */
0262 int dprc_open(struct fsl_mc_io *mc_io,
0263           u32 cmd_flags,
0264           int container_id,
0265           u16 *token);
0266 
0267 int dprc_close(struct fsl_mc_io *mc_io,
0268            u32 cmd_flags,
0269            u16 token);
0270 
0271 /* DPRC IRQ events */
0272 
0273 /* IRQ event - Indicates that a new object added to the container */
0274 #define DPRC_IRQ_EVENT_OBJ_ADDED        0x00000001
0275 /* IRQ event - Indicates that an object was removed from the container */
0276 #define DPRC_IRQ_EVENT_OBJ_REMOVED      0x00000002
0277 /*
0278  * IRQ event - Indicates that one of the descendant containers that opened by
0279  * this container is destroyed
0280  */
0281 #define DPRC_IRQ_EVENT_CONTAINER_DESTROYED  0x00000010
0282 
0283 /*
0284  * IRQ event - Indicates that on one of the container's opened object is
0285  * destroyed
0286  */
0287 #define DPRC_IRQ_EVENT_OBJ_DESTROYED        0x00000020
0288 
0289 /* Irq event - Indicates that object is created at the container */
0290 #define DPRC_IRQ_EVENT_OBJ_CREATED      0x00000040
0291 
0292 /**
0293  * struct dprc_irq_cfg - IRQ configuration
0294  * @paddr:  Address that must be written to signal a message-based interrupt
0295  * @val:    Value to write into irq_addr address
0296  * @irq_num:    A user defined number associated with this IRQ
0297  */
0298 struct dprc_irq_cfg {
0299          phys_addr_t paddr;
0300          u32 val;
0301          int irq_num;
0302 };
0303 
0304 int dprc_set_irq(struct fsl_mc_io *mc_io,
0305          u32 cmd_flags,
0306          u16 token,
0307          u8 irq_index,
0308          struct dprc_irq_cfg *irq_cfg);
0309 
0310 int dprc_set_irq_enable(struct fsl_mc_io *mc_io,
0311             u32 cmd_flags,
0312             u16 token,
0313             u8 irq_index,
0314             u8 en);
0315 
0316 int dprc_set_irq_mask(struct fsl_mc_io *mc_io,
0317               u32 cmd_flags,
0318               u16 token,
0319               u8 irq_index,
0320               u32 mask);
0321 
0322 int dprc_get_irq_status(struct fsl_mc_io *mc_io,
0323             u32 cmd_flags,
0324             u16 token,
0325             u8 irq_index,
0326             u32 *status);
0327 
0328 int dprc_clear_irq_status(struct fsl_mc_io *mc_io,
0329               u32 cmd_flags,
0330               u16 token,
0331               u8 irq_index,
0332               u32 status);
0333 
0334 /**
0335  * struct dprc_attributes - Container attributes
0336  * @container_id: Container's ID
0337  * @icid: Container's ICID
0338  * @portal_id: Container's portal ID
0339  * @options: Container's options as set at container's creation
0340  */
0341 struct dprc_attributes {
0342     int container_id;
0343     u32 icid;
0344     int portal_id;
0345     u64 options;
0346 };
0347 
0348 int dprc_get_attributes(struct fsl_mc_io *mc_io,
0349             u32 cmd_flags,
0350             u16 token,
0351             struct dprc_attributes *attributes);
0352 
0353 int dprc_get_obj_count(struct fsl_mc_io *mc_io,
0354                u32 cmd_flags,
0355                u16 token,
0356                int *obj_count);
0357 
0358 int dprc_get_obj(struct fsl_mc_io *mc_io,
0359          u32 cmd_flags,
0360          u16 token,
0361          int obj_index,
0362          struct fsl_mc_obj_desc *obj_desc);
0363 
0364 int dprc_set_obj_irq(struct fsl_mc_io *mc_io,
0365              u32 cmd_flags,
0366              u16 token,
0367              char *obj_type,
0368              int obj_id,
0369              u8 irq_index,
0370              struct dprc_irq_cfg *irq_cfg);
0371 /**
0372  * enum dprc_region_type - Region type
0373  * @DPRC_REGION_TYPE_MC_PORTAL: MC portal region
0374  * @DPRC_REGION_TYPE_QBMAN_PORTAL: Qbman portal region
0375  */
0376 enum dprc_region_type {
0377     DPRC_REGION_TYPE_MC_PORTAL,
0378     DPRC_REGION_TYPE_QBMAN_PORTAL,
0379     DPRC_REGION_TYPE_QBMAN_MEM_BACKED_PORTAL
0380 };
0381 
0382 /**
0383  * struct dprc_region_desc - Mappable region descriptor
0384  * @base_offset: Region offset from region's base address.
0385  *  For DPMCP and DPRC objects, region base is offset from SoC MC portals
0386  *  base address; For DPIO, region base is offset from SoC QMan portals
0387  *  base address
0388  * @size: Region size (in bytes)
0389  * @flags: Region attributes
0390  * @type: Portal region type
0391  */
0392 struct dprc_region_desc {
0393     u32 base_offset;
0394     u32 size;
0395     u32 flags;
0396     enum dprc_region_type type;
0397     u64 base_address;
0398 };
0399 
0400 int dprc_get_obj_region(struct fsl_mc_io *mc_io,
0401             u32 cmd_flags,
0402             u16 token,
0403             char *obj_type,
0404             int obj_id,
0405             u8 region_index,
0406             struct dprc_region_desc *region_desc);
0407 
0408 int dprc_get_api_version(struct fsl_mc_io *mc_io,
0409              u32 cmd_flags,
0410              u16 *major_ver,
0411              u16 *minor_ver);
0412 
0413 int dprc_get_container_id(struct fsl_mc_io *mc_io,
0414               u32 cmd_flags,
0415               int *container_id);
0416 
0417 /**
0418  * struct dprc_endpoint - Endpoint description for link connect/disconnect
0419  *          operations
0420  * @type:   Endpoint object type: NULL terminated string
0421  * @id:     Endpoint object ID
0422  * @if_id:  Interface ID; should be set for endpoints with multiple
0423  *      interfaces ("dpsw", "dpdmux"); for others, always set to 0
0424  */
0425 struct dprc_endpoint {
0426     char type[16];
0427     int id;
0428     u16 if_id;
0429 };
0430 
0431 int dprc_get_connection(struct fsl_mc_io *mc_io,
0432             u32 cmd_flags,
0433             u16 token,
0434             const struct dprc_endpoint *endpoint1,
0435             struct dprc_endpoint *endpoint2,
0436             int *state);
0437 
0438 /*
0439  * Data Path Buffer Pool (DPBP) API
0440  */
0441 
0442 /* DPBP Version */
0443 #define DPBP_VER_MAJOR              3
0444 #define DPBP_VER_MINOR              2
0445 
0446 /* Command versioning */
0447 #define DPBP_CMD_BASE_VERSION           1
0448 #define DPBP_CMD_ID_OFFSET          4
0449 
0450 #define DPBP_CMD(id)    (((id) << DPBP_CMD_ID_OFFSET) | DPBP_CMD_BASE_VERSION)
0451 
0452 /* Command IDs */
0453 #define DPBP_CMDID_CLOSE        DPBP_CMD(0x800)
0454 
0455 #define DPBP_CMDID_ENABLE       DPBP_CMD(0x002)
0456 #define DPBP_CMDID_DISABLE      DPBP_CMD(0x003)
0457 #define DPBP_CMDID_GET_ATTR     DPBP_CMD(0x004)
0458 #define DPBP_CMDID_RESET        DPBP_CMD(0x005)
0459 
0460 struct dpbp_cmd_open {
0461     __le32 dpbp_id;
0462 };
0463 
0464 #define DPBP_ENABLE         0x1
0465 
0466 struct dpbp_rsp_get_attributes {
0467     /* response word 0 */
0468     __le16 pad;
0469     __le16 bpid;
0470     __le32 id;
0471     /* response word 1 */
0472     __le16 version_major;
0473     __le16 version_minor;
0474 };
0475 
0476 /*
0477  * Data Path Concentrator (DPCON) API
0478  */
0479 
0480 /* DPCON Version */
0481 #define DPCON_VER_MAJOR             3
0482 #define DPCON_VER_MINOR             2
0483 
0484 /* Command versioning */
0485 #define DPCON_CMD_BASE_VERSION          1
0486 #define DPCON_CMD_ID_OFFSET         4
0487 
0488 #define DPCON_CMD(id)   (((id) << DPCON_CMD_ID_OFFSET) | DPCON_CMD_BASE_VERSION)
0489 
0490 /* Command IDs */
0491 #define DPCON_CMDID_CLOSE           DPCON_CMD(0x800)
0492 
0493 #define DPCON_CMDID_ENABLE          DPCON_CMD(0x002)
0494 #define DPCON_CMDID_DISABLE         DPCON_CMD(0x003)
0495 #define DPCON_CMDID_GET_ATTR            DPCON_CMD(0x004)
0496 #define DPCON_CMDID_RESET           DPCON_CMD(0x005)
0497 
0498 #define DPCON_CMDID_SET_NOTIFICATION        DPCON_CMD(0x100)
0499 
0500 struct dpcon_cmd_open {
0501     __le32 dpcon_id;
0502 };
0503 
0504 #define DPCON_ENABLE            1
0505 
0506 struct dpcon_rsp_get_attr {
0507     /* response word 0 */
0508     __le32 id;
0509     __le16 qbman_ch_id;
0510     u8 num_priorities;
0511     u8 pad;
0512 };
0513 
0514 struct dpcon_cmd_set_notification {
0515     /* cmd word 0 */
0516     __le32 dpio_id;
0517     u8 priority;
0518     u8 pad[3];
0519     /* cmd word 1 */
0520     __le64 user_ctx;
0521 };
0522 
0523 /*
0524  * Generic FSL MC API
0525  */
0526 
0527 /* generic command versioning */
0528 #define OBJ_CMD_BASE_VERSION        1
0529 #define OBJ_CMD_ID_OFFSET       4
0530 
0531 #define OBJ_CMD(id) (((id) << OBJ_CMD_ID_OFFSET) | OBJ_CMD_BASE_VERSION)
0532 
0533 /* open command codes */
0534 #define DPRTC_CMDID_OPEN        OBJ_CMD(0x810)
0535 #define DPNI_CMDID_OPEN     OBJ_CMD(0x801)
0536 #define DPSW_CMDID_OPEN     OBJ_CMD(0x802)
0537 #define DPIO_CMDID_OPEN     OBJ_CMD(0x803)
0538 #define DPBP_CMDID_OPEN     OBJ_CMD(0x804)
0539 #define DPRC_CMDID_OPEN     OBJ_CMD(0x805)
0540 #define DPDMUX_CMDID_OPEN       OBJ_CMD(0x806)
0541 #define DPCI_CMDID_OPEN     OBJ_CMD(0x807)
0542 #define DPCON_CMDID_OPEN        OBJ_CMD(0x808)
0543 #define DPSECI_CMDID_OPEN       OBJ_CMD(0x809)
0544 #define DPAIOP_CMDID_OPEN       OBJ_CMD(0x80a)
0545 #define DPMCP_CMDID_OPEN        OBJ_CMD(0x80b)
0546 #define DPMAC_CMDID_OPEN        OBJ_CMD(0x80c)
0547 #define DPDCEI_CMDID_OPEN       OBJ_CMD(0x80d)
0548 #define DPDMAI_CMDID_OPEN       OBJ_CMD(0x80e)
0549 #define DPDBG_CMDID_OPEN        OBJ_CMD(0x80f)
0550 
0551 /* Generic object command IDs */
0552 #define OBJ_CMDID_CLOSE     OBJ_CMD(0x800)
0553 #define OBJ_CMDID_RESET     OBJ_CMD(0x005)
0554 
0555 struct fsl_mc_obj_cmd_open {
0556     __le32 obj_id;
0557 };
0558 
0559 /**
0560  * struct fsl_mc_resource_pool - Pool of MC resources of a given
0561  * type
0562  * @type: type of resources in the pool
0563  * @max_count: maximum number of resources in the pool
0564  * @free_count: number of free resources in the pool
0565  * @mutex: mutex to serialize access to the pool's free list
0566  * @free_list: anchor node of list of free resources in the pool
0567  * @mc_bus: pointer to the MC bus that owns this resource pool
0568  */
0569 struct fsl_mc_resource_pool {
0570     enum fsl_mc_pool_type type;
0571     int max_count;
0572     int free_count;
0573     struct mutex mutex; /* serializes access to free_list */
0574     struct list_head free_list;
0575     struct fsl_mc_bus *mc_bus;
0576 };
0577 
0578 /**
0579  * struct fsl_mc_uapi - information associated with a device file
0580  * @misc: struct miscdevice linked to the root dprc
0581  * @device: newly created device in /dev
0582  * @mutex: mutex lock to serialize the open/release operations
0583  * @local_instance_in_use: local MC I/O instance in use or not
0584  * @static_mc_io: pointer to the static MC I/O object
0585  */
0586 struct fsl_mc_uapi {
0587     struct miscdevice misc;
0588     struct device *device;
0589     struct mutex mutex; /* serialize open/release operations */
0590     u32 local_instance_in_use;
0591     struct fsl_mc_io *static_mc_io;
0592 };
0593 
0594 /**
0595  * struct fsl_mc_bus - logical bus that corresponds to a physical DPRC
0596  * @mc_dev: fsl-mc device for the bus device itself.
0597  * @resource_pools: array of resource pools (one pool per resource type)
0598  * for this MC bus. These resources represent allocatable entities
0599  * from the physical DPRC.
0600  * @irq_resources: Pointer to array of IRQ objects for the IRQ pool
0601  * @scan_mutex: Serializes bus scanning
0602  * @dprc_attr: DPRC attributes
0603  * @uapi_misc: struct that abstracts the interaction with userspace
0604  */
0605 struct fsl_mc_bus {
0606     struct fsl_mc_device mc_dev;
0607     struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES];
0608     struct fsl_mc_device_irq *irq_resources;
0609     struct mutex scan_mutex;    /* serializes bus scanning */
0610     struct dprc_attributes dprc_attr;
0611     struct fsl_mc_uapi uapi_misc;
0612     int irq_enabled;
0613 };
0614 
0615 #define to_fsl_mc_bus(_mc_dev) \
0616     container_of(_mc_dev, struct fsl_mc_bus, mc_dev)
0617 
0618 int __must_check fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc,
0619                    struct fsl_mc_io *mc_io,
0620                    struct device *parent_dev,
0621                    struct fsl_mc_device **new_mc_dev);
0622 
0623 void fsl_mc_device_remove(struct fsl_mc_device *mc_dev);
0624 
0625 int __init dprc_driver_init(void);
0626 
0627 void dprc_driver_exit(void);
0628 
0629 int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev,
0630               bool alloc_interrupts);
0631 
0632 int __init fsl_mc_allocator_driver_init(void);
0633 
0634 void fsl_mc_allocator_driver_exit(void);
0635 
0636 void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
0637 
0638 void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
0639 
0640 int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus,
0641                       enum fsl_mc_pool_type pool_type,
0642                       struct fsl_mc_resource
0643                               **new_resource);
0644 
0645 void fsl_mc_resource_free(struct fsl_mc_resource *resource);
0646 
0647 int fsl_mc_msi_domain_alloc_irqs(struct device *dev,
0648                  unsigned int irq_count);
0649 
0650 void fsl_mc_msi_domain_free_irqs(struct device *dev);
0651 
0652 struct irq_domain *fsl_mc_find_msi_domain(struct device *dev);
0653 
0654 int __must_check fsl_create_mc_io(struct device *dev,
0655                   phys_addr_t mc_portal_phys_addr,
0656                   u32 mc_portal_size,
0657                   struct fsl_mc_device *dpmcp_dev,
0658                   u32 flags, struct fsl_mc_io **new_mc_io);
0659 
0660 void fsl_destroy_mc_io(struct fsl_mc_io *mc_io);
0661 
0662 bool fsl_mc_is_root_dprc(struct device *dev);
0663 
0664 void fsl_mc_get_root_dprc(struct device *dev,
0665              struct device **root_dprc_dev);
0666 
0667 struct fsl_mc_device *fsl_mc_device_lookup(struct fsl_mc_obj_desc *obj_desc,
0668                        struct fsl_mc_device *mc_bus_dev);
0669 
0670 u16 mc_cmd_hdr_read_cmdid(struct fsl_mc_command *cmd);
0671 
0672 #ifdef CONFIG_FSL_MC_UAPI_SUPPORT
0673 
0674 int fsl_mc_uapi_create_device_file(struct fsl_mc_bus *mc_bus);
0675 
0676 void fsl_mc_uapi_remove_device_file(struct fsl_mc_bus *mc_bus);
0677 
0678 #else
0679 
0680 static inline int fsl_mc_uapi_create_device_file(struct fsl_mc_bus *mc_bus)
0681 {
0682     return 0;
0683 }
0684 
0685 static inline void fsl_mc_uapi_remove_device_file(struct fsl_mc_bus *mc_bus)
0686 {
0687 }
0688 
0689 #endif
0690 
0691 int disable_dprc_irq(struct fsl_mc_device *mc_dev);
0692 int enable_dprc_irq(struct fsl_mc_device *mc_dev);
0693 int get_dprc_irq_state(struct fsl_mc_device *mc_dev);
0694 
0695 #endif /* _FSL_MC_PRIVATE_H_ */