[v5,2/5] common/cnxk: add REE mbox definitions

Message ID 20211211090435.2889574-3-jerinj@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series remove octeontx2 drivers |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Jerin Jacob Dec. 11, 2021, 9:04 a.m. UTC
From: Liron Himi <lironh@marvell.com>

add REE mbox definitions

Signed-off-by: Liron Himi <lironh@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
---
 drivers/common/cnxk/roc_mbox.h | 100 +++++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)
  

Patch

diff --git a/drivers/common/cnxk/roc_mbox.h b/drivers/common/cnxk/roc_mbox.h
index b63fe108c9..e97d93e261 100644
--- a/drivers/common/cnxk/roc_mbox.h
+++ b/drivers/common/cnxk/roc_mbox.h
@@ -151,6 +151,16 @@  struct mbox_msghdr {
 	M(CPT_GET_CAPS, 0xBFD, cpt_caps_get, msg_req, cpt_caps_rsp_msg)        \
 	M(CPT_GET_ENG_GRP, 0xBFF, cpt_eng_grp_get, cpt_eng_grp_req,            \
 	  cpt_eng_grp_rsp)                                                     \
+	/* REE mbox IDs (range 0xE00 - 0xFFF) */                               \
+	M(REE_CONFIG_LF, 0xE01, ree_config_lf, ree_lf_req_msg, msg_rsp)        \
+	M(REE_RD_WR_REGISTER, 0xE02, ree_rd_wr_register, ree_rd_wr_reg_msg,    \
+	  ree_rd_wr_reg_msg)                                                   \
+	M(REE_RULE_DB_PROG, 0xE03, ree_rule_db_prog, ree_rule_db_prog_req_msg, \
+	  msg_rsp)                                                             \
+	M(REE_RULE_DB_LEN_GET, 0xE04, ree_rule_db_len_get, ree_req_msg,        \
+	  ree_rule_db_len_rsp_msg)                                             \
+	M(REE_RULE_DB_GET, 0xE05, ree_rule_db_get, ree_rule_db_get_req_msg,    \
+	  ree_rule_db_get_rsp_msg)                                             \
 	/* SDP mbox IDs (range 0x1000 - 0x11FF) */                             \
 	M(SET_SDP_CHAN_INFO, 0x1000, set_sdp_chan_info, sdp_chan_info_msg,     \
 	  msg_rsp)                                                             \
@@ -1452,6 +1462,96 @@  struct cpt_eng_grp_rsp {
 	uint8_t __io eng_grp_num;
 };
 
+/* REE mailbox error codes
+ * Range 1001 - 1100.
+ */
+enum ree_af_status {
+	REE_AF_ERR_RULE_UNKNOWN_VALUE = -1001,
+	REE_AF_ERR_LF_NO_MORE_RESOURCES = -1002,
+	REE_AF_ERR_LF_INVALID = -1003,
+	REE_AF_ERR_ACCESS_DENIED = -1004,
+	REE_AF_ERR_RULE_DB_PARTIAL = -1005,
+	REE_AF_ERR_RULE_DB_EQ_BAD_VALUE = -1006,
+	REE_AF_ERR_RULE_DB_BLOCK_ALLOC_FAILED = -1007,
+	REE_AF_ERR_BLOCK_NOT_IMPLEMENTED = -1008,
+	REE_AF_ERR_RULE_DB_INC_OFFSET_TOO_BIG = -1009,
+	REE_AF_ERR_RULE_DB_OFFSET_TOO_BIG = -1010,
+	REE_AF_ERR_Q_IS_GRACEFUL_DIS = -1011,
+	REE_AF_ERR_Q_NOT_GRACEFUL_DIS = -1012,
+	REE_AF_ERR_RULE_DB_ALLOC_FAILED = -1013,
+	REE_AF_ERR_RULE_DB_TOO_BIG = -1014,
+	REE_AF_ERR_RULE_DB_GEQ_BAD_VALUE = -1015,
+	REE_AF_ERR_RULE_DB_LEQ_BAD_VALUE = -1016,
+	REE_AF_ERR_RULE_DB_WRONG_LENGTH = -1017,
+	REE_AF_ERR_RULE_DB_WRONG_OFFSET = -1018,
+	REE_AF_ERR_RULE_DB_BLOCK_TOO_BIG = -1019,
+	REE_AF_ERR_RULE_DB_SHOULD_FILL_REQUEST = -1020,
+	REE_AF_ERR_RULE_DBI_ALLOC_FAILED = -1021,
+	REE_AF_ERR_LF_WRONG_PRIORITY = -1022,
+	REE_AF_ERR_LF_SIZE_TOO_BIG = -1023,
+};
+
+/* REE mbox message formats */
+
+struct ree_req_msg {
+	struct mbox_msghdr hdr;
+	uint32_t __io blkaddr;
+};
+
+struct ree_lf_req_msg {
+	struct mbox_msghdr hdr;
+	uint32_t __io blkaddr;
+	uint32_t __io size;
+	uint8_t __io lf;
+	uint8_t __io pri;
+};
+
+struct ree_rule_db_prog_req_msg {
+	struct mbox_msghdr hdr;
+#define REE_RULE_DB_REQ_BLOCK_SIZE ((64ULL * 1024ULL) >> 1)
+	uint8_t __io rule_db[REE_RULE_DB_REQ_BLOCK_SIZE];
+	uint32_t __io blkaddr;	     /* REE0 or REE1 */
+	uint32_t __io total_len;     /* total len of rule db */
+	uint32_t __io offset;	     /* offset of current rule db block */
+	uint16_t __io len;	     /* length of rule db block */
+	uint8_t __io is_last;	     /* is this the last block */
+	uint8_t __io is_incremental; /* is incremental flow */
+	uint8_t __io is_dbi;	     /* is rule db incremental */
+};
+
+struct ree_rule_db_get_req_msg {
+	struct mbox_msghdr hdr;
+	uint32_t __io blkaddr;
+	uint32_t __io offset; /* retrieve db from this offset */
+	uint8_t __io is_dbi;  /* is request for rule db incremental */
+};
+
+struct ree_rd_wr_reg_msg {
+	struct mbox_msghdr hdr;
+	uint64_t __io reg_offset;
+	uint64_t __io *ret_val;
+	uint64_t __io val;
+	uint32_t __io blkaddr;
+	uint8_t __io is_write;
+};
+
+struct ree_rule_db_len_rsp_msg {
+	struct mbox_msghdr hdr;
+	uint32_t __io blkaddr;
+	uint32_t __io len;
+	uint32_t __io inc_len;
+};
+
+struct ree_rule_db_get_rsp_msg {
+	struct mbox_msghdr hdr;
+#define REE_RULE_DB_RSP_BLOCK_SIZE (15ULL * 1024ULL)
+	uint8_t __io rule_db[REE_RULE_DB_RSP_BLOCK_SIZE];
+	uint32_t __io total_len; /* total len of rule db */
+	uint32_t __io offset;	 /* offset of current rule db block */
+	uint16_t __io len;	 /* length of rule db block */
+	uint8_t __io is_last;	 /* is this the last block */
+};
+
 /* NPC mbox message structs */
 
 #define NPC_MCAM_ENTRY_INVALID 0xFFFF