1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019-2020 Broadcom
14 * The Table module provides processing of Internal TF table types.
18 * Table configuration parameters
20 struct tf_tbl_cfg_parms {
22 * Number of table types in each of the configuration arrays
24 uint16_t num_elements;
26 * Table Type element configuration array
28 struct tf_rm_element_cfg *cfg;
30 * Shadow table type configuration array
32 struct tf_shadow_tbl_cfg *shadow_cfg;
34 * Boolean controlling the request shadow copy.
38 * Session resource allocations
40 struct tf_session_resources *resources;
44 * Table allocation parameters
46 struct tf_tbl_alloc_parms {
48 * [in] Receive or transmit direction
52 * [in] Type of the allocation
54 enum tf_tbl_type type;
56 * [out] Idx of allocated entry or found entry (if search_enable)
62 * Table free parameters
64 struct tf_tbl_free_parms {
66 * [in] Receive or transmit direction
70 * [in] Type of the allocation type
72 enum tf_tbl_type type;
78 * [out] Reference count after free, only valid if session has been
79 * created with shadow_copy.
85 * Table allocate search parameters
87 struct tf_tbl_alloc_search_parms {
89 * [in] Receive or transmit direction
93 * [in] Type of the allocation
95 enum tf_tbl_type type;
97 * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
99 uint32_t tbl_scope_id;
101 * [in] Enable search for matching entry. If the table type is
102 * internal the shadow copy will be searched before
103 * alloc. Session must be configured with shadow copy enabled.
105 uint8_t search_enable;
107 * [in] Result data to search for (if search_enable)
111 * [in] Result data size in bytes (if search_enable)
113 uint16_t result_sz_in_bytes;
115 * [out] If search_enable, set if matching entry found
119 * [out] Current ref count after allocation (if search_enable)
123 * [out] Idx of allocated entry or found entry (if search_enable)
129 * Table set parameters
131 struct tf_tbl_set_parms {
133 * [in] Receive or transmit direction
137 * [in] Type of object to set
139 enum tf_tbl_type type;
147 uint16_t data_sz_in_bytes;
149 * [in] Entry index to write to
155 * Table get parameters
157 struct tf_tbl_get_parms {
159 * [in] Receive or transmit direction
163 * [in] Type of object to get
165 enum tf_tbl_type type;
173 uint16_t data_sz_in_bytes;
175 * [in] Entry index to read
191 * @ref tf_tbl_alloc_search
199 * Initializes the Table module with the requested DBs. Must be
200 * invoked as the first thing before any of the access functions.
203 * Pointer to TF handle, used for HCAPI communication
206 * Pointer to Table configuration parameters
209 * - (0) if successful.
210 * - (-EINVAL) on failure.
212 int tf_tbl_bind(struct tf *tfp,
213 struct tf_tbl_cfg_parms *parms);
216 * Cleans up the private DBs and releases all the data.
219 * Pointer to TF handle, used for HCAPI communication
222 * Pointer to parameters
225 * - (0) if successful.
226 * - (-EINVAL) on failure.
228 int tf_tbl_unbind(struct tf *tfp);
231 * Allocates the requested table type from the internal RM DB.
234 * Pointer to TF handle, used for HCAPI communication
237 * Pointer to Table allocation parameters
240 * - (0) if successful.
241 * - (-EINVAL) on failure.
243 int tf_tbl_alloc(struct tf *tfp,
244 struct tf_tbl_alloc_parms *parms);
247 * Free's the requested table type and returns it to the DB. If shadow
248 * DB is enabled its searched first and if found the element refcount
249 * is decremented. If refcount goes to 0 then its returned to the
253 * Pointer to TF handle, used for HCAPI communication
256 * Pointer to Table free parameters
259 * - (0) if successful.
260 * - (-EINVAL) on failure.
262 int tf_tbl_free(struct tf *tfp,
263 struct tf_tbl_free_parms *parms);
266 * Supported if Shadow DB is configured. Searches the Shadow DB for
267 * any matching element. If found the refcount in the shadow DB is
268 * updated accordingly. If not found a new element is allocated and
269 * installed into the shadow DB.
272 * Pointer to TF handle, used for HCAPI communication
275 * Pointer to parameters
278 * - (0) if successful.
279 * - (-EINVAL) on failure.
281 int tf_tbl_alloc_search(struct tf *tfp,
282 struct tf_tbl_alloc_search_parms *parms);
285 * Configures the requested element by sending a firmware request which
286 * then installs it into the device internal structures.
289 * Pointer to TF handle, used for HCAPI communication
292 * Pointer to Table set parameters
295 * - (0) if successful.
296 * - (-EINVAL) on failure.
298 int tf_tbl_set(struct tf *tfp,
299 struct tf_tbl_set_parms *parms);
302 * Retrieves the requested element by sending a firmware request to get
306 * Pointer to TF handle, used for HCAPI communication
309 * Pointer to Table get parameters
312 * - (0) if successful.
313 * - (-EINVAL) on failure.
315 int tf_tbl_get(struct tf *tfp,
316 struct tf_tbl_get_parms *parms);
318 #endif /* TF_TBL_TYPE_H */