return 0;
}
-int sram_bank_hcapi_type[] = {
+static int sram_bank_hcapi_type[] = {
CFA_RESOURCE_TYPE_P58_SRAM_BANK_0,
CFA_RESOURCE_TYPE_P58_SRAM_BANK_1,
CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
* - (-EINVAL) on failure.
*/
static int tf_dev_p58_set_sram_policy(enum tf_dir dir,
- uint8_t *bank_id)
+ enum tf_sram_bank_id *bank_id)
{
struct tf_rm_element_cfg *rm_cfg = tf_tbl_p58[dir];
uint8_t type;
uint8_t parent[TF_SRAM_BANK_ID_MAX] = { 0xFF, 0xFF, 0xFF, 0xFF };
for (type = TF_TBL_TYPE_FULL_ACT_RECORD;
- type < TF_TBL_TYPE_ACT_MODIFY_64B + 1; type++) {
- if (bank_id[type] > 3)
+ type <= TF_TBL_TYPE_ACT_MODIFY_64B; type++) {
+ if (bank_id[type] >= TF_SRAM_BANK_ID_MAX)
return -EINVAL;
rm_cfg[type].hcapi_type = sram_bank_hcapi_type[bank_id[type]];
* - (-EINVAL) on failure.
*/
static int tf_dev_p58_get_sram_policy(enum tf_dir dir,
- uint8_t *bank_id)
+ enum tf_sram_bank_id *bank_id)
{
struct tf_rm_element_cfg *rm_cfg = tf_tbl_p58[dir];
uint8_t type;
}
tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
-
- /* Do not check meter drop counter because it is not allocated
- * resources
+ /* Verify that the entry has been previously allocated.
+ * for meter drop counter, check the corresponding meter
+ * entry
*/
- if (parms->type != TF_TBL_TYPE_METER_DROP_CNT) {
- /* Verify that the entry has been previously allocated */
- aparms.rm_db = tbl_db->tbl_db[parms->dir];
+ aparms.rm_db = tbl_db->tbl_db[parms->dir];
+ if (parms->type != TF_TBL_TYPE_METER_DROP_CNT)
aparms.subtype = parms->type;
- aparms.allocated = &allocated;
- aparms.index = parms->idx;
- rc = tf_rm_is_allocated(&aparms);
- if (rc)
- return rc;
+ else
+ aparms.subtype = TF_TBL_TYPE_METER_INST;
+ aparms.allocated = &allocated;
+ aparms.index = parms->idx;
+ rc = tf_rm_is_allocated(&aparms);
+ if (rc)
+ return rc;
- if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) {
- TFP_DRV_LOG(ERR,
- "%s, Invalid or not allocated, type:%s, idx:%d\n",
- tf_dir_2_str(parms->dir),
- tf_tbl_type_2_str(parms->type),
- parms->idx);
- return -EINVAL;
- }
+ if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) {
+ TFP_DRV_LOG(ERR,
+ "%s, Invalid or not allocated, type:%s, idx:%d\n",
+ tf_dir_2_str(parms->dir),
+ tf_tbl_type_2_str(parms->type),
+ parms->idx);
+ return -EINVAL;
}
/* Set the entry */
}
tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
- /* Do not check meter drop counter because it is not allocated
- * resources.
+ /* Verify that the entry has been previously allocated.
+ * for meter drop counter, check the corresponding meter
+ * entry
*/
- if (parms->type != TF_TBL_TYPE_METER_DROP_CNT) {
- /* Verify that the entry has been previously allocated */
- aparms.rm_db = tbl_db->tbl_db[parms->dir];
+ aparms.rm_db = tbl_db->tbl_db[parms->dir];
+ if (parms->type != TF_TBL_TYPE_METER_DROP_CNT)
aparms.subtype = parms->type;
- aparms.index = parms->idx;
- aparms.allocated = &allocated;
- rc = tf_rm_is_allocated(&aparms);
- if (rc)
- return rc;
+ else
+ aparms.subtype = TF_TBL_TYPE_METER_INST;
+ aparms.index = parms->idx;
+ aparms.allocated = &allocated;
+ rc = tf_rm_is_allocated(&aparms);
+ if (rc)
+ return rc;
- if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) {
- TFP_DRV_LOG(ERR,
- "%s, Invalid or not allocated index, type:%s, idx:%d\n",
- tf_dir_2_str(parms->dir),
- tf_tbl_type_2_str(parms->type),
- parms->idx);
- return -EINVAL;
- }
+ if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) {
+ TFP_DRV_LOG(ERR,
+ "%s, Invalid or not allocated index, type:%s, idx:%d\n",
+ tf_dir_2_str(parms->dir),
+ tf_tbl_type_2_str(parms->type),
+ parms->idx);
+ return -EINVAL;
}
/* Set the entry */