1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2019-2023 Broadcom 3 * All rights reserved. 4 */ 5 6 #ifndef TF_TBL_SRAM_H_ 7 #define TF_TBL_SRAM_H_ 8 9 #include "tf_core.h" 10 #include "stack.h" 11 12 /** 13 * The SRAM Table module provides processing of managed SRAM types. 14 */ 15 16 /** 17 * @page tblsram SRAM Table 18 * 19 * @ref tf_tbl_sram_bind 20 * 21 * @ref tf_tbl_sram_unbind 22 * 23 * @ref tf_tbl_sram_alloc 24 * 25 * @ref tf_tbl_sram_free 26 * 27 * @ref tf_tbl_sram_set 28 * 29 * @ref tf_tbl_sram_get 30 * 31 * @ref tf_tbl_sram_bulk_get 32 */ 33 34 /** 35 * Initializes the Table module with the requested DBs. Must be 36 * invoked as the first thing before any of the access functions. 37 * 38 * [in] tfp 39 * Pointer to TF handle, used for HCAPI communication 40 * 41 * [in] parms 42 * Pointer to Table configuration parameters 43 * 44 * Returns 45 * - (0) if successful. 46 * - (-EINVAL) on failure. 47 */ 48 int tf_tbl_sram_bind(struct tf *tfp); 49 50 /** 51 * Cleans up the private DBs and releases all the data. 52 * 53 * [in] tfp 54 * Pointer to TF handle, used for HCAPI communication 55 * 56 * [in] parms 57 * Pointer to parameters 58 * 59 * Returns 60 * - (0) if successful. 61 * - (-EINVAL) on failure. 62 */ 63 int tf_tbl_sram_unbind(struct tf *tfp); 64 65 /** 66 * Allocates the requested table type from the internal RM DB. 67 * 68 * [in] tfp 69 * Pointer to TF handle, used for HCAPI communication 70 * 71 * [in] parms 72 * Pointer to Table allocation parameters 73 * 74 * Returns 75 * - (0) if successful. 76 * - (-EINVAL) on failure. 77 */ 78 int tf_tbl_sram_alloc(struct tf *tfp, 79 struct tf_tbl_alloc_parms *parms); 80 81 /** 82 * Free's the requested table type and returns it to the DB. If shadow 83 * DB is enabled its searched first and if found the element refcount 84 * is decremented. If refcount goes to 0 then its returned to the 85 * table type DB. 86 * 87 * [in] tfp 88 * Pointer to TF handle, used for HCAPI communication 89 * 90 * [in] parms 91 * Pointer to Table free parameters 92 * 93 * Returns 94 * - (0) if successful. 95 * - (-EINVAL) on failure. 96 */ 97 int tf_tbl_sram_free(struct tf *tfp, 98 struct tf_tbl_free_parms *parms); 99 100 /** 101 * Configures the requested element by sending a firmware request which 102 * then installs it into the device internal structures. 103 * 104 * [in] tfp 105 * Pointer to TF handle, used for HCAPI communication 106 * 107 * [in] parms 108 * Pointer to Table set parameters 109 * 110 * Returns 111 * - (0) if successful. 112 * - (-EINVAL) on failure. 113 */ 114 int tf_tbl_sram_set(struct tf *tfp, 115 struct tf_tbl_set_parms *parms); 116 117 /** 118 * Retrieves the requested element by sending a firmware request to get 119 * the element. 120 * 121 * [in] tfp 122 * Pointer to TF handle, used for HCAPI communication 123 * 124 * [in] parms 125 * Pointer to Table get parameters 126 * 127 * Returns 128 * - (0) if successful. 129 * - (-EINVAL) on failure. 130 */ 131 int tf_tbl_sram_get(struct tf *tfp, 132 struct tf_tbl_get_parms *parms); 133 134 /** 135 * Retrieves bulk block of elements by sending a firmware request to 136 * get the elements. 137 * 138 * [in] tfp 139 * Pointer to TF handle, used for HCAPI communication 140 * 141 * [in] parms 142 * Pointer to Table get bulk parameters 143 * 144 * Returns 145 * - (0) if successful. 146 * - (-EINVAL) on failure. 147 */ 148 int tf_tbl_sram_bulk_get(struct tf *tfp, 149 struct tf_tbl_get_bulk_parms *parms); 150 #endif /* TF_TBL_SRAM_H */ 151