1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019-2020 Broadcom
10 #include "tf_session.h"
12 #define TF_HW_EM_KEY_MAX_SIZE 52
13 #define TF_EM_KEY_RECORD_SIZE 64
18 struct tf_eem_entry_hdr {
21 * The header is made up of two words,
22 * this is the first word. This field has multiple
23 * subfields, there is no suitable single name for
24 * it so just going with word1.
26 #define TF_LKUP_RECORD_VALID_SHIFT 31
27 #define TF_LKUP_RECORD_VALID_MASK 0x80000000
28 #define TF_LKUP_RECORD_L1_CACHEABLE_SHIFT 30
29 #define TF_LKUP_RECORD_L1_CACHEABLE_MASK 0x40000000
30 #define TF_LKUP_RECORD_STRENGTH_SHIFT 28
31 #define TF_LKUP_RECORD_STRENGTH_MASK 0x30000000
32 #define TF_LKUP_RECORD_RESERVED_SHIFT 17
33 #define TF_LKUP_RECORD_RESERVED_MASK 0x0FFE0000
34 #define TF_LKUP_RECORD_KEY_SIZE_SHIFT 8
35 #define TF_LKUP_RECORD_KEY_SIZE_MASK 0x0001FF00
36 #define TF_LKUP_RECORD_ACT_REC_SIZE_SHIFT 3
37 #define TF_LKUP_RECORD_ACT_REC_SIZE_MASK 0x000000F8
38 #define TF_LKUP_RECORD_ACT_REC_INT_SHIFT 2
39 #define TF_LKUP_RECORD_ACT_REC_INT_MASK 0x00000004
40 #define TF_LKUP_RECORD_EXT_FLOW_CTR_SHIFT 1
41 #define TF_LKUP_RECORD_EXT_FLOW_CTR_MASK 0x00000002
42 #define TF_LKUP_RECORD_ACT_PTR_MSB_SHIFT 0
43 #define TF_LKUP_RECORD_ACT_PTR_MSB_MASK 0x00000001
47 * Each EEM entry is 512-bit (64-bytes)
49 struct tf_eem_64b_entry {
50 /** Key is 448 bits - 56 bytes */
51 uint8_t key[TF_EM_KEY_RECORD_SIZE - sizeof(struct tf_eem_entry_hdr)];
52 /** Header is 8 bytes long */
53 struct tf_eem_entry_hdr hdr;
57 * Allocates EEM Table scope
60 * Pointer to TruFlow handle
63 * Pointer to input parameters
67 * -EINVAL - Parameter error
68 * -ENOMEM - Out of memory
70 int tf_alloc_eem_tbl_scope(struct tf *tfp,
71 struct tf_alloc_tbl_scope_parms *parms);
74 * Free's EEM Table scope control block
77 * Pointer to TruFlow handle
80 * Pointer to input parameters
84 * -EINVAL - Parameter error
86 int tf_free_eem_tbl_scope_cb(struct tf *tfp,
87 struct tf_free_tbl_scope_parms *parms);
90 * Function to search for table scope control block structure
91 * with specified table scope ID.
94 * Session to use for the search of the table scope control block
96 * Table scope ID to search for
99 * Pointer to the found table scope control block struct or NULL if
100 * table scope control block struct not found
102 struct tf_tbl_scope_cb *tbl_scope_cb_find(struct tf_session *session,
103 uint32_t tbl_scope_id);
105 int tf_insert_eem_entry(struct tf_session *session,
106 struct tf_tbl_scope_cb *tbl_scope_cb,
107 struct tf_insert_em_entry_parms *parms);
109 int tf_delete_eem_entry(struct tf *tfp,
110 struct tf_delete_em_entry_parms *parms);
112 void *tf_em_get_table_page(struct tf_tbl_scope_cb *tbl_scope_cb,
115 enum tf_em_table_type table_type);
117 #endif /* _TF_EM_H_ */