#define DPRC_CMDID_GET_ATTR DPRC_CMD(0x004)
#define DPRC_CMDID_SET_IRQ DPRC_CMD(0x010)
-#define DPRC_CMDID_GET_IRQ DPRC_CMD(0x011)
#define DPRC_CMDID_SET_IRQ_ENABLE DPRC_CMD(0x012)
-#define DPRC_CMDID_GET_IRQ_ENABLE DPRC_CMD(0x013)
#define DPRC_CMDID_SET_IRQ_MASK DPRC_CMD(0x014)
-#define DPRC_CMDID_GET_IRQ_MASK DPRC_CMD(0x015)
#define DPRC_CMDID_GET_IRQ_STATUS DPRC_CMD(0x016)
#define DPRC_CMDID_CLEAR_IRQ_STATUS DPRC_CMD(0x017)
#define DPRC_CMDID_GET_CONT_ID DPRC_CMD(0x830)
#define DPRC_CMDID_GET_OBJ_COUNT DPRC_CMD(0x159)
#define DPRC_CMDID_GET_OBJ DPRC_CMD(0x15A)
-#define DPRC_CMDID_GET_RES_COUNT DPRC_CMD(0x15B)
#define DPRC_CMDID_GET_OBJ_REG DPRC_CMD(0x15E)
#define DPRC_CMDID_SET_OBJ_IRQ DPRC_CMD(0x15F)
-#define DPRC_CMDID_GET_OBJ_IRQ DPRC_CMD(0x160)
struct dprc_cmd_open {
__le32 container_id;
};
-struct dprc_cmd_create_container {
- /* cmd word 0 */
- __le32 options;
- __le16 icid;
- __le16 pad0;
- /* cmd word 1 */
- __le32 pad1;
- __le32 portal_id;
- /* cmd words 2-3 */
- u8 label[16];
-};
-
-struct dprc_rsp_create_container {
- /* response word 0 */
- __le64 pad0;
- /* response word 1 */
- __le32 child_container_id;
- __le32 pad1;
- /* response word 2 */
- __le64 child_portal_addr;
-};
-
-struct dprc_cmd_destroy_container {
- __le32 child_container_id;
-};
-
-struct dprc_cmd_reset_container {
- __le32 child_container_id;
-};
-
struct dprc_cmd_set_irq {
/* cmd word 0 */
__le32 irq_val;
__le32 irq_num;
};
-struct dprc_cmd_get_irq {
- __le32 pad;
- u8 irq_index;
-};
-
-struct dprc_rsp_get_irq {
- /* response word 0 */
- __le32 irq_val;
- __le32 pad;
- /* response word 1 */
- __le64 irq_addr;
- /* response word 2 */
- __le32 irq_num;
- __le32 type;
-};
-
#define DPRC_ENABLE 0x1
struct dprc_cmd_set_irq_enable {
u8 irq_index;
};
-struct dprc_cmd_get_irq_enable {
- __le32 pad;
- u8 irq_index;
-};
-
-struct dprc_rsp_get_irq_enable {
- u8 enabled;
-};
-
struct dprc_cmd_set_irq_mask {
__le32 mask;
u8 irq_index;
};
-struct dprc_cmd_get_irq_mask {
- __le32 pad;
- u8 irq_index;
-};
-
-struct dprc_rsp_get_irq_mask {
- __le32 mask;
-};
-
struct dprc_cmd_get_irq_status {
__le32 status;
u8 irq_index;
__le32 portal_id;
};
-struct dprc_cmd_set_res_quota {
- /* cmd word 0 */
- __le32 child_container_id;
- __le16 quota;
- __le16 pad;
- /* cmd words 1-2 */
- u8 type[16];
-};
-
-struct dprc_cmd_get_res_quota {
- /* cmd word 0 */
- __le32 child_container_id;
- __le32 pad;
- /* cmd word 1-2 */
- u8 type[16];
-};
-
-struct dprc_rsp_get_res_quota {
- __le32 pad;
- __le16 quota;
-};
-
-struct dprc_cmd_assign {
- /* cmd word 0 */
- __le32 container_id;
- __le32 options;
- /* cmd word 1 */
- __le32 num;
- __le32 id_base_align;
- /* cmd word 2-3 */
- u8 type[16];
-};
-
-struct dprc_cmd_unassign {
- /* cmd word 0 */
- __le32 child_container_id;
- __le32 options;
- /* cmd word 1 */
- __le32 num;
- __le32 id_base_align;
- /* cmd word 2-3 */
- u8 type[16];
-};
-
-struct dprc_rsp_get_pool_count {
- __le32 pool_count;
-};
-
-struct dprc_cmd_get_pool {
- __le32 pool_index;
-};
-
-struct dprc_rsp_get_pool {
- /* response word 0 */
- __le64 pad;
- /* response word 1-2 */
- u8 type[16];
-};
-
struct dprc_rsp_get_obj_count {
__le32 pad;
__le32 obj_count;
u8 label[16];
};
-struct dprc_cmd_get_obj_desc {
- /* cmd word 0 */
- __le32 obj_id;
- __le32 pad;
- /* cmd word 1-2 */
- u8 type[16];
-};
-
-struct dprc_rsp_get_obj_desc {
- /* response word 0 */
- __le32 pad0;
- __le32 id;
- /* response word 1 */
- __le16 vendor;
- u8 irq_count;
- u8 region_count;
- __le32 state;
- /* response word 2 */
- __le16 version_major;
- __le16 version_minor;
- __le16 flags;
- __le16 pad1;
- /* response word 3-4 */
- u8 type[16];
- /* response word 5-6 */
- u8 label[16];
-};
-
-struct dprc_cmd_get_res_count {
- /* cmd word 0 */
- __le64 pad;
- /* cmd word 1-2 */
- u8 type[16];
-};
-
-struct dprc_rsp_get_res_count {
- __le32 res_count;
-};
-
-struct dprc_cmd_get_res_ids {
- /* cmd word 0 */
- u8 pad0[5];
- u8 iter_status;
- __le16 pad1;
- /* cmd word 1 */
- __le32 base_id;
- __le32 last_id;
- /* cmd word 2-3 */
- u8 type[16];
-};
-
-struct dprc_rsp_get_res_ids {
- /* response word 0 */
- u8 pad0[5];
- u8 iter_status;
- __le16 pad1;
- /* response word 1 */
- __le32 base_id;
- __le32 last_id;
-};
-
struct dprc_cmd_get_obj_region {
/* cmd word 0 */
__le32 obj_id;
__le32 size;
};
-struct dprc_cmd_set_obj_label {
- /* cmd word 0 */
- __le32 obj_id;
- __le32 pad;
- /* cmd word 1-2 */
- u8 label[16];
- /* cmd word 3-4 */
- u8 obj_type[16];
-};
-
struct dprc_cmd_set_obj_irq {
/* cmd word 0 */
__le32 irq_val;
u8 obj_type[16];
};
-struct dprc_cmd_get_obj_irq {
- /* cmd word 0 */
- __le32 obj_id;
- u8 irq_index;
- u8 pad[3];
- /* cmd word 1-2 */
- u8 obj_type[16];
-};
-
-struct dprc_rsp_get_obj_irq {
- /* response word 0 */
- __le32 irq_val;
- __le32 pad;
- /* response word 1 */
- __le64 irq_addr;
- /* response word 2 */
- __le32 irq_num;
- __le32 type;
-};
-
-struct dprc_cmd_connect {
- /* cmd word 0 */
- __le32 ep1_id;
- __le32 ep1_interface_id;
- /* cmd word 1 */
- __le32 ep2_id;
- __le32 ep2_interface_id;
- /* cmd word 2-3 */
- u8 ep1_type[16];
- /* cmd word 4 */
- __le32 max_rate;
- __le32 committed_rate;
- /* cmd word 5-6 */
- u8 ep2_type[16];
-};
-
-struct dprc_cmd_disconnect {
- /* cmd word 0 */
- __le32 id;
- __le32 interface_id;
- /* cmd word 1-2 */
- u8 type[16];
-};
-
-struct dprc_cmd_get_connection {
- /* cmd word 0 */
- __le32 ep1_id;
- __le32 ep1_interface_id;
- /* cmd word 1-2 */
- u8 ep1_type[16];
-};
-
-struct dprc_rsp_get_connection {
- /* response word 0-2 */
- __le64 pad[3];
- /* response word 3 */
- __le32 ep2_id;
- __le32 ep2_interface_id;
- /* response word 4-5 */
- u8 ep2_type[16];
- /* response word 6 */
- __le32 state;
-};
-
#endif /* _FSL_DPRC_CMD_H */
EXPORT_SYMBOL_GPL(dprc_close);
/**
- * dprc_get_irq() - Get IRQ information from the DPRC.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPRC object
- * @irq_index: The interrupt index to configure
- * @type: Interrupt type: 0 represents message interrupt
- * type (both irq_addr and irq_val are valid)
- * @irq_cfg: IRQ attributes
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_get_irq(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 token,
- u8 irq_index,
- int *type,
- struct dprc_irq_cfg *irq_cfg)
-{
- struct mc_command cmd = { 0 };
- struct dprc_cmd_get_irq *cmd_params;
- struct dprc_rsp_get_irq *rsp_params;
- int err;
-
- /* prepare command */
- cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ,
- cmd_flags,
- token);
- cmd_params = (struct dprc_cmd_get_irq *)cmd.params;
- cmd_params->irq_index = irq_index;
-
- /* send command to mc*/
- err = mc_send_command(mc_io, &cmd);
- if (err)
- return err;
-
- /* retrieve response parameters */
- rsp_params = (struct dprc_rsp_get_irq *)cmd.params;
- irq_cfg->val = le32_to_cpu(rsp_params->irq_val);
- irq_cfg->paddr = le64_to_cpu(rsp_params->irq_addr);
- irq_cfg->irq_num = le32_to_cpu(rsp_params->irq_num);
- *type = le32_to_cpu(rsp_params->type);
-
- return 0;
-}
-
-/**
* dprc_set_irq() - Set IRQ information for the DPRC to trigger an interrupt.
* @mc_io: Pointer to MC portal's I/O object
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
}
/**
- * dprc_get_irq_enable() - Get overall interrupt state.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPRC object
- * @irq_index: The interrupt index to configure
- * @en: Returned interrupt state - enable = 1, disable = 0
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_get_irq_enable(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 token,
- u8 irq_index,
- u8 *en)
-{
- struct mc_command cmd = { 0 };
- struct dprc_cmd_get_irq_enable *cmd_params;
- struct dprc_rsp_get_irq_enable *rsp_params;
- int err;
-
- /* prepare command */
- cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_ENABLE,
- cmd_flags, token);
- cmd_params = (struct dprc_cmd_get_irq_enable *)cmd.params;
- cmd_params->irq_index = irq_index;
-
- /* send command to mc*/
- err = mc_send_command(mc_io, &cmd);
- if (err)
- return err;
-
- /* retrieve response parameters */
- rsp_params = (struct dprc_rsp_get_irq_enable *)cmd.params;
- *en = rsp_params->enabled & DPRC_ENABLE;
-
- return 0;
-}
-
-/**
* dprc_set_irq_enable() - Set overall interrupt state.
* @mc_io: Pointer to MC portal's I/O object
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
}
/**
- * dprc_get_irq_mask() - Get interrupt mask.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPRC object
- * @irq_index: The interrupt index to configure
- * @mask: Returned event mask to trigger interrupt
- *
- * Every interrupt can have up to 32 causes and the interrupt model supports
- * masking/unmasking each cause independently
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_get_irq_mask(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 token,
- u8 irq_index,
- u32 *mask)
-{
- struct mc_command cmd = { 0 };
- struct dprc_cmd_get_irq_mask *cmd_params;
- struct dprc_rsp_get_irq_mask *rsp_params;
- int err;
-
- /* prepare command */
- cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_MASK,
- cmd_flags, token);
- cmd_params = (struct dprc_cmd_get_irq_mask *)cmd.params;
- cmd_params->irq_index = irq_index;
-
- /* send command to mc*/
- err = mc_send_command(mc_io, &cmd);
- if (err)
- return err;
-
- /* retrieve response parameters */
- rsp_params = (struct dprc_rsp_get_irq_mask *)cmd.params;
- *mask = le32_to_cpu(rsp_params->mask);
-
- return 0;
-}
-
-/**
* dprc_set_irq_mask() - Set interrupt mask.
* @mc_io: Pointer to MC portal's I/O object
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
EXPORT_SYMBOL_GPL(dprc_set_obj_irq);
/**
- * dprc_get_obj_irq() - Get IRQ information from object.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPRC object
- * @obj_type: Type od the object to get its IRQ
- * @obj_id: ID of the object to get its IRQ
- * @irq_index: The interrupt index to configure
- * @type: Interrupt type: 0 represents message interrupt
- * type (both irq_addr and irq_val are valid)
- * @irq_cfg: The returned IRQ attributes
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_get_obj_irq(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 token,
- char *obj_type,
- int obj_id,
- u8 irq_index,
- int *type,
- struct dprc_irq_cfg *irq_cfg)
-{
- struct mc_command cmd = { 0 };
- struct dprc_cmd_get_obj_irq *cmd_params;
- struct dprc_rsp_get_obj_irq *rsp_params;
- int err;
-
- /* prepare command */
- cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_IRQ,
- cmd_flags,
- token);
- cmd_params = (struct dprc_cmd_get_obj_irq *)cmd.params;
- cmd_params->obj_id = cpu_to_le32(obj_id);
- cmd_params->irq_index = irq_index;
- strncpy(cmd_params->obj_type, obj_type, 16);
- cmd_params->obj_type[15] = '\0';
-
- /* send command to mc*/
- err = mc_send_command(mc_io, &cmd);
- if (err)
- return err;
-
- /* retrieve response parameters */
- rsp_params = (struct dprc_rsp_get_obj_irq *)cmd.params;
- irq_cfg->val = le32_to_cpu(rsp_params->irq_val);
- irq_cfg->paddr = le64_to_cpu(rsp_params->irq_addr);
- irq_cfg->irq_num = le32_to_cpu(rsp_params->irq_num);
- *type = le32_to_cpu(rsp_params->type);
-
- return 0;
-}
-EXPORT_SYMBOL_GPL(dprc_get_obj_irq);
-
-/**
- * dprc_get_res_count() - Obtains the number of free resources that are assigned
- * to this container, by pool type
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPRC object
- * @type: pool type
- * @res_count: Returned number of free resources of the given
- * resource type that are assigned to this DPRC
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_get_res_count(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 token,
- char *type,
- int *res_count)
-{
- struct mc_command cmd = { 0 };
- struct dprc_cmd_get_res_count *cmd_params;
- struct dprc_rsp_get_res_count *rsp_params;
- int err;
-
- /* prepare command */
- cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_COUNT,
- cmd_flags, token);
- cmd_params = (struct dprc_cmd_get_res_count *)cmd.params;
- strncpy(cmd_params->type, type, 16);
- cmd_params->type[15] = '\0';
-
- /* send command to mc*/
- err = mc_send_command(mc_io, &cmd);
- if (err)
- return err;
-
- /* retrieve response parameters */
- rsp_params = (struct dprc_rsp_get_res_count *)cmd.params;
- *res_count = le32_to_cpu(rsp_params->res_count);
-
- return 0;
-}
-EXPORT_SYMBOL_GPL(dprc_get_res_count);
-
-/**
* dprc_get_obj_region() - Get region information for a specified object.
* @mc_io: Pointer to MC portal's I/O object
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
u32 cmd_flags,
u16 token);
-/* IRQ */
-
-/* IRQ index */
-#define DPRC_IRQ_INDEX 0
-
-/* Number of dprc's IRQs */
-#define DPRC_NUM_OF_IRQS 1
-
/* DPRC IRQ events */
/* IRQ event - Indicates that a new object added to the container */
#define DPRC_IRQ_EVENT_OBJ_ADDED 0x00000001
/* IRQ event - Indicates that an object was removed from the container */
#define DPRC_IRQ_EVENT_OBJ_REMOVED 0x00000002
-/* IRQ event - Indicates that resources added to the container */
-#define DPRC_IRQ_EVENT_RES_ADDED 0x00000004
-/* IRQ event - Indicates that resources removed from the container */
-#define DPRC_IRQ_EVENT_RES_REMOVED 0x00000008
/*
* IRQ event - Indicates that one of the descendant containers that opened by
* this container is destroyed
u8 irq_index,
struct dprc_irq_cfg *irq_cfg);
-int dprc_get_irq(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 token,
- u8 irq_index,
- int *type,
- struct dprc_irq_cfg *irq_cfg);
-
int dprc_set_irq_enable(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token,
u8 irq_index,
u8 en);
-int dprc_get_irq_enable(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 token,
- u8 irq_index,
- u8 *en);
-
int dprc_set_irq_mask(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token,
u8 irq_index,
u32 mask);
-int dprc_get_irq_mask(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 token,
- u8 irq_index,
- u32 *mask);
-
int dprc_get_irq_status(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token,
int obj_index,
struct fsl_mc_obj_desc *obj_desc);
-int dprc_get_obj_desc(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 token,
- char *obj_type,
- int obj_id,
- struct fsl_mc_obj_desc *obj_desc);
-
int dprc_set_obj_irq(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token,
u8 irq_index,
struct dprc_irq_cfg *irq_cfg);
-int dprc_get_obj_irq(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 token,
- char *obj_type,
- int obj_id,
- u8 irq_index,
- int *type,
- struct dprc_irq_cfg *irq_cfg);
-
-int dprc_get_res_count(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 token,
- char *type,
- int *res_count);
-
-/**
- * enum dprc_iter_status - Iteration status
- * @DPRC_ITER_STATUS_FIRST: Perform first iteration
- * @DPRC_ITER_STATUS_MORE: Indicates more/next iteration is needed
- * @DPRC_ITER_STATUS_LAST: Indicates last iteration
- */
-enum dprc_iter_status {
- DPRC_ITER_STATUS_FIRST = 0,
- DPRC_ITER_STATUS_MORE = 1,
- DPRC_ITER_STATUS_LAST = 2
-};
-
/* Region flags */
/* Cacheable - Indicates that region should be mapped as cacheable */
#define DPRC_REGION_CACHEABLE 0x00000001