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