1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019-2020 Broadcom
16 /** table scope control block content */
20 uint32_t max_entries_supported;
21 uint16_t key_entry_size;
22 uint16_t record_entry_size;
23 uint16_t efc_entry_size;
26 /** Invalid table scope id */
27 #define TF_TBL_SCOPE_INVALID 0xffffffff
30 * Table Scope Control Block
32 * Holds private data for a table scope. Only one instance of a table
33 * scope with Internal EM is supported.
35 struct tf_tbl_scope_cb {
36 uint32_t tbl_scope_id;
38 struct hcapi_cfa_em_ctx_mem_info em_ctx_info[TF_DIR_MAX];
39 struct tf_em_caps em_caps[TF_DIR_MAX];
40 struct stack ext_act_pool[TF_DIR_MAX];
41 uint32_t *ext_act_pool_mem[TF_DIR_MAX];
44 /** Hardware Page sizes supported for EEM: 4K, 8K, 64K, 256K, 1M, 2M, 4M, 1G.
45 * Round-down other page sizes to the lower hardware page size supported.
47 #define TF_EM_PAGE_SIZE_4K 12
48 #define TF_EM_PAGE_SIZE_8K 13
49 #define TF_EM_PAGE_SIZE_64K 16
50 #define TF_EM_PAGE_SIZE_256K 18
51 #define TF_EM_PAGE_SIZE_1M 20
52 #define TF_EM_PAGE_SIZE_2M 21
53 #define TF_EM_PAGE_SIZE_4M 22
54 #define TF_EM_PAGE_SIZE_1G 30
57 #define BNXT_TF_PAGE_SIZE TF_EM_PAGE_SIZE_2M
59 #if (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_4K) /** 4K */
60 #define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_4K
61 #define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_4K
62 #elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_8K) /** 8K */
63 #define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_8K
64 #define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_8K
65 #elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_64K) /** 64K */
66 #define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_64K
67 #define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_64K
68 #elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_256K) /** 256K */
69 #define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_256K
70 #define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_256K
71 #elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_1M) /** 1M */
72 #define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_1M
73 #define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_1M
74 #elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_2M) /** 2M */
75 #define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_2M
76 #define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_2M
77 #elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_4M) /** 4M */
78 #define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_4M
79 #define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_4M
80 #elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_1G) /** 1G */
81 #define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_1G
82 #define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_1G
84 #error "Invalid Page Size specified. Please use a TF_EM_PAGE_SIZE_n define"
87 #define TF_EM_PAGE_SIZE (1 << TF_EM_PAGE_SHIFT)
88 #define TF_EM_PAGE_ALIGNMENT (1 << TF_EM_PAGE_SHIFT)
91 * Initialize table pool structure to indicate
92 * no table scope has been associated with the
93 * external pool of indexes.
98 tf_init_tbl_pool(struct tf_session *session);
100 #endif /* _TF_TBL_H_ */