From: Ioana Ciornei Date: Wed, 31 May 2023 16:04:29 +0000 (+0300) Subject: net: fsl-mc: remove unused MC APIs X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=f21d326be420e2710673974d85debd2c345cc0c7;p=u-boot.git net: fsl-mc: remove unused MC APIs There are multiple MC APIs which were added years ago but they are not used at all in the u-boot source code. Remove all these APIs. Signed-off-by: Ioana Ciornei Signed-off-by: Peng Fan --- diff --git a/drivers/net/fsl-mc/dpio/dpio.c b/drivers/net/fsl-mc/dpio/dpio.c index 8884455963..30ecc9124b 100644 --- a/drivers/net/fsl-mc/dpio/dpio.c +++ b/drivers/net/fsl-mc/dpio/dpio.c @@ -123,21 +123,6 @@ int dpio_disable(struct fsl_mc_io *mc_io, return mc_send_command(mc_io, &cmd); } -int dpio_reset(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token) -{ - struct mc_command cmd = { 0 }; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPIO_CMDID_RESET, - cmd_flags, - token); - - /* send command to mc*/ - return mc_send_command(mc_io, &cmd); -} - int dpio_get_attributes(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, diff --git a/drivers/net/fsl-mc/dpmac.c b/drivers/net/fsl-mc/dpmac.c index 43a2ff43f8..f6def987c1 100644 --- a/drivers/net/fsl-mc/dpmac.c +++ b/drivers/net/fsl-mc/dpmac.c @@ -95,95 +95,6 @@ int dpmac_destroy(struct fsl_mc_io *mc_io, return mc_send_command(mc_io, &cmd); } -int dpmac_get_attributes(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - struct dpmac_attr *attr) -{ - struct mc_command cmd = { 0 }; - int err; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPMAC_CMDID_GET_ATTR, - cmd_flags, - token); - - /* send command to mc*/ - err = mc_send_command(mc_io, &cmd); - if (err) - return err; - - /* retrieve response parameters */ - DPMAC_RSP_GET_ATTRIBUTES(cmd, attr); - - return 0; -} - -int dpmac_mdio_read(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - struct dpmac_mdio_cfg *cfg) -{ - struct mc_command cmd = { 0 }; - int err; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPMAC_CMDID_MDIO_READ, - cmd_flags, - token); - DPMAC_CMD_MDIO_READ(cmd, cfg); - - /* send command to mc*/ - err = mc_send_command(mc_io, &cmd); - if (err) - return err; - - /* retrieve response parameters */ - DPMAC_RSP_MDIO_READ(cmd, cfg->data); - - return 0; -} - -int dpmac_mdio_write(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - struct dpmac_mdio_cfg *cfg) -{ - struct mc_command cmd = { 0 }; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPMAC_CMDID_MDIO_WRITE, - cmd_flags, - token); - DPMAC_CMD_MDIO_WRITE(cmd, cfg); - - /* send command to mc*/ - return mc_send_command(mc_io, &cmd); -} - -int dpmac_get_link_cfg(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - struct dpmac_link_cfg *cfg) -{ - struct mc_command cmd = { 0 }; - int err = 0; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPMAC_CMDID_GET_LINK_CFG, - cmd_flags, - token); - - /* send command to mc*/ - err = mc_send_command(mc_io, &cmd); - if (err) - return err; - - DPMAC_RSP_GET_LINK_CFG(cmd, cfg); - - return 0; -} - int dpmac_set_link_state(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, diff --git a/drivers/net/fsl-mc/dpni.c b/drivers/net/fsl-mc/dpni.c index a31abbff71..d0596a8e38 100644 --- a/drivers/net/fsl-mc/dpni.c +++ b/drivers/net/fsl-mc/dpni.c @@ -18,16 +18,6 @@ int dpni_prepare_cfg(const struct dpni_cfg *cfg, return 0; } -int dpni_extract_cfg(struct dpni_cfg *cfg, - const uint8_t *cfg_buf) -{ - uint64_t *params = (uint64_t *)cfg_buf; - - DPNI_EXT_CFG(params, cfg); - - return 0; -} - int dpni_open(struct fsl_mc_io *mc_io, uint32_t cmd_flags, int dpni_id, @@ -198,23 +188,6 @@ int dpni_get_attributes(struct fsl_mc_io *mc_io, return 0; } -int dpni_set_errors_behavior(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - struct dpni_error_cfg *cfg) -{ - struct mc_command cmd = { 0 }; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_ERRORS_BEHAVIOR, - cmd_flags, - token); - DPNI_CMD_SET_ERRORS_BEHAVIOR(cmd, cfg); - - /* send command to mc*/ - return mc_send_command(mc_io, &cmd); -} - int dpni_set_buffer_layout(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, @@ -322,48 +295,6 @@ int dpni_get_link_state(struct fsl_mc_io *mc_io, return 0; } - -int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - const uint8_t mac_addr[6]) -{ - struct mc_command cmd = { 0 }; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_PRIM_MAC, - cmd_flags, - token); - DPNI_CMD_SET_PRIMARY_MAC_ADDR(cmd, mac_addr); - - /* send command to mc*/ - return mc_send_command(mc_io, &cmd); -} - -int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - uint8_t mac_addr[6]) -{ - struct mc_command cmd = { 0 }; - int err; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_PRIM_MAC, - cmd_flags, - token); - - /* send command to mc*/ - err = mc_send_command(mc_io, &cmd); - if (err) - return err; - - /* retrieve response parameters */ - DPNI_RSP_GET_PRIMARY_MAC_ADDR(cmd, mac_addr); - - return 0; -} - int dpni_add_mac_addr(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, @@ -381,23 +312,6 @@ int dpni_add_mac_addr(struct fsl_mc_io *mc_io, return mc_send_command(mc_io, &cmd); } -int dpni_remove_mac_addr(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - const uint8_t mac_addr[6]) -{ - struct mc_command cmd = { 0 }; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPNI_CMDID_REMOVE_MAC_ADDR, - cmd_flags, - token); - DPNI_CMD_REMOVE_MAC_ADDR(cmd, mac_addr); - - /* send command to mc*/ - return mc_send_command(mc_io, &cmd); -} - int dpni_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 *major_ver, @@ -511,17 +425,3 @@ int dpni_get_statistics(struct fsl_mc_io *mc_io, return 0; } - -int dpni_reset_statistics(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token) -{ - struct mc_command cmd = { 0 }; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPNI_CMDID_RESET_STATISTICS, - cmd_flags, token); - - /* send command to mc*/ - return mc_send_command(mc_io, &cmd); -} diff --git a/drivers/net/fsl-mc/dprc.c b/drivers/net/fsl-mc/dprc.c index e0a2865ab8..2be56e24a1 100644 --- a/drivers/net/fsl-mc/dprc.c +++ b/drivers/net/fsl-mc/dprc.c @@ -117,179 +117,6 @@ int dprc_destroy_container(struct fsl_mc_io *mc_io, return mc_send_command(mc_io, &cmd); } -int dprc_reset_container(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - int child_container_id) -{ - struct mc_command cmd = { 0 }; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPRC_CMDID_RESET_CONT, - cmd_flags, - token); - DPRC_CMD_RESET_CONTAINER(cmd, child_container_id); - - /* send command to mc*/ - return mc_send_command(mc_io, &cmd); -} - -int dprc_get_attributes(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - struct dprc_attributes *attr) -{ - struct mc_command cmd = { 0 }; - int err; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_ATTR, - cmd_flags, - token); - - /* send command to mc*/ - err = mc_send_command(mc_io, &cmd); - if (err) - return err; - - /* retrieve response parameters */ - DPRC_RSP_GET_ATTRIBUTES(cmd, attr); - - return 0; -} - -int dprc_get_obj_count(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - int *obj_count) -{ - struct mc_command cmd = { 0 }; - int err; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_COUNT, - cmd_flags, - token); - - /* send command to mc*/ - err = mc_send_command(mc_io, &cmd); - if (err) - return err; - - /* retrieve response parameters */ - DPRC_RSP_GET_OBJ_COUNT(cmd, *obj_count); - - return 0; -} - -int dprc_get_obj(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - int obj_index, - struct dprc_obj_desc *obj_desc) -{ - struct mc_command cmd = { 0 }; - int err; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ, - cmd_flags, - token); - DPRC_CMD_GET_OBJ(cmd, obj_index); - - /* send command to mc*/ - err = mc_send_command(mc_io, &cmd); - if (err) - return err; - - /* retrieve response parameters */ - DPRC_RSP_GET_OBJ(cmd, obj_desc); - - return 0; -} - -int dprc_get_res_count(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - char *type, - int *res_count) -{ - struct mc_command cmd = { 0 }; - int err; - - *res_count = 0; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_COUNT, - cmd_flags, - token); - DPRC_CMD_GET_RES_COUNT(cmd, type); - - /* send command to mc*/ - err = mc_send_command(mc_io, &cmd); - if (err) - return err; - - /* retrieve response parameters */ - DPRC_RSP_GET_RES_COUNT(cmd, *res_count); - - return 0; -} - -int dprc_get_res_ids(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - char *type, - struct dprc_res_ids_range_desc *range_desc) -{ - struct mc_command cmd = { 0 }; - int err; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_IDS, - cmd_flags, - token); - DPRC_CMD_GET_RES_IDS(cmd, range_desc, type); - - /* send command to mc*/ - err = mc_send_command(mc_io, &cmd); - if (err) - return err; - - /* retrieve response parameters */ - DPRC_RSP_GET_RES_IDS(cmd, range_desc); - - return 0; -} - -int dprc_get_obj_region(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - char *obj_type, - int obj_id, - uint8_t region_index, - struct dprc_region_desc *region_desc) -{ - struct mc_command cmd = { 0 }; - int err; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_REG, - cmd_flags, - token); - DPRC_CMD_GET_OBJ_REGION(cmd, obj_type, obj_id, region_index); - - /* send command to mc*/ - err = mc_send_command(mc_io, &cmd); - if (err) - return err; - - /* retrieve response parameters */ - DPRC_RSP_GET_OBJ_REGION(cmd, region_desc); - - return 0; -} - int dprc_connect(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, diff --git a/include/fsl-mc/fsl_dpbp.h b/include/fsl-mc/fsl_dpbp.h index 2278ac952e..477a08ef26 100644 --- a/include/fsl-mc/fsl_dpbp.h +++ b/include/fsl-mc/fsl_dpbp.h @@ -155,20 +155,6 @@ int dpbp_disable(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token); -/** - * dpbp_is_enabled() - Check if the DPBP is enabled. - * @mc_io: Pointer to MC portal's I/O object - * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' - * @token: Token of DPBP object - * @en: Returns '1' if object is enabled; '0' otherwise - * - * Return: '0' on Success; Error code otherwise. - */ -int dpbp_is_enabled(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - int *en); - /** * dpbp_reset() - Reset the DPBP, returns the object to initial state. * @mc_io: Pointer to MC portal's I/O object diff --git a/include/fsl-mc/fsl_dpio.h b/include/fsl-mc/fsl_dpio.h index 7788e1962e..9d52a8e42f 100644 --- a/include/fsl-mc/fsl_dpio.h +++ b/include/fsl-mc/fsl_dpio.h @@ -21,7 +21,6 @@ #define DPIO_CMDID_ENABLE 0x0021 #define DPIO_CMDID_DISABLE 0x0031 #define DPIO_CMDID_GET_ATTR 0x0041 -#define DPIO_CMDID_RESET 0x0051 /* cmd, param, offset, width, type, arg_name */ #define DPIO_CMD_OPEN(cmd, dpio_id) \ @@ -177,18 +176,6 @@ int dpio_disable(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token); -/** - * dpio_reset() - Reset the DPIO, returns the object to initial 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 DPIO object - * - * Return: '0' on Success; Error code otherwise. - */ -int dpio_reset(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token); - /** * struct dpio_attr - Structure representing DPIO attributes * @id: DPIO object ID diff --git a/include/fsl-mc/fsl_dpmac.h b/include/fsl-mc/fsl_dpmac.h index 1fa26ef380..eebfe548cc 100644 --- a/include/fsl-mc/fsl_dpmac.h +++ b/include/fsl-mc/fsl_dpmac.h @@ -21,12 +21,8 @@ #define DPMAC_CMDID_DESTROY 0x98c1 #define DPMAC_CMDID_GET_API_VERSION 0xa0c1 -#define DPMAC_CMDID_GET_ATTR 0x0041 #define DPMAC_CMDID_RESET 0x0051 -#define DPMAC_CMDID_MDIO_READ 0x0c01 -#define DPMAC_CMDID_MDIO_WRITE 0x0c11 -#define DPMAC_CMDID_GET_LINK_CFG 0x0c21 #define DPMAC_CMDID_SET_LINK_STATE 0x0c31 #define DPMAC_CMDID_GET_COUNTER 0x0c41 @@ -38,42 +34,6 @@ #define DPMAC_CMD_OPEN(cmd, dpmac_id) \ MC_CMD_OP(cmd, 0, 0, 32, int, dpmac_id) -/* cmd, param, offset, width, type, arg_name */ -#define DPMAC_RSP_GET_ATTRIBUTES(cmd, attr) \ -do { \ - MC_RSP_OP(cmd, 0, 0, 32, int, attr->phy_id);\ - MC_RSP_OP(cmd, 0, 32, 32, int, attr->id);\ - MC_RSP_OP(cmd, 1, 32, 8, enum dpmac_link_type, attr->link_type);\ - MC_RSP_OP(cmd, 1, 40, 8, enum dpmac_eth_if, attr->eth_if);\ - MC_RSP_OP(cmd, 2, 0, 32, uint32_t, attr->max_rate);\ -} while (0) - -/* cmd, param, offset, width, type, arg_name */ -#define DPMAC_CMD_MDIO_READ(cmd, cfg) \ -do { \ - MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->phy_addr); \ - MC_CMD_OP(cmd, 0, 8, 8, uint8_t, cfg->reg); \ -} while (0) - -/* cmd, param, offset, width, type, arg_name */ -#define DPMAC_RSP_MDIO_READ(cmd, data) \ - MC_RSP_OP(cmd, 0, 16, 16, uint16_t, data) - -/* cmd, param, offset, width, type, arg_name */ -#define DPMAC_CMD_MDIO_WRITE(cmd, cfg) \ -do { \ - MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->phy_addr); \ - MC_CMD_OP(cmd, 0, 8, 8, uint8_t, cfg->reg); \ - MC_CMD_OP(cmd, 0, 16, 16, uint16_t, cfg->data); \ -} while (0) - -/* cmd, param, offset, width, type, arg_name */ -#define DPMAC_RSP_GET_LINK_CFG(cmd, cfg) \ -do { \ - MC_RSP_OP(cmd, 0, 0, 64, uint64_t, cfg->options); \ - MC_RSP_OP(cmd, 1, 0, 32, uint32_t, cfg->rate); \ -} while (0) - /* cmd, param, offset, width, type, arg_name */ #define DPMAC_CMD_SET_LINK_STATE(cmd, cfg) \ do { \ @@ -251,62 +211,6 @@ struct dpmac_attr { uint32_t max_rate; }; -/** - * dpmac_get_attributes - Retrieve DPMAC attributes. - * - * @mc_io: Pointer to MC portal's I/O object - * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' - * @token: Token of DPMAC object - * @attr: Returned object's attributes - * - * Return: '0' on Success; Error code otherwise. - */ -int dpmac_get_attributes(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - struct dpmac_attr *attr); - -/** - * struct dpmac_mdio_cfg - DPMAC MDIO read/write parameters - * @phy_addr: MDIO device address - * @reg: Address of the register within the Clause 45 PHY device from which data - * is to be read - * @data: Data read/write from/to MDIO - */ -struct dpmac_mdio_cfg { - uint8_t phy_addr; - uint8_t reg; - uint16_t data; -}; - -/** - * dpmac_mdio_read() - Perform MDIO read transaction - * @mc_io: Pointer to opaque I/O object - * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' - * @token: Token of DPMAC object - * @cfg: Structure with MDIO transaction parameters - * - * Return: '0' on Success; Error code otherwise. - */ -int dpmac_mdio_read(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - struct dpmac_mdio_cfg *cfg); - -/** - * dpmac_mdio_write() - Perform MDIO write transaction - * @mc_io: Pointer to opaque I/O object - * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' - * @token: Token of DPMAC object - * @cfg: Structure with MDIO transaction parameters - * - * Return: '0' on Success; Error code otherwise. - */ -int dpmac_mdio_write(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - struct dpmac_mdio_cfg *cfg); - /* DPMAC link configuration/state options */ /* Enable auto-negotiation */ @@ -318,30 +222,6 @@ int dpmac_mdio_write(struct fsl_mc_io *mc_io, /* Enable a-symmetric pause frames */ #define DPMAC_LINK_OPT_ASYM_PAUSE 0x0000000000000008ULL -/** - * struct dpmac_link_cfg - Structure representing DPMAC link configuration - * @rate: Link's rate - in Mbps - * @options: Enable/Disable DPMAC link cfg features (bitmap) - */ -struct dpmac_link_cfg { - uint32_t rate; - uint64_t options; -}; - -/** - * dpmac_get_link_cfg() - Get Ethernet link configuration - * @mc_io: Pointer to opaque I/O object - * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' - * @token: Token of DPMAC object - * @cfg: Returned structure with the link configuration - * - * Return: '0' on Success; Error code otherwise. - */ -int dpmac_get_link_cfg(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - struct dpmac_link_cfg *cfg); - /** * struct dpmac_link_state - DPMAC link configuration request * @rate: Rate in Mbps diff --git a/include/fsl-mc/fsl_dpni.h b/include/fsl-mc/fsl_dpni.h index fc57c375ac..fa15a141f1 100644 --- a/include/fsl-mc/fsl_dpni.h +++ b/include/fsl-mc/fsl_dpni.h @@ -24,21 +24,15 @@ #define DPNI_CMDID_SET_POOLS 0x2002 #define DPNI_CMDID_SET_BUFFER_LAYOUT 0x2651 -#define DPNI_CMDID_GET_BUFFER_LAYOUT 0x2641 -#define DPNI_CMDID_SET_ERRORS_BEHAVIOR 0x20B1 #define DPNI_CMDID_GET_QDID 0x2101 #define DPNI_CMDID_GET_TX_DATA_OFFSET 0x2121 #define DPNI_CMDID_GET_LINK_STATE 0x2151 #define DPNI_CMDID_SET_LINK_CFG 0x21A1 -#define DPNI_CMDID_SET_PRIM_MAC 0x2241 -#define DPNI_CMDID_GET_PRIM_MAC 0x2251 #define DPNI_CMDID_ADD_MAC_ADDR 0x2261 -#define DPNI_CMDID_REMOVE_MAC_ADDR 0x2271 #define DPNI_CMDID_GET_STATISTICS 0x25D1 -#define DPNI_CMDID_RESET_STATISTICS 0x25E1 #define DPNI_CMDID_GET_QUEUE 0x25F1 #define DPNI_CMDID_SET_QUEUE 0x2601 #define DPNI_CMDID_SET_TX_CONFIRMATION_MODE 0x2661 @@ -59,18 +53,6 @@ do { \ MC_PREP_OP(param, 1, 32, 16, uint16_t, cfg->adv.fs_entries); \ } while (0) -/* cmd, param, offset, width, type, arg_name */ -#define DPNI_EXT_CFG(param, cfg) \ -do { \ - MC_EXT_OP(param, 0, 0, 32, uint16_t, cfg->adv.options); \ - MC_EXT_OP(param, 0, 32, 8, uint16_t, cfg->adv.num_queues); \ - MC_EXT_OP(param, 0, 40, 8, uint16_t, cfg->adv.num_tcs); \ - MC_EXT_OP(param, 0, 48, 8, uint16_t, cfg->adv.mac_entries); \ - MC_EXT_OP(param, 1, 0, 8, uint16_t, cfg->adv.vlan_entries); \ - MC_EXT_OP(param, 1, 16, 8, uint16_t, cfg->adv.qos_entries); \ - MC_EXT_OP(param, 1, 32, 16, uint16_t, cfg->adv.fs_entries); \ -} while (0) - /* cmd, param, offset, width, type, arg_name */ #define DPNI_CMD_CREATE(cmd, cfg) \ do { \ @@ -128,14 +110,6 @@ do { \ MC_RSP_OP(cmd, 2, 16, 16, uint16_t, attr->wriop_version); \ } while (0) -/* cmd, param, offset, width, type, arg_name */ -#define DPNI_CMD_SET_ERRORS_BEHAVIOR(cmd, cfg) \ -do { \ - MC_CMD_OP(cmd, 0, 0, 32, uint32_t, cfg->errors); \ - MC_CMD_OP(cmd, 0, 32, 4, enum dpni_error_action, cfg->error_action); \ - MC_CMD_OP(cmd, 0, 36, 1, int, cfg->set_frame_annotation); \ -} while (0) - /* cmd, param, offset, width, type, arg_name */ #define DPNI_CMD_SET_BUFFER_LAYOUT(cmd, layout, queue) \ do { \ @@ -173,28 +147,6 @@ do { \ MC_RSP_OP(cmd, 2, 0, 64, uint64_t, state->options);\ } while (0) -/* cmd, param, offset, width, type, arg_name */ -#define DPNI_CMD_SET_PRIMARY_MAC_ADDR(cmd, mac_addr) \ -do { \ - MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \ - MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \ - MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \ - MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \ - MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \ - MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \ -} while (0) - -/* cmd, param, offset, width, type, arg_name */ -#define DPNI_RSP_GET_PRIMARY_MAC_ADDR(cmd, mac_addr) \ -do { \ - MC_RSP_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \ - MC_RSP_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \ - MC_RSP_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \ - MC_RSP_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \ - MC_RSP_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \ - MC_RSP_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \ -} while (0) - /* cmd, param, offset, width, type, arg_name */ #define DPNI_CMD_ADD_MAC_ADDR(cmd, mac_addr) \ do { \ @@ -206,17 +158,6 @@ do { \ MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \ } while (0) -/* cmd, param, offset, width, type, arg_name */ -#define DPNI_CMD_REMOVE_MAC_ADDR(cmd, mac_addr) \ -do { \ - MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \ - MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \ - MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \ - MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \ - MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \ - MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \ -} while (0) - #define DPNI_CMD_GET_QUEUE(cmd, type, tc, index) \ do { \ MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, type); \ @@ -267,60 +208,6 @@ do { \ MC_RSP_OP(cmd, 6, 0, 64, uint64_t, (stat)->raw.counter[6]); \ } while (0) -enum net_prot { - NET_PROT_NONE = 0, - NET_PROT_PAYLOAD, - NET_PROT_ETH, - NET_PROT_VLAN, - NET_PROT_IPV4, - NET_PROT_IPV6, - NET_PROT_IP, - NET_PROT_TCP, - NET_PROT_UDP, - NET_PROT_UDP_LITE, - NET_PROT_IPHC, - NET_PROT_SCTP, - NET_PROT_SCTP_CHUNK_DATA, - NET_PROT_PPPOE, - NET_PROT_PPP, - NET_PROT_PPPMUX, - NET_PROT_PPPMUX_SUBFRM, - NET_PROT_L2TPV2, - NET_PROT_L2TPV3_CTRL, - NET_PROT_L2TPV3_SESS, - NET_PROT_LLC, - NET_PROT_LLC_SNAP, - NET_PROT_NLPID, - NET_PROT_SNAP, - NET_PROT_MPLS, - NET_PROT_IPSEC_AH, - NET_PROT_IPSEC_ESP, - NET_PROT_UDP_ENC_ESP, /* RFC 3948 */ - NET_PROT_MACSEC, - NET_PROT_GRE, - NET_PROT_MINENCAP, - NET_PROT_DCCP, - NET_PROT_ICMP, - NET_PROT_IGMP, - NET_PROT_ARP, - NET_PROT_CAPWAP_DATA, - NET_PROT_CAPWAP_CTRL, - NET_PROT_RFC2684, - NET_PROT_ICMPV6, - NET_PROT_FCOE, - NET_PROT_FIP, - NET_PROT_ISCSI, - NET_PROT_GTP, - NET_PROT_USER_DEFINED_L2, - NET_PROT_USER_DEFINED_L3, - NET_PROT_USER_DEFINED_L4, - NET_PROT_USER_DEFINED_L5, - NET_PROT_USER_DEFINED_SHIM1, - NET_PROT_USER_DEFINED_SHIM2, - - NET_PROT_DUMMY_LAST -}; - /** * Data Path Network Interface API * Contains initialization APIs and runtime control APIs for DPNI @@ -455,46 +342,6 @@ struct dpni_cfg { } adv; }; -/** - * struct dpni_extended_cfg - Structure representing extended DPNI configuration - * @tc_cfg: TCs configuration - * @ipr_cfg: IP reassembly configuration - */ -struct dpni_extended_cfg { - /** - * struct tc_cfg - TC configuration - * @max_dist: Maximum distribution size for Rx traffic class; - * supported values: 1,2,3,4,6,7,8,12,14,16,24,28,32,48,56,64,96, - * 112,128,192,224,256,384,448,512,768,896,1024; - * value '0' will be treated as '1'. - * other unsupported values will be round down to the nearest - * supported value. - * @max_fs_entries: Maximum FS entries for Rx traffic class; - * '0' means no support for this TC; - */ - struct { - uint16_t max_dist; - uint16_t max_fs_entries; - } tc_cfg[DPNI_MAX_TC]; - /** - * struct ipr_cfg - Structure representing IP reassembly configuration - * @max_reass_frm_size: Maximum size of the reassembled frame - * @min_frag_size_ipv4: Minimum fragment size of IPv4 fragments - * @min_frag_size_ipv6: Minimum fragment size of IPv6 fragments - * @max_open_frames_ipv4: Maximum concurrent IPv4 packets in reassembly - * process - * @max_open_frames_ipv6: Maximum concurrent IPv6 packets in reassembly - * process - */ - struct { - uint16_t max_reass_frm_size; - uint16_t min_frag_size_ipv4; - uint16_t min_frag_size_ipv6; - uint16_t max_open_frames_ipv4; - uint16_t max_open_frames_ipv6; - } ipr_cfg; -}; - /** * dpni_prepare_cfg() - function prepare parameters * @cfg: cfg structure @@ -666,87 +513,6 @@ int dpni_get_attributes(struct fsl_mc_io *mc_io, uint16_t token, struct dpni_attr *attr); -/** - * dpni_extract_cfg() - extract the parameters - * @cfg: cfg structure - * @cfg_buf: 256 bytes of DMA-able memory - * - * This function has to be called after dpni_get_attributes() - */ -int dpni_extract_cfg(struct dpni_cfg *cfg, - const uint8_t *cfg_buf); - -/** - * DPNI errors - */ - -/** - * Extract out of frame header error - */ -#define DPNI_ERROR_EOFHE 0x00020000 -/** - * Frame length error - */ -#define DPNI_ERROR_FLE 0x00002000 -/** - * Frame physical error - */ -#define DPNI_ERROR_FPE 0x00001000 -/** - * Parsing header error - */ -#define DPNI_ERROR_PHE 0x00000020 -/** - * Parser L3 checksum error - */ -#define DPNI_ERROR_L3CE 0x00000004 -/** - * Parser L3 checksum error - */ -#define DPNI_ERROR_L4CE 0x00000001 - -/** - * enum dpni_error_action - Defines DPNI behavior for errors - * @DPNI_ERROR_ACTION_DISCARD: Discard the frame - * @DPNI_ERROR_ACTION_CONTINUE: Continue with the normal flow - * @DPNI_ERROR_ACTION_SEND_TO_ERROR_QUEUE: Send the frame to the error queue - */ -enum dpni_error_action { - DPNI_ERROR_ACTION_DISCARD = 0, - DPNI_ERROR_ACTION_CONTINUE = 1, - DPNI_ERROR_ACTION_SEND_TO_ERROR_QUEUE = 2 -}; - -/** - * struct dpni_error_cfg - Structure representing DPNI errors treatment - * @errors: Errors mask; use 'DPNI_ERROR__ - * @error_action: The desired action for the errors mask - * @set_frame_annotation: Set to '1' to mark the errors in frame annotation - * status (FAS); relevant only for the non-discard action - */ -struct dpni_error_cfg { - uint32_t errors; - enum dpni_error_action error_action; - int set_frame_annotation; -}; - -/** - * dpni_set_errors_behavior() - Set errors behavior - * @mc_io: Pointer to MC portal's I/O object - * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' - * @token: Token of DPNI object - * @cfg: Errors configuration - * - * this function may be called numerous times with different - * error masks - * - * Return: '0' on Success; Error code otherwise. - */ -int dpni_set_errors_behavior(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - struct dpni_error_cfg *cfg); - /* DPNI buffer layout modification options */ /* Select to modify the time-stamp setting */ @@ -787,22 +553,6 @@ struct dpni_buffer_layout { uint16_t data_tail_room; }; -/** - * dpni_get_buffer_layout() - Retrieve buffer layout attributes. - * @mc_io: Pointer to MC portal's I/O object - * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' - * @token: Token of DPNI object - * @layout: Returns buffer layout attributes - * @type: DPNI queue type - * - * Return: '0' on Success; Error code otherwise. - */ -int dpni_get_buffer_layout(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - const struct dpni_buffer_layout *layout, - enum dpni_queue_type type); - /** * dpni_set_buffer_layout() - Set buffer layout configuration. * @mc_io: Pointer to MC portal's I/O object @@ -910,34 +660,6 @@ int dpni_get_link_state(struct fsl_mc_io *mc_io, uint16_t token, struct dpni_link_state *state); -/** - * dpni_set_primary_mac_addr() - Set the primary MAC address - * @mc_io: Pointer to MC portal's I/O object - * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' - * @token: Token of DPNI object - * @mac_addr: MAC address to set as primary address - * - * Return: '0' on Success; Error code otherwise. - */ -int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - const uint8_t mac_addr[6]); - -/** - * dpni_get_primary_mac_addr() - Get the primary MAC address - * @mc_io: Pointer to MC portal's I/O object - * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' - * @token: Token of DPNI object - * @mac_addr: Returned MAC address - * - * Return: '0' on Success; Error code otherwise. - */ -int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - uint8_t mac_addr[6]); - /** * dpni_add_mac_addr() - Add MAC address filter * @mc_io: Pointer to MC portal's I/O object @@ -952,20 +674,6 @@ int dpni_add_mac_addr(struct fsl_mc_io *mc_io, uint16_t token, const uint8_t mac_addr[6]); -/** - * dpni_remove_mac_addr() - Remove MAC address filter - * @mc_io: Pointer to MC portal's I/O object - * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' - * @token: Token of DPNI object - * @mac_addr: MAC address to remove - * - * Return: '0' on Success; Error code otherwise. - */ -int dpni_remove_mac_addr(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - const uint8_t mac_addr[6]); - /** * enum dpni_dest - DPNI destination types * @DPNI_DEST_NONE: Unassigned destination; The queue is set in parked mode and @@ -985,137 +693,6 @@ enum dpni_dest { DPNI_DEST_DPCON = 2 }; -/** - * struct dpni_dest_cfg - Structure representing DPNI destination parameters - * @dest_type: Destination type - * @dest_id: Either DPIO ID or DPCON ID, depending on the destination type - * @priority: Priority selection within the DPIO or DPCON channel; valid values - * are 0-1 or 0-7, depending on the number of priorities in that - * channel; not relevant for 'DPNI_DEST_NONE' option - */ -struct dpni_dest_cfg { - enum dpni_dest dest_type; - int dest_id; - uint8_t priority; -}; - -/** - * enum dpni_flc_type - DPNI FLC types - * @DPNI_FLC_USER_DEFINED: select the FLC to be used for user defined value - * @DPNI_FLC_STASH: select the FLC to be used for stash control - */ -enum dpni_flc_type { - DPNI_FLC_USER_DEFINED = 0, - DPNI_FLC_STASH = 1, -}; - -/** - * enum dpni_stash_size - DPNI FLC stashing size - * @DPNI_STASH_SIZE_0B: no stash - * @DPNI_STASH_SIZE_64B: stashes 64 bytes - * @DPNI_STASH_SIZE_128B: stashes 128 bytes - * @DPNI_STASH_SIZE_192B: stashes 192 bytes - */ -enum dpni_stash_size { - DPNI_STASH_SIZE_0B = 0, - DPNI_STASH_SIZE_64B = 1, - DPNI_STASH_SIZE_128B = 2, - DPNI_STASH_SIZE_192B = 3, -}; - -/* DPNI FLC stash options */ - -/* stashes the whole annotation area (up to 192 bytes) */ -#define DPNI_FLC_STASH_FRAME_ANNOTATION 0x00000001 - -/** - * struct dpni_flc_cfg - Structure representing DPNI FLC configuration - * @flc_type: FLC type - * @options: Mask of available options; - * use 'DPNI_FLC_STASH_' values - * @frame_data_size: Size of frame data to be stashed - * @flow_context_size: Size of flow context to be stashed - * @flow_context: 1. In case flc_type is 'DPNI_FLC_USER_DEFINED': - * this value will be provided in the frame descriptor - * (FD[FLC]) - * 2. In case flc_type is 'DPNI_FLC_STASH': - * this value will be I/O virtual address of the - * flow-context; - * Must be cacheline-aligned and DMA-able memory - */ -struct dpni_flc_cfg { - enum dpni_flc_type flc_type; - uint32_t options; - enum dpni_stash_size frame_data_size; - enum dpni_stash_size flow_context_size; - uint64_t flow_context; -}; - -/* DPNI queue modification options */ - -/* Select to modify the user's context associated with the queue */ -#define DPNI_QUEUE_OPT_USER_CTX 0x00000001 -/* Select to modify the queue's destination */ -#define DPNI_QUEUE_OPT_DEST 0x00000002 -/** Select to modify the flow-context parameters; - * not applicable for Tx-conf/Err queues as the FD comes from the user - */ -#define DPNI_QUEUE_OPT_FLC 0x00000004 -/* Select to modify the queue's order preservation */ -#define DPNI_QUEUE_OPT_ORDER_PRESERVATION 0x00000008 -/* Select to modify the queue's tail-drop threshold */ -#define DPNI_QUEUE_OPT_TAILDROP_THRESHOLD 0x00000010 - -/** - * struct dpni_queue_cfg - Structure representing queue configuration - * @options: Flags representing the suggested modifications to the queue; - * Use any combination of 'DPNI_QUEUE_OPT_' flags - * @user_ctx: User context value provided in the frame descriptor of each - * dequeued frame; valid only if 'DPNI_QUEUE_OPT_USER_CTX' - * is contained in 'options' - * @dest_cfg: Queue destination parameters; - * valid only if 'DPNI_QUEUE_OPT_DEST' is contained in 'options' - * @flc_cfg: Flow context configuration; in case the TC's distribution - * is either NONE or HASH the FLC's settings of flow#0 are used. - * in the case of FS (flow-steering) the flow's FLC settings - * are used. - * valid only if 'DPNI_QUEUE_OPT_FLC' is contained in 'options' - * @order_preservation_en: enable/disable order preservation; - * valid only if 'DPNI_QUEUE_OPT_ORDER_PRESERVATION' is contained - * in 'options' - * @tail_drop_threshold: set the queue's tail drop threshold in bytes; - * '0' value disable the threshold; maximum value is 0xE000000; - * valid only if 'DPNI_QUEUE_OPT_TAILDROP_THRESHOLD' is contained - * in 'options' - */ -struct dpni_queue_cfg { - uint32_t options; - uint64_t user_ctx; - struct dpni_dest_cfg dest_cfg; - struct dpni_flc_cfg flc_cfg; - int order_preservation_en; - uint32_t tail_drop_threshold; -}; - -/** - * struct dpni_queue_attr - Structure representing queue attributes - * @user_ctx: User context value provided in the frame descriptor of each - * dequeued frame - * @dest_cfg: Queue destination configuration - * @flc_cfg: Flow context configuration - * @order_preservation_en: enable/disable order preservation - * @tail_drop_threshold: queue's tail drop threshold in bytes; - * @fqid: Virtual fqid value to be used for dequeue operations - */ -struct dpni_queue_attr { - uint64_t user_ctx; - struct dpni_dest_cfg dest_cfg; - struct dpni_flc_cfg flc_cfg; - int order_preservation_en; - uint32_t tail_drop_threshold; - uint32_t fqid; -}; - /* DPNI Tx flow modification options */ /* Select to modify the settings for dedicate Tx confirmation/error */ @@ -1371,15 +948,4 @@ int dpni_get_statistics(struct fsl_mc_io *mc_io, uint8_t page, union dpni_statistics *stat); -/** - * dpni_reset_statistics() - Clears DPNI statistics - * @mc_io: Pointer to MC portal's I/O object - * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' - * @token: Token of DPNI object - * - * Return: '0' on Success; Error code otherwise. - */ -int dpni_reset_statistics(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token); #endif /* _FSL_DPNI_H */ diff --git a/include/fsl-mc/fsl_dprc.h b/include/fsl-mc/fsl_dprc.h index 950ecb0756..0b95a06a91 100644 --- a/include/fsl-mc/fsl_dprc.h +++ b/include/fsl-mc/fsl_dprc.h @@ -15,20 +15,12 @@ /* Command IDs */ #define DPRC_CMDID_CLOSE 0x8001 #define DPRC_CMDID_OPEN 0x8051 -#define DPRC_CMDID_CREATE 0x9051 -#define DPRC_CMDID_GET_ATTR 0x0041 -#define DPRC_CMDID_RESET_CONT 0x0051 #define DPRC_CMDID_GET_API_VERSION 0xa051 #define DPRC_CMDID_CREATE_CONT 0x1511 #define DPRC_CMDID_DESTROY_CONT 0x1521 #define DPRC_CMDID_GET_CONT_ID 0x8301 -#define DPRC_CMDID_GET_OBJ_COUNT 0x1591 -#define DPRC_CMDID_GET_OBJ 0x15A1 -#define DPRC_CMDID_GET_RES_COUNT 0x15B1 -#define DPRC_CMDID_GET_RES_IDS 0x15C1 -#define DPRC_CMDID_GET_OBJ_REG 0x15E1 #define DPRC_CMDID_CONNECT 0x1671 #define DPRC_CMDID_DISCONNECT 0x1681 @@ -77,268 +69,6 @@ do { \ #define DPRC_CMD_DESTROY_CONTAINER(cmd, child_container_id) \ MC_CMD_OP(cmd, 0, 0, 32, int, child_container_id) -/* cmd, param, offset, width, type, arg_name */ -#define DPRC_CMD_RESET_CONTAINER(cmd, child_container_id) \ - MC_CMD_OP(cmd, 0, 0, 32, int, child_container_id) - -/* cmd, param, offset, width, type, arg_name */ -#define DPRC_RSP_GET_ATTRIBUTES(cmd, attr) \ -do { \ - MC_RSP_OP(cmd, 0, 0, 32, int, attr->container_id); \ - MC_RSP_OP(cmd, 0, 32, 16, uint16_t, attr->icid); \ - MC_RSP_OP(cmd, 1, 0, 32, uint32_t, attr->options);\ - MC_RSP_OP(cmd, 1, 32, 32, int, attr->portal_id); \ -} while (0) - -/* cmd, param, offset, width, type, arg_name */ -#define DPRC_RSP_GET_OBJ_COUNT(cmd, obj_count) \ - MC_RSP_OP(cmd, 0, 32, 32, int, obj_count) - -/* cmd, param, offset, width, type, arg_name */ -#define DPRC_CMD_GET_OBJ(cmd, obj_index) \ - MC_CMD_OP(cmd, 0, 0, 32, int, obj_index) - -/* cmd, param, offset, width, type, arg_name */ -#define DPRC_RSP_GET_OBJ(cmd, obj_desc) \ -do { \ - MC_RSP_OP(cmd, 0, 32, 32, int, obj_desc->id); \ - MC_RSP_OP(cmd, 1, 0, 16, uint16_t, obj_desc->vendor); \ - MC_RSP_OP(cmd, 1, 16, 8, uint8_t, obj_desc->irq_count); \ - MC_RSP_OP(cmd, 1, 24, 8, uint8_t, obj_desc->region_count); \ - MC_RSP_OP(cmd, 1, 32, 32, uint32_t, obj_desc->state);\ - MC_RSP_OP(cmd, 2, 0, 16, uint16_t, obj_desc->ver_major);\ - MC_RSP_OP(cmd, 2, 16, 16, uint16_t, obj_desc->ver_minor);\ - MC_RSP_OP(cmd, 2, 32, 16, uint16_t, obj_desc->flags); \ - MC_RSP_OP(cmd, 3, 0, 8, char, obj_desc->type[0]);\ - MC_RSP_OP(cmd, 3, 8, 8, char, obj_desc->type[1]);\ - MC_RSP_OP(cmd, 3, 16, 8, char, obj_desc->type[2]);\ - MC_RSP_OP(cmd, 3, 24, 8, char, obj_desc->type[3]);\ - MC_RSP_OP(cmd, 3, 32, 8, char, obj_desc->type[4]);\ - MC_RSP_OP(cmd, 3, 40, 8, char, obj_desc->type[5]);\ - MC_RSP_OP(cmd, 3, 48, 8, char, obj_desc->type[6]);\ - MC_RSP_OP(cmd, 3, 56, 8, char, obj_desc->type[7]);\ - MC_RSP_OP(cmd, 4, 0, 8, char, obj_desc->type[8]);\ - MC_RSP_OP(cmd, 4, 8, 8, char, obj_desc->type[9]);\ - MC_RSP_OP(cmd, 4, 16, 8, char, obj_desc->type[10]);\ - MC_RSP_OP(cmd, 4, 24, 8, char, obj_desc->type[11]);\ - MC_RSP_OP(cmd, 4, 32, 8, char, obj_desc->type[12]);\ - MC_RSP_OP(cmd, 4, 40, 8, char, obj_desc->type[13]);\ - MC_RSP_OP(cmd, 4, 48, 8, char, obj_desc->type[14]);\ - MC_RSP_OP(cmd, 4, 56, 8, char, obj_desc->type[15]);\ - MC_RSP_OP(cmd, 5, 0, 8, char, obj_desc->label[0]);\ - MC_RSP_OP(cmd, 5, 8, 8, char, obj_desc->label[1]);\ - MC_RSP_OP(cmd, 5, 16, 8, char, obj_desc->label[2]);\ - MC_RSP_OP(cmd, 5, 24, 8, char, obj_desc->label[3]);\ - MC_RSP_OP(cmd, 5, 32, 8, char, obj_desc->label[4]);\ - MC_RSP_OP(cmd, 5, 40, 8, char, obj_desc->label[5]);\ - MC_RSP_OP(cmd, 5, 48, 8, char, obj_desc->label[6]);\ - MC_RSP_OP(cmd, 5, 56, 8, char, obj_desc->label[7]);\ - MC_RSP_OP(cmd, 6, 0, 8, char, obj_desc->label[8]);\ - MC_RSP_OP(cmd, 6, 8, 8, char, obj_desc->label[9]);\ - MC_RSP_OP(cmd, 6, 16, 8, char, obj_desc->label[10]);\ - MC_RSP_OP(cmd, 6, 24, 8, char, obj_desc->label[11]);\ - MC_RSP_OP(cmd, 6, 32, 8, char, obj_desc->label[12]);\ - MC_RSP_OP(cmd, 6, 40, 8, char, obj_desc->label[13]);\ - MC_RSP_OP(cmd, 6, 48, 8, char, obj_desc->label[14]);\ - MC_RSP_OP(cmd, 6, 56, 8, char, obj_desc->label[15]);\ -} while (0) - -/* cmd, param, offset, width, type, arg_name */ -#define DPRC_CMD_GET_OBJ_DESC(cmd, obj_type, obj_id) \ -do { \ - MC_CMD_OP(cmd, 0, 0, 32, int, obj_id);\ - MC_CMD_OP(cmd, 1, 0, 8, char, obj_type[0]);\ - MC_CMD_OP(cmd, 1, 8, 8, char, obj_type[1]);\ - MC_CMD_OP(cmd, 1, 16, 8, char, obj_type[2]);\ - MC_CMD_OP(cmd, 1, 24, 8, char, obj_type[3]);\ - MC_CMD_OP(cmd, 1, 32, 8, char, obj_type[4]);\ - MC_CMD_OP(cmd, 1, 40, 8, char, obj_type[5]);\ - MC_CMD_OP(cmd, 1, 48, 8, char, obj_type[6]);\ - MC_CMD_OP(cmd, 1, 56, 8, char, obj_type[7]);\ - MC_CMD_OP(cmd, 2, 0, 8, char, obj_type[8]);\ - MC_CMD_OP(cmd, 2, 8, 8, char, obj_type[9]);\ - MC_CMD_OP(cmd, 2, 16, 8, char, obj_type[10]);\ - MC_CMD_OP(cmd, 2, 24, 8, char, obj_type[11]);\ - MC_CMD_OP(cmd, 2, 32, 8, char, obj_type[12]);\ - MC_CMD_OP(cmd, 2, 40, 8, char, obj_type[13]);\ - MC_CMD_OP(cmd, 2, 48, 8, char, obj_type[14]);\ - MC_CMD_OP(cmd, 2, 56, 8, char, obj_type[15]);\ -} while (0) - -/* cmd, param, offset, width, type, arg_name */ -#define DPRC_RSP_GET_OBJ_DESC(cmd, obj_desc) \ -do { \ - MC_RSP_OP(cmd, 0, 32, 32, int, obj_desc->id); \ - MC_RSP_OP(cmd, 1, 0, 16, uint16_t, obj_desc->vendor); \ - MC_RSP_OP(cmd, 1, 16, 8, uint8_t, obj_desc->irq_count); \ - MC_RSP_OP(cmd, 1, 24, 8, uint8_t, obj_desc->region_count); \ - MC_RSP_OP(cmd, 1, 32, 32, uint32_t, obj_desc->state);\ - MC_RSP_OP(cmd, 2, 0, 16, uint16_t, obj_desc->ver_major);\ - MC_RSP_OP(cmd, 2, 16, 16, uint16_t, obj_desc->ver_minor);\ - MC_RSP_OP(cmd, 2, 32, 16, uint16_t, obj_desc->flags); \ - MC_RSP_OP(cmd, 3, 0, 8, char, obj_desc->type[0]);\ - MC_RSP_OP(cmd, 3, 8, 8, char, obj_desc->type[1]);\ - MC_RSP_OP(cmd, 3, 16, 8, char, obj_desc->type[2]);\ - MC_RSP_OP(cmd, 3, 24, 8, char, obj_desc->type[3]);\ - MC_RSP_OP(cmd, 3, 32, 8, char, obj_desc->type[4]);\ - MC_RSP_OP(cmd, 3, 40, 8, char, obj_desc->type[5]);\ - MC_RSP_OP(cmd, 3, 48, 8, char, obj_desc->type[6]);\ - MC_RSP_OP(cmd, 3, 56, 8, char, obj_desc->type[7]);\ - MC_RSP_OP(cmd, 4, 0, 8, char, obj_desc->type[8]);\ - MC_RSP_OP(cmd, 4, 8, 8, char, obj_desc->type[9]);\ - MC_RSP_OP(cmd, 4, 16, 8, char, obj_desc->type[10]);\ - MC_RSP_OP(cmd, 4, 24, 8, char, obj_desc->type[11]);\ - MC_RSP_OP(cmd, 4, 32, 8, char, obj_desc->type[12]);\ - MC_RSP_OP(cmd, 4, 40, 8, char, obj_desc->type[13]);\ - MC_RSP_OP(cmd, 4, 48, 8, char, obj_desc->type[14]);\ - MC_RSP_OP(cmd, 4, 56, 8, char, obj_desc->type[15]);\ - MC_RSP_OP(cmd, 5, 0, 8, char, obj_desc->label[0]);\ - MC_RSP_OP(cmd, 5, 8, 8, char, obj_desc->label[1]);\ - MC_RSP_OP(cmd, 5, 16, 8, char, obj_desc->label[2]);\ - MC_RSP_OP(cmd, 5, 24, 8, char, obj_desc->label[3]);\ - MC_RSP_OP(cmd, 5, 32, 8, char, obj_desc->label[4]);\ - MC_RSP_OP(cmd, 5, 40, 8, char, obj_desc->label[5]);\ - MC_RSP_OP(cmd, 5, 48, 8, char, obj_desc->label[6]);\ - MC_RSP_OP(cmd, 5, 56, 8, char, obj_desc->label[7]);\ - MC_RSP_OP(cmd, 6, 0, 8, char, obj_desc->label[8]);\ - MC_RSP_OP(cmd, 6, 8, 8, char, obj_desc->label[9]);\ - MC_RSP_OP(cmd, 6, 16, 8, char, obj_desc->label[10]);\ - MC_RSP_OP(cmd, 6, 24, 8, char, obj_desc->label[11]);\ - MC_RSP_OP(cmd, 6, 32, 8, char, obj_desc->label[12]);\ - MC_RSP_OP(cmd, 6, 40, 8, char, obj_desc->label[13]);\ - MC_RSP_OP(cmd, 6, 48, 8, char, obj_desc->label[14]);\ - MC_RSP_OP(cmd, 6, 56, 8, char, obj_desc->label[15]);\ -} while (0) - -/* cmd, param, offset, width, type, arg_name */ -#define DPRC_CMD_GET_RES_COUNT(cmd, type) \ -do { \ - MC_CMD_OP(cmd, 1, 0, 8, char, type[0]);\ - MC_CMD_OP(cmd, 1, 8, 8, char, type[1]);\ - MC_CMD_OP(cmd, 1, 16, 8, char, type[2]);\ - MC_CMD_OP(cmd, 1, 24, 8, char, type[3]);\ - MC_CMD_OP(cmd, 1, 32, 8, char, type[4]);\ - MC_CMD_OP(cmd, 1, 40, 8, char, type[5]);\ - MC_CMD_OP(cmd, 1, 48, 8, char, type[6]);\ - MC_CMD_OP(cmd, 1, 56, 8, char, type[7]);\ - MC_CMD_OP(cmd, 2, 0, 8, char, type[8]);\ - MC_CMD_OP(cmd, 2, 8, 8, char, type[9]);\ - MC_CMD_OP(cmd, 2, 16, 8, char, type[10]);\ - MC_CMD_OP(cmd, 2, 24, 8, char, type[11]);\ - MC_CMD_OP(cmd, 2, 32, 8, char, type[12]);\ - MC_CMD_OP(cmd, 2, 40, 8, char, type[13]);\ - MC_CMD_OP(cmd, 2, 48, 8, char, type[14]);\ - MC_CMD_OP(cmd, 2, 56, 8, char, type[15]);\ -} while (0) - -/* cmd, param, offset, width, type, arg_name */ -#define DPRC_RSP_GET_RES_COUNT(cmd, res_count) \ - MC_RSP_OP(cmd, 0, 0, 32, int, res_count) - -/* cmd, param, offset, width, type, arg_name */ -#define DPRC_CMD_GET_RES_IDS(cmd, range_desc, type) \ -do { \ - MC_CMD_OP(cmd, 0, 42, 7, enum dprc_iter_status, \ - range_desc->iter_status); \ - MC_CMD_OP(cmd, 1, 0, 32, int, range_desc->base_id); \ - MC_CMD_OP(cmd, 1, 32, 32, int, range_desc->last_id);\ - MC_CMD_OP(cmd, 2, 0, 8, char, type[0]);\ - MC_CMD_OP(cmd, 2, 8, 8, char, type[1]);\ - MC_CMD_OP(cmd, 2, 16, 8, char, type[2]);\ - MC_CMD_OP(cmd, 2, 24, 8, char, type[3]);\ - MC_CMD_OP(cmd, 2, 32, 8, char, type[4]);\ - MC_CMD_OP(cmd, 2, 40, 8, char, type[5]);\ - MC_CMD_OP(cmd, 2, 48, 8, char, type[6]);\ - MC_CMD_OP(cmd, 2, 56, 8, char, type[7]);\ - MC_CMD_OP(cmd, 3, 0, 8, char, type[8]);\ - MC_CMD_OP(cmd, 3, 8, 8, char, type[9]);\ - MC_CMD_OP(cmd, 3, 16, 8, char, type[10]);\ - MC_CMD_OP(cmd, 3, 24, 8, char, type[11]);\ - MC_CMD_OP(cmd, 3, 32, 8, char, type[12]);\ - MC_CMD_OP(cmd, 3, 40, 8, char, type[13]);\ - MC_CMD_OP(cmd, 3, 48, 8, char, type[14]);\ - MC_CMD_OP(cmd, 3, 56, 8, char, type[15]);\ -} while (0) - -/* cmd, param, offset, width, type, arg_name */ -#define DPRC_RSP_GET_RES_IDS(cmd, range_desc) \ -do { \ - MC_RSP_OP(cmd, 0, 42, 7, enum dprc_iter_status, \ - range_desc->iter_status);\ - MC_RSP_OP(cmd, 1, 0, 32, int, range_desc->base_id); \ - MC_RSP_OP(cmd, 1, 32, 32, int, range_desc->last_id);\ -} while (0) - -/* cmd, param, offset, width, type, arg_name */ -#define DPRC_CMD_GET_OBJ_REGION(cmd, obj_type, obj_id, region_index) \ -do { \ - MC_CMD_OP(cmd, 0, 0, 32, int, obj_id); \ - MC_CMD_OP(cmd, 0, 48, 8, uint8_t, region_index);\ - MC_CMD_OP(cmd, 3, 0, 8, char, obj_type[0]);\ - MC_CMD_OP(cmd, 3, 8, 8, char, obj_type[1]);\ - MC_CMD_OP(cmd, 3, 16, 8, char, obj_type[2]);\ - MC_CMD_OP(cmd, 3, 24, 8, char, obj_type[3]);\ - MC_CMD_OP(cmd, 3, 32, 8, char, obj_type[4]);\ - MC_CMD_OP(cmd, 3, 40, 8, char, obj_type[5]);\ - MC_CMD_OP(cmd, 3, 48, 8, char, obj_type[6]);\ - MC_CMD_OP(cmd, 3, 56, 8, char, obj_type[7]);\ - MC_CMD_OP(cmd, 4, 0, 8, char, obj_type[8]);\ - MC_CMD_OP(cmd, 4, 8, 8, char, obj_type[9]);\ - MC_CMD_OP(cmd, 4, 16, 8, char, obj_type[10]);\ - MC_CMD_OP(cmd, 4, 24, 8, char, obj_type[11]);\ - MC_CMD_OP(cmd, 4, 32, 8, char, obj_type[12]);\ - MC_CMD_OP(cmd, 4, 40, 8, char, obj_type[13]);\ - MC_CMD_OP(cmd, 4, 48, 8, char, obj_type[14]);\ - MC_CMD_OP(cmd, 4, 56, 8, char, obj_type[15]);\ -} while (0) - -/* param, offset, width, type, arg_name */ -#define DPRC_RSP_GET_OBJ_REGION(cmd, region_desc) \ -do { \ - MC_RSP_OP(cmd, 1, 0, 32, uint32_t, region_desc->base_offset);\ - MC_RSP_OP(cmd, 2, 0, 32, uint32_t, region_desc->size); \ - MC_RSP_OP(cmd, 2, 32, 4, enum dprc_region_type, region_desc->type);\ - MC_RSP_OP(cmd, 3, 0, 32, uint32_t, region_desc->flags);\ -} while (0) - -/* cmd, param, offset, width, type, arg_name */ -#define DPRC_CMD_SET_OBJ_LABEL(cmd, obj_type, obj_id, label) \ -do { \ - MC_CMD_OP(cmd, 0, 0, 32, int, obj_id); \ - MC_CMD_OP(cmd, 1, 0, 8, char, label[0]);\ - MC_CMD_OP(cmd, 1, 8, 8, char, label[1]);\ - MC_CMD_OP(cmd, 1, 16, 8, char, label[2]);\ - MC_CMD_OP(cmd, 1, 24, 8, char, label[3]);\ - MC_CMD_OP(cmd, 1, 32, 8, char, label[4]);\ - MC_CMD_OP(cmd, 1, 40, 8, char, label[5]);\ - MC_CMD_OP(cmd, 1, 48, 8, char, label[6]);\ - MC_CMD_OP(cmd, 1, 56, 8, char, label[7]);\ - MC_CMD_OP(cmd, 2, 0, 8, char, label[8]);\ - MC_CMD_OP(cmd, 2, 8, 8, char, label[9]);\ - MC_CMD_OP(cmd, 2, 16, 8, char, label[10]);\ - MC_CMD_OP(cmd, 2, 24, 8, char, label[11]);\ - MC_CMD_OP(cmd, 2, 32, 8, char, label[12]);\ - MC_CMD_OP(cmd, 2, 40, 8, char, label[13]);\ - MC_CMD_OP(cmd, 2, 48, 8, char, label[14]);\ - MC_CMD_OP(cmd, 2, 56, 8, char, label[15]);\ - MC_CMD_OP(cmd, 3, 0, 8, char, obj_type[0]);\ - MC_CMD_OP(cmd, 3, 8, 8, char, obj_type[1]);\ - MC_CMD_OP(cmd, 3, 16, 8, char, obj_type[2]);\ - MC_CMD_OP(cmd, 3, 24, 8, char, obj_type[3]);\ - MC_CMD_OP(cmd, 3, 32, 8, char, obj_type[4]);\ - MC_CMD_OP(cmd, 3, 40, 8, char, obj_type[5]);\ - MC_CMD_OP(cmd, 3, 48, 8, char, obj_type[6]);\ - MC_CMD_OP(cmd, 3, 56, 8, char, obj_type[7]);\ - MC_CMD_OP(cmd, 4, 0, 8, char, obj_type[8]);\ - MC_CMD_OP(cmd, 4, 8, 8, char, obj_type[9]);\ - MC_CMD_OP(cmd, 4, 16, 8, char, obj_type[10]);\ - MC_CMD_OP(cmd, 4, 24, 8, char, obj_type[11]);\ - MC_CMD_OP(cmd, 4, 32, 8, char, obj_type[12]);\ - MC_CMD_OP(cmd, 4, 40, 8, char, obj_type[13]);\ - MC_CMD_OP(cmd, 4, 48, 8, char, obj_type[14]);\ - MC_CMD_OP(cmd, 4, 56, 8, char, obj_type[15]);\ -} while (0) - /* cmd, param, offset, width, type, arg_name */ #define DPRC_CMD_CONNECT(cmd, endpoint1, endpoint2, cfg) \ do { \ @@ -615,249 +345,6 @@ int dprc_destroy_container(struct fsl_mc_io *mc_io, uint16_t token, int child_container_id); -/** - * dprc_reset_container - Reset child container. - * @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 - * @child_container_id: ID of the container to reset - * - * In case a software context crashes or becomes non-responsive, the parent - * may wish to reset its resources container before the software context is - * restarted. - * - * This routine informs all objects assigned to the child container that the - * container is being reset, so they may perform any cleanup operations that are - * needed. All objects handles that were owned by the child container shall be - * closed. - * - * Note that such request may be submitted even if the child software context - * has not crashed, but the resulting object cleanup operations will not be - * aware of that. - * - * Return: '0' on Success; Error code otherwise. - */ -int dprc_reset_container(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - int child_container_id); - -/** - * struct dprc_attributes - Container attributes - * @container_id: Container's ID - * @icid: Container's ICID - * @portal_id: Container's portal ID - * @options: Container's options as set at container's creation - * @version: DPRC version - */ -struct dprc_attributes { - int container_id; - uint16_t icid; - int portal_id; - uint64_t options; -}; - -/** - * dprc_get_attributes() - Obtains container attributes - * @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 - * @attributes: Returned container attributes - * - * Return: '0' on Success; Error code otherwise. - */ -int dprc_get_attributes(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - struct dprc_attributes *attributes); - -/** - * dprc_get_obj_count() - Obtains the number of objects in 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 - * @obj_count: Number of objects assigned to the DPRC - * - * Return: '0' on Success; Error code otherwise. - */ -int dprc_get_obj_count(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - int *obj_count); - -/* Objects Attributes Flags */ - -/* Opened state - Indicates that an object is open by at least one owner */ -#define DPRC_OBJ_STATE_OPEN 0x00000001 -/* Plugged state - Indicates that the object is plugged */ -#define DPRC_OBJ_STATE_PLUGGED 0x00000002 - -/** - * Shareability flag - Object flag indicating no memory shareability. - * the object generates memory accesses that are non coherent with other - * masters; - * user is responsible for proper memory handling through IOMMU configuration. - */ -#define DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY 0x0001 - -/** - * struct dprc_obj_desc - Object descriptor, returned from dprc_get_obj() - * @type: Type of object: NULL terminated string - * @id: ID of logical object resource - * @vendor: Object vendor identifier - * @ver_major: Major version number - * @ver_minor: Minor version number - * @irq_count: Number of interrupts supported by the object - * @region_count: Number of mappable regions supported by the object - * @state: Object state: combination of DPRC_OBJ_STATE_ states - * @label: Object label - * @flags: Object's flags - */ -struct dprc_obj_desc { - char type[16]; - int id; - uint16_t vendor; - uint16_t ver_major; - uint16_t ver_minor; - uint8_t irq_count; - uint8_t region_count; - uint32_t state; - char label[16]; - uint16_t flags; -}; - -/** - * dprc_get_obj() - Get general information on an 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_index: Index of the object to be queried (< obj_count) - * @obj_desc: Returns the requested object descriptor - * - * The object descriptors are retrieved one by one by incrementing - * obj_index up to (not including) the value of obj_count returned - * from dprc_get_obj_count(). dprc_get_obj_count() must - * be called prior to dprc_get_obj(). - * - * Return: '0' on Success; Error code otherwise. - */ -int dprc_get_obj(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - int obj_index, - struct dprc_obj_desc *obj_desc); - -/** - * 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, - uint32_t cmd_flags, - uint16_t 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 -}; - -/** - * struct dprc_res_ids_range_desc - Resource ID range descriptor - * @base_id: Base resource ID of this range - * @last_id: Last resource ID of this range - * @iter_status: Iteration status - should be set to DPRC_ITER_STATUS_FIRST at - * first iteration; while the returned marker is DPRC_ITER_STATUS_MORE, - * additional iterations are needed, until the returned marker is - * DPRC_ITER_STATUS_LAST - */ -struct dprc_res_ids_range_desc { - int base_id; - int last_id; - enum dprc_iter_status iter_status; -}; - -/** - * dprc_get_res_ids() - Obtains IDs of free resources in the container - * @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 - * @range_desc: range descriptor - * - * Return: '0' on Success; Error code otherwise. - */ -int dprc_get_res_ids(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - char *type, - struct dprc_res_ids_range_desc *range_desc); - -/* Region flags */ -/* Cacheable - Indicates that region should be mapped as cacheable */ -#define DPRC_REGION_CACHEABLE 0x00000001 - -/** - * enum dprc_region_type - Region type - * @DPRC_REGION_TYPE_MC_PORTAL: MC portal region - * @DPRC_REGION_TYPE_QBMAN_PORTAL: Qbman portal region - */ -enum dprc_region_type { - DPRC_REGION_TYPE_MC_PORTAL, - DPRC_REGION_TYPE_QBMAN_PORTAL -}; - -/** - * struct dprc_region_desc - Mappable region descriptor - * @base_offset: Region offset from region's base address. - * For DPMCP and DPRC objects, region base is offset from SoC MC portals - * base address; For DPIO, region base is offset from SoC QMan portals - * base address - * @size: Region size (in bytes) - * @flags: Region attributes - * @type: Portal region type - */ -struct dprc_region_desc { - uint32_t base_offset; - uint32_t size; - uint32_t flags; - enum dprc_region_type type; -}; - -/** - * 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_' - * @token: Token of DPRC object - * @obj_type: Object type as returned in dprc_get_obj() - * @obj_id: Unique object instance as returned in dprc_get_obj() - * @region_index: The specific region to query - * @region_desc: Returns the requested region descriptor - * - * Return: '0' on Success; Error code otherwise. - */ -int dprc_get_obj_region(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - char *obj_type, - int obj_id, - uint8_t region_index, - struct dprc_region_desc *region_desc); /** * struct dprc_endpoint - Endpoint description for link connect/disconnect * operations