- * Hardware Page sizes supported for EEM:
- * 4K, 8K, 64K, 256K, 1M, 2M, 4M, 1G.
- *
- * Round-down other page sizes to the lower hardware page
- * size supported.
- */
-#define TF_EM_PAGE_SIZE_4K 12
-#define TF_EM_PAGE_SIZE_8K 13
-#define TF_EM_PAGE_SIZE_64K 16
-#define TF_EM_PAGE_SIZE_256K 18
-#define TF_EM_PAGE_SIZE_1M 20
-#define TF_EM_PAGE_SIZE_2M 21
-#define TF_EM_PAGE_SIZE_4M 22
-#define TF_EM_PAGE_SIZE_1G 30
-
-/* Set page size */
-#define BNXT_TF_PAGE_SIZE TF_EM_PAGE_SIZE_2M
-
-#if (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_4K) /** 4K */
-#define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_4K
-#define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_4K
-#elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_8K) /** 8K */
-#define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_8K
-#define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_8K
-#elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_64K) /** 64K */
-#define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_64K
-#define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_64K
-#elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_256K) /** 256K */
-#define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_256K
-#define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_256K
-#elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_1M) /** 1M */
-#define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_1M
-#define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_1M
-#elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_2M) /** 2M */
-#define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_2M
-#define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_2M
-#elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_4M) /** 4M */
-#define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_4M
-#define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_4M
-#elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_1G) /** 1G */
-#define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_1G
-#define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_1G
-#else
-#error "Invalid Page Size specified. Please use a TF_EM_PAGE_SIZE_n define"
-#endif
+ * Table configuration parameters
+ */
+struct tf_tbl_cfg_parms {
+ /**
+ * Number of table types in each of the configuration arrays
+ */
+ uint16_t num_elements;
+ /**
+ * Table Type element configuration array
+ */
+ struct tf_rm_element_cfg *cfg;
+ /**
+ * Shadow table type configuration array
+ */
+ struct tf_shadow_tbl_cfg *shadow_cfg;
+ /**
+ * Boolean controlling the request shadow copy.
+ */
+ bool shadow_copy;
+ /**
+ * Session resource allocations
+ */
+ struct tf_session_resources *resources;
+};
+
+/**
+ * Table allocation parameters
+ */
+struct tf_tbl_alloc_parms {
+ /**
+ * [in] Receive or transmit direction
+ */
+ enum tf_dir dir;
+ /**
+ * [in] Type of the allocation
+ */
+ enum tf_tbl_type type;
+ /**
+ * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
+ */
+ uint32_t tbl_scope_id;
+ /**
+ * [out] Idx of allocated entry or found entry (if search_enable)
+ */
+ uint32_t *idx;
+};
+
+/**
+ * Table free parameters
+ */
+struct tf_tbl_free_parms {
+ /**
+ * [in] Receive or transmit direction
+ */
+ enum tf_dir dir;
+ /**
+ * [in] Type of the allocation type
+ */
+ enum tf_tbl_type type;
+ /**
+ * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
+ */
+ uint32_t tbl_scope_id;
+ /**
+ * [in] Index to free
+ */
+ uint32_t idx;
+ /**
+ * [out] Reference count after free, only valid if session has been
+ * created with shadow_copy.
+ */
+ uint16_t ref_cnt;
+};
+
+/**
+ * Table allocate search parameters
+ */
+struct tf_tbl_alloc_search_parms {
+ /**
+ * [in] Receive or transmit direction
+ */
+ enum tf_dir dir;
+ /**
+ * [in] Type of the allocation
+ */
+ enum tf_tbl_type type;
+ /**
+ * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
+ */
+ uint32_t tbl_scope_id;
+ /**
+ * [in] Result data to search for
+ */
+ uint8_t *result;
+ /**
+ * [in] Result data size in bytes
+ */
+ uint16_t result_sz_in_bytes;
+ /**
+ * [in] Whether or not to allocate on MISS, 1 is allocate.
+ */
+ uint8_t alloc;
+ /**
+ * [out] If search_enable, set if matching entry found
+ */
+ uint8_t hit;
+ /**
+ * [out] The status of the search (REJECT, MISS, HIT)
+ */
+ enum tf_search_status search_status;
+ /**
+ * [out] Current ref count after allocation
+ */
+ uint16_t ref_cnt;
+ /**
+ * [out] Idx of allocated entry or found entry
+ */
+ uint32_t idx;
+};
+
+/**
+ * Table set parameters
+ */
+struct tf_tbl_set_parms {
+ /**
+ * [in] Receive or transmit direction
+ */
+ enum tf_dir dir;
+ /**
+ * [in] Type of object to set
+ */
+ enum tf_tbl_type type;
+ /**
+ * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
+ */
+ uint32_t tbl_scope_id;
+ /**
+ * [in] Entry data
+ */
+ uint8_t *data;
+ /**
+ * [in] Entry size
+ */
+ uint16_t data_sz_in_bytes;
+ /**
+ * [in] Entry index to write to
+ */
+ uint32_t idx;
+};
+
+/**
+ * Table get parameters
+ */
+struct tf_tbl_get_parms {
+ /**
+ * [in] Receive or transmit direction
+ */
+ enum tf_dir dir;
+ /**
+ * [in] Type of object to get
+ */
+ enum tf_tbl_type type;
+ /**
+ * [out] Entry data
+ */
+ uint8_t *data;
+ /**
+ * [out] Entry size
+ */
+ uint16_t data_sz_in_bytes;
+ /**
+ * [in] Entry index to read
+ */
+ uint32_t idx;
+};
+
+/**
+ * Table get bulk parameters
+ */
+struct tf_tbl_get_bulk_parms {
+ /**
+ * [in] Receive or transmit direction
+ */
+ enum tf_dir dir;
+ /**
+ * [in] Type of object to get
+ */
+ enum tf_tbl_type type;
+ /**
+ * [in] Starting index to read from
+ */
+ uint32_t starting_idx;
+ /**
+ * [in] Number of sequential entries
+ */
+ uint16_t num_entries;
+ /**
+ * [in] Size of the single entry
+ */
+ uint16_t entry_sz_in_bytes;
+ /**
+ * [out] Host physical address, where the data
+ * will be copied to by the firmware.
+ * Use tfp_calloc() API and mem_pa
+ * variable of the tfp_calloc_parms
+ * structure for the physical address.
+ */
+ uint64_t physical_mem_addr;
+};
+
+/**
+ * @page tbl Table
+ *
+ * @ref tf_tbl_bind
+ *
+ * @ref tf_tbl_unbind
+ *
+ * @ref tf_tbl_alloc
+ *
+ * @ref tf_tbl_free
+ *
+ * @ref tf_tbl_alloc_search
+ *
+ * @ref tf_tbl_set
+ *
+ * @ref tf_tbl_get
+ *
+ * @ref tf_tbl_bulk_get
+ */