1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019-2021 Broadcom
15 * The Table module provides processing of Internal TF table types.
20 * Table configuration parameters
22 struct tf_tbl_cfg_parms {
24 * Number of table types in each of the configuration arrays
26 uint16_t num_elements;
28 * Table Type element configuration array
30 struct tf_rm_element_cfg *cfg;
32 * Session resource allocations
34 struct tf_session_resources *resources;
38 * Table allocation parameters
40 struct tf_tbl_alloc_parms {
42 * [in] Receive or transmit direction
46 * [in] Type of the allocation
48 enum tf_tbl_type type;
50 * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
52 uint32_t tbl_scope_id;
54 * [out] Idx of allocated entry or found entry (if search_enable)
60 * Table free parameters
62 struct tf_tbl_free_parms {
64 * [in] Receive or transmit direction
68 * [in] Type of the allocation type
70 enum tf_tbl_type type;
72 * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
74 uint32_t tbl_scope_id;
82 * Table set parameters
84 struct tf_tbl_set_parms {
86 * [in] Receive or transmit direction
90 * [in] Type of object to set
92 enum tf_tbl_type type;
94 * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
96 uint32_t tbl_scope_id;
104 uint16_t data_sz_in_bytes;
106 * [in] Entry index to write to
112 * Table get parameters
114 struct tf_tbl_get_parms {
116 * [in] Receive or transmit direction
120 * [in] Type of object to get
122 enum tf_tbl_type type;
130 uint16_t data_sz_in_bytes;
132 * [in] Entry index to read
138 * Table get bulk parameters
140 struct tf_tbl_get_bulk_parms {
142 * [in] Receive or transmit direction
146 * [in] Type of object to get
148 enum tf_tbl_type type;
150 * [in] Starting index to read from
152 uint32_t starting_idx;
154 * [in] Number of sequential entries
156 uint16_t num_entries;
158 * [in] Size of the single entry
160 uint16_t entry_sz_in_bytes;
162 * [out] Host physical address, where the data
163 * will be copied to by the firmware.
164 * Use tfp_calloc() API and mem_pa
165 * variable of the tfp_calloc_parms
166 * structure for the physical address.
168 uint64_t physical_mem_addr;
178 struct rm_db *tbl_db[TF_DIR_MAX];
196 * @ref tf_tbl_bulk_get
200 * Initializes the Table module with the requested DBs. Must be
201 * invoked as the first thing before any of the access functions.
204 * Pointer to TF handle, used for HCAPI communication
207 * Pointer to Table configuration parameters
210 * - (0) if successful.
211 * - (-EINVAL) on failure.
213 int tf_tbl_bind(struct tf *tfp,
214 struct tf_tbl_cfg_parms *parms);
217 * Cleans up the private DBs and releases all the data.
220 * Pointer to TF handle, used for HCAPI communication
223 * Pointer to parameters
226 * - (0) if successful.
227 * - (-EINVAL) on failure.
229 int tf_tbl_unbind(struct tf *tfp);
232 * Allocates the requested table type from the internal RM DB.
235 * Pointer to TF handle, used for HCAPI communication
238 * Pointer to Table allocation parameters
241 * - (0) if successful.
242 * - (-EINVAL) on failure.
244 int tf_tbl_alloc(struct tf *tfp,
245 struct tf_tbl_alloc_parms *parms);
248 * Frees the requested table type and returns it to the DB.
251 * Pointer to TF handle, used for HCAPI communication
254 * Pointer to Table free parameters
257 * - (0) if successful.
258 * - (-EINVAL) on failure.
260 int tf_tbl_free(struct tf *tfp,
261 struct tf_tbl_free_parms *parms);
264 * Configures the requested element by sending a firmware request which
265 * then installs it into the device internal structures.
268 * Pointer to TF handle, used for HCAPI communication
271 * Pointer to Table set parameters
274 * - (0) if successful.
275 * - (-EINVAL) on failure.
277 int tf_tbl_set(struct tf *tfp,
278 struct tf_tbl_set_parms *parms);
281 * Retrieves the requested element by sending a firmware request to get
285 * Pointer to TF handle, used for HCAPI communication
288 * Pointer to Table get parameters
291 * - (0) if successful.
292 * - (-EINVAL) on failure.
294 int tf_tbl_get(struct tf *tfp,
295 struct tf_tbl_get_parms *parms);
298 * Retrieves bulk block of elements by sending a firmware request to
302 * Pointer to TF handle, used for HCAPI communication
305 * Pointer to Table get bulk parameters
308 * - (0) if successful.
309 * - (-EINVAL) on failure.
311 int tf_tbl_bulk_get(struct tf *tfp,
312 struct tf_tbl_get_bulk_parms *parms);
315 * Retrieves the allocated resource info
318 * Pointer to TF handle, used for HCAPI communication
321 * Pointer to Table resource info parameters
324 * - (0) if successful.
325 * - (-EINVAL) on failure.
328 tf_tbl_get_resc_info(struct tf *tfp,
329 struct tf_tbl_resource_info *tbl);
331 #endif /* TF_TBL_TYPE_H */