1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019-2020 Broadcom
14 * The Table Type module provides processing of Internal TF table types.
18 * Table Type configuration parameters
20 struct tf_tbl_type_cfg_parms {
22 * Number of table types in each of the configuration arrays
24 uint16_t num_elements;
27 * Table Type element configuration array
29 struct tf_rm_element_cfg *tbl_cfg[TF_DIR_MAX];
32 * Shadow table type configuration array
34 struct tf_shadow_tbl_type_cfg *tbl_shadow_cfg[TF_DIR_MAX];
38 * Table Type allocation parameters
40 struct tf_tbl_type_alloc_parms {
42 * [in] Receive or transmit direction
46 * [in] Type of the allocation
48 enum tf_tbl_type type;
50 * [out] Idx of allocated entry or found entry (if search_enable)
56 * Table Type free parameters
58 struct tf_tbl_type_free_parms {
60 * [in] Receive or transmit direction
64 * [in] Type of the allocation type
66 enum tf_tbl_type type;
72 * [out] Reference count after free, only valid if session has been
73 * created with shadow_copy.
78 struct tf_tbl_type_alloc_search_parms {
80 * [in] Receive or transmit direction
84 * [in] Type of the allocation
86 enum tf_tbl_type type;
88 * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
90 uint32_t tbl_scope_id;
92 * [in] Enable search for matching entry. If the table type is
93 * internal the shadow copy will be searched before
94 * alloc. Session must be configured with shadow copy enabled.
96 uint8_t search_enable;
98 * [in] Result data to search for (if search_enable)
102 * [in] Result data size in bytes (if search_enable)
104 uint16_t result_sz_in_bytes;
106 * [out] If search_enable, set if matching entry found
110 * [out] Current ref count after allocation (if search_enable)
114 * [out] Idx of allocated entry or found entry (if search_enable)
120 * Table Type set parameters
122 struct tf_tbl_type_set_parms {
124 * [in] Receive or transmit direction
128 * [in] Type of object to set
130 enum tf_tbl_type type;
138 uint16_t data_sz_in_bytes;
140 * [in] Entry index to write to
146 * Table Type get parameters
148 struct tf_tbl_type_get_parms {
150 * [in] Receive or transmit direction
154 * [in] Type of object to get
156 enum tf_tbl_type type;
164 uint16_t data_sz_in_bytes;
166 * [in] Entry index to read
172 * @page tbl_type Table Type
174 * @ref tf_tbl_type_bind
176 * @ref tf_tbl_type_unbind
178 * @ref tf_tbl_type_alloc
180 * @ref tf_tbl_type_free
182 * @ref tf_tbl_type_alloc_search
184 * @ref tf_tbl_type_set
186 * @ref tf_tbl_type_get
190 * Initializes the Table Type module with the requested DBs. Must be
191 * invoked as the first thing before any of the access functions.
194 * Pointer to TF handle, used for HCAPI communication
197 * Pointer to parameters
200 * - (0) if successful.
201 * - (-EINVAL) on failure.
203 int tf_tbl_type_bind(struct tf *tfp,
204 struct tf_tbl_type_cfg_parms *parms);
207 * Cleans up the private DBs and releases all the data.
210 * Pointer to TF handle, used for HCAPI communication
213 * Pointer to parameters
216 * - (0) if successful.
217 * - (-EINVAL) on failure.
219 int tf_tbl_type_unbind(struct tf *tfp);
222 * Allocates the requested table type from the internal RM DB.
225 * Pointer to TF handle, used for HCAPI communication
228 * Pointer to parameters
231 * - (0) if successful.
232 * - (-EINVAL) on failure.
234 int tf_tbl_type_alloc(struct tf *tfp,
235 struct tf_tbl_type_alloc_parms *parms);
238 * Free's the requested table type and returns it to the DB. If shadow
239 * DB is enabled its searched first and if found the element refcount
240 * is decremented. If refcount goes to 0 then its returned to the
244 * Pointer to TF handle, used for HCAPI communication
247 * Pointer to parameters
250 * - (0) if successful.
251 * - (-EINVAL) on failure.
253 int tf_tbl_type_free(struct tf *tfp,
254 struct tf_tbl_type_free_parms *parms);
257 * Supported if Shadow DB is configured. Searches the Shadow DB for
258 * any matching element. If found the refcount in the shadow DB is
259 * updated accordingly. If not found a new element is allocated and
260 * installed into the shadow DB.
263 * Pointer to TF handle, used for HCAPI communication
266 * Pointer to parameters
269 * - (0) if successful.
270 * - (-EINVAL) on failure.
272 int tf_tbl_type_alloc_search(struct tf *tfp,
273 struct tf_tbl_type_alloc_search_parms *parms);
276 * Configures the requested element by sending a firmware request which
277 * then installs it into the device internal structures.
280 * Pointer to TF handle, used for HCAPI communication
283 * Pointer to parameters
286 * - (0) if successful.
287 * - (-EINVAL) on failure.
289 int tf_tbl_type_set(struct tf *tfp,
290 struct tf_tbl_type_set_parms *parms);
293 * Retrieves the requested element by sending a firmware request to get
297 * Pointer to TF handle, used for HCAPI communication
300 * Pointer to parameters
303 * - (0) if successful.
304 * - (-EINVAL) on failure.
306 int tf_tbl_type_get(struct tf *tfp,
307 struct tf_tbl_type_get_parms *parms);
309 #endif /* TF_TBL_TYPE_H */