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 * Shadow table type configuration array
34 struct tf_shadow_tbl_cfg *shadow_cfg;
36 * Boolean controlling the request shadow copy.
40 * Session resource allocations
42 struct tf_session_resources *resources;
46 * Table allocation parameters
48 struct tf_tbl_alloc_parms {
50 * [in] Receive or transmit direction
54 * [in] Type of the allocation
56 enum tf_tbl_type type;
58 * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
60 uint32_t tbl_scope_id;
62 * [out] Idx of allocated entry or found entry (if search_enable)
68 * Table free parameters
70 struct tf_tbl_free_parms {
72 * [in] Receive or transmit direction
76 * [in] Type of the allocation type
78 enum tf_tbl_type type;
80 * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
82 uint32_t tbl_scope_id;
90 * Table set parameters
92 struct tf_tbl_set_parms {
94 * [in] Receive or transmit direction
98 * [in] Type of object to set
100 enum tf_tbl_type type;
102 * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
104 uint32_t tbl_scope_id;
112 uint16_t data_sz_in_bytes;
114 * [in] Entry index to write to
120 * Table get parameters
122 struct tf_tbl_get_parms {
124 * [in] Receive or transmit direction
128 * [in] Type of object to get
130 enum tf_tbl_type type;
138 uint16_t data_sz_in_bytes;
140 * [in] Entry index to read
146 * Table get bulk parameters
148 struct tf_tbl_get_bulk_parms {
150 * [in] Receive or transmit direction
154 * [in] Type of object to get
156 enum tf_tbl_type type;
158 * [in] Starting index to read from
160 uint32_t starting_idx;
162 * [in] Number of sequential entries
164 uint16_t num_entries;
166 * [in] Size of the single entry
168 uint16_t entry_sz_in_bytes;
170 * [out] Host physical address, where the data
171 * will be copied to by the firmware.
172 * Use tfp_calloc() API and mem_pa
173 * variable of the tfp_calloc_parms
174 * structure for the physical address.
176 uint64_t physical_mem_addr;
186 struct rm_db *tbl_db[TF_DIR_MAX];
200 * @ref tf_tbl_alloc_search
206 * @ref tf_tbl_bulk_get
210 * Initializes the Table module with the requested DBs. Must be
211 * invoked as the first thing before any of the access functions.
214 * Pointer to TF handle, used for HCAPI communication
217 * Pointer to Table configuration parameters
220 * - (0) if successful.
221 * - (-EINVAL) on failure.
223 int tf_tbl_bind(struct tf *tfp,
224 struct tf_tbl_cfg_parms *parms);
227 * Cleans up the private DBs and releases all the data.
230 * Pointer to TF handle, used for HCAPI communication
233 * Pointer to parameters
236 * - (0) if successful.
237 * - (-EINVAL) on failure.
239 int tf_tbl_unbind(struct tf *tfp);
242 * Allocates the requested table type from the internal RM DB.
245 * Pointer to TF handle, used for HCAPI communication
248 * Pointer to Table allocation parameters
251 * - (0) if successful.
252 * - (-EINVAL) on failure.
254 int tf_tbl_alloc(struct tf *tfp,
255 struct tf_tbl_alloc_parms *parms);
258 * Free's the requested table type and returns it to the DB. If shadow
259 * DB is enabled its searched first and if found the element refcount
260 * is decremented. If refcount goes to 0 then its returned to the
264 * Pointer to TF handle, used for HCAPI communication
267 * Pointer to Table free parameters
270 * - (0) if successful.
271 * - (-EINVAL) on failure.
273 int tf_tbl_free(struct tf *tfp,
274 struct tf_tbl_free_parms *parms);
277 * Configures the requested element by sending a firmware request which
278 * then installs it into the device internal structures.
281 * Pointer to TF handle, used for HCAPI communication
284 * Pointer to Table set parameters
287 * - (0) if successful.
288 * - (-EINVAL) on failure.
290 int tf_tbl_set(struct tf *tfp,
291 struct tf_tbl_set_parms *parms);
294 * Retrieves the requested element by sending a firmware request to get
298 * Pointer to TF handle, used for HCAPI communication
301 * Pointer to Table get parameters
304 * - (0) if successful.
305 * - (-EINVAL) on failure.
307 int tf_tbl_get(struct tf *tfp,
308 struct tf_tbl_get_parms *parms);
311 * Retrieves bulk block of elements by sending a firmware request to
315 * Pointer to TF handle, used for HCAPI communication
318 * Pointer to Table get bulk parameters
321 * - (0) if successful.
322 * - (-EINVAL) on failure.
324 int tf_tbl_bulk_get(struct tf *tfp,
325 struct tf_tbl_get_bulk_parms *parms);
328 * Retrieves the allocated resource info
331 * Pointer to TF handle, used for HCAPI communication
334 * Pointer to Table resource info parameters
337 * - (0) if successful.
338 * - (-EINVAL) on failure.
341 tf_tbl_get_resc_info(struct tf *tfp,
342 struct tf_tbl_resource_info *tbl);
344 #endif /* TF_TBL_TYPE_H */