LCOV - code coverage report
Current view: top level - drivers/net/bnxt/tf_core - tf_device_p58.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 134 0.0 %
Date: 2024-01-22 16:26:08 Functions: 0 13 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 57 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(c) 2019-2023 Broadcom
       3                 :            :  * All rights reserved.
       4                 :            :  */
       5                 :            : 
       6                 :            : #include <rte_common.h>
       7                 :            : 
       8                 :            : #include "cfa_resource_types.h"
       9                 :            : #include "tf_device.h"
      10                 :            : #include "tf_identifier.h"
      11                 :            : #include "tf_tbl.h"
      12                 :            : #include "tf_tcam.h"
      13                 :            : #include "tf_tcam_shared.h"
      14                 :            : #include "tf_em.h"
      15                 :            : #include "tf_if_tbl.h"
      16                 :            : #include "tfp.h"
      17                 :            : #include "tf_msg_common.h"
      18                 :            : #include "tf_tbl_sram.h"
      19                 :            : #include "tf_util.h"
      20                 :            : 
      21                 :            : #define TF_DEV_P58_PARIF_MAX 16
      22                 :            : #define TF_DEV_P58_PF_MASK 0xfUL
      23                 :            : 
      24                 :            : /* For print alignment, make all entries 8 chars in this table */
      25                 :            : const char *tf_resource_str_p58[CFA_RESOURCE_TYPE_P58_LAST + 1] = {
      26                 :            :         [CFA_RESOURCE_TYPE_P58_METER]              = "meter   ",
      27                 :            :         [CFA_RESOURCE_TYPE_P58_SRAM_BANK_0]        = "sram_bk0",
      28                 :            :         [CFA_RESOURCE_TYPE_P58_SRAM_BANK_1]        = "sram_bk1",
      29                 :            :         [CFA_RESOURCE_TYPE_P58_SRAM_BANK_2]        = "sram_bk2",
      30                 :            :         [CFA_RESOURCE_TYPE_P58_SRAM_BANK_3]        = "sram_bk3",
      31                 :            :         [CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM_HIGH]  = "l2ctx_hi",
      32                 :            :         [CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM_LOW]   = "l2ctx_lo",
      33                 :            :         [CFA_RESOURCE_TYPE_P58_L2_CTXT_REMAP_HIGH] = "l2ctr_hi",
      34                 :            :         [CFA_RESOURCE_TYPE_P58_L2_CTXT_REMAP_LOW]  = "l2ctr_lo",
      35                 :            :         [CFA_RESOURCE_TYPE_P58_PROF_FUNC]          = "prf_func",
      36                 :            :         [CFA_RESOURCE_TYPE_P58_PROF_TCAM]          = "prf_tcam",
      37                 :            :         [CFA_RESOURCE_TYPE_P58_EM_PROF_ID]         = "em_prof ",
      38                 :            :         [CFA_RESOURCE_TYPE_P58_WC_TCAM_PROF_ID]    = "wc_prof ",
      39                 :            :         [CFA_RESOURCE_TYPE_P58_EM_REC]             = "em_rec  ",
      40                 :            :         [CFA_RESOURCE_TYPE_P58_WC_TCAM]            = "wc_tcam ",
      41                 :            :         [CFA_RESOURCE_TYPE_P58_METER_PROF]         = "mtr_prof",
      42                 :            :         [CFA_RESOURCE_TYPE_P58_MIRROR]             = "mirror  ",
      43                 :            :         [CFA_RESOURCE_TYPE_P58_EM_FKB]             = "em_fkb  ",
      44                 :            :         [CFA_RESOURCE_TYPE_P58_WC_FKB]             = "wc_fkb  ",
      45                 :            :         [CFA_RESOURCE_TYPE_P58_VEB_TCAM]           = "veb     ",
      46                 :            :         [CFA_RESOURCE_TYPE_P58_METADATA]           = "metadata",
      47                 :            :         [CFA_RESOURCE_TYPE_P58_METER_DROP_CNT]     = "meter_dc",
      48                 :            : };
      49                 :            : 
      50                 :            : struct tf_rm_element_cfg tf_tbl_p58[TF_DIR_MAX][TF_TBL_TYPE_MAX] = {
      51                 :            :         [TF_DIR_RX][TF_TBL_TYPE_EM_FKB] = {
      52                 :            :                 TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_EM_FKB,
      53                 :            :                 0, 0
      54                 :            :         },
      55                 :            :         [TF_DIR_RX][TF_TBL_TYPE_WC_FKB] = {
      56                 :            :                 TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_WC_FKB,
      57                 :            :                 0, 0
      58                 :            :         },
      59                 :            :         [TF_DIR_RX][TF_TBL_TYPE_METER_PROF] = {
      60                 :            :                 TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METER_PROF,
      61                 :            :                 0, 0
      62                 :            :         },
      63                 :            :         [TF_DIR_RX][TF_TBL_TYPE_METER_INST] = {
      64                 :            :                 TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METER,
      65                 :            :                 0, 0
      66                 :            :         },
      67                 :            :         [TF_DIR_RX][TF_TBL_TYPE_METER_DROP_CNT] = {
      68                 :            :                 TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METER_DROP_CNT,
      69                 :            :                 0, 0
      70                 :            :         },
      71                 :            :         [TF_DIR_RX][TF_TBL_TYPE_MIRROR_CONFIG] = {
      72                 :            :                 TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_MIRROR,
      73                 :            :                 0, 0
      74                 :            :         },
      75                 :            :         [TF_DIR_RX][TF_TBL_TYPE_METADATA] = {
      76                 :            :                 TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METADATA,
      77                 :            :                 0, 0
      78                 :            :         },
      79                 :            :         /* Policy - ARs in bank 1 */
      80                 :            :         [TF_DIR_RX][TF_TBL_TYPE_FULL_ACT_RECORD] = {
      81                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_PARENT,
      82                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_1,
      83                 :            :                 .slices          = 8,
      84                 :            :         },
      85                 :            :         [TF_DIR_RX][TF_TBL_TYPE_COMPACT_ACT_RECORD] = {
      86                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
      87                 :            :                 .parent_subtype  = TF_TBL_TYPE_FULL_ACT_RECORD,
      88                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_1,
      89                 :            :                 .slices          = 16,
      90                 :            :         },
      91                 :            :         /* Policy - Encaps in bank 2 */
      92                 :            :         [TF_DIR_RX][TF_TBL_TYPE_ACT_ENCAP_8B] = {
      93                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_PARENT,
      94                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
      95                 :            :                 .slices          = 16,
      96                 :            :         },
      97                 :            :         [TF_DIR_RX][TF_TBL_TYPE_ACT_ENCAP_16B] = {
      98                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
      99                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
     100                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     101                 :            :                 .slices          = 8,
     102                 :            :         },
     103                 :            :         [TF_DIR_RX][TF_TBL_TYPE_ACT_ENCAP_32B] = {
     104                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     105                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
     106                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     107                 :            :                 .slices          = 4,
     108                 :            :         },
     109                 :            :         [TF_DIR_RX][TF_TBL_TYPE_ACT_ENCAP_64B] = {
     110                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     111                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
     112                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     113                 :            :                 .slices          = 2,
     114                 :            :         },
     115                 :            :         [TF_DIR_RX][TF_TBL_TYPE_ACT_ENCAP_128B] = {
     116                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     117                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
     118                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     119                 :            :                 .slices          = 1,
     120                 :            :         },
     121                 :            :         /* Policy - Modify in bank 2 with Encaps */
     122                 :            :         [TF_DIR_RX][TF_TBL_TYPE_ACT_MODIFY_8B] = {
     123                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     124                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
     125                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     126                 :            :                 .slices          = 16,
     127                 :            :         },
     128                 :            :         [TF_DIR_RX][TF_TBL_TYPE_ACT_MODIFY_16B] = {
     129                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     130                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
     131                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     132                 :            :                 .slices          = 8,
     133                 :            :         },
     134                 :            :         [TF_DIR_RX][TF_TBL_TYPE_ACT_MODIFY_32B] = {
     135                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     136                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
     137                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     138                 :            :                 .slices          = 4,
     139                 :            :         },
     140                 :            :         [TF_DIR_RX][TF_TBL_TYPE_ACT_MODIFY_64B] = {
     141                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     142                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
     143                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     144                 :            :                 .slices          = 2,
     145                 :            :         },
     146                 :            :         /* Policy - SP in bank 0 */
     147                 :            :         [TF_DIR_RX][TF_TBL_TYPE_ACT_SP_SMAC] = {
     148                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_PARENT,
     149                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_0,
     150                 :            :                 .slices          = 16,
     151                 :            :         },
     152                 :            :         [TF_DIR_RX][TF_TBL_TYPE_ACT_SP_SMAC_IPV4] = {
     153                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     154                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_SP_SMAC,
     155                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_0,
     156                 :            :                 .slices          = 8,
     157                 :            :         },
     158                 :            :         [TF_DIR_RX][TF_TBL_TYPE_ACT_SP_SMAC_IPV6] = {
     159                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     160                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_SP_SMAC,
     161                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_0,
     162                 :            :                 .slices          = 4,
     163                 :            :         },
     164                 :            :         /* Policy - Stats in bank 3 */
     165                 :            :         [TF_DIR_RX][TF_TBL_TYPE_ACT_STATS_64] = {
     166                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_PARENT,
     167                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_3,
     168                 :            :                 .slices          = 16,
     169                 :            :         },
     170                 :            :         [TF_DIR_TX][TF_TBL_TYPE_EM_FKB] = {
     171                 :            :                 TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_EM_FKB,
     172                 :            :                 0, 0
     173                 :            :         },
     174                 :            :         [TF_DIR_TX][TF_TBL_TYPE_WC_FKB] = {
     175                 :            :                 TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_WC_FKB,
     176                 :            :                 0, 0
     177                 :            :         },
     178                 :            :         [TF_DIR_TX][TF_TBL_TYPE_METER_PROF] = {
     179                 :            :                 TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METER_PROF,
     180                 :            :                 0, 0
     181                 :            :         },
     182                 :            :         [TF_DIR_TX][TF_TBL_TYPE_METER_INST] = {
     183                 :            :                 TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METER,
     184                 :            :                 0, 0
     185                 :            :         },
     186                 :            :         [TF_DIR_TX][TF_TBL_TYPE_METER_DROP_CNT] = {
     187                 :            :                 TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METER_DROP_CNT,
     188                 :            :                 0, 0
     189                 :            :         },
     190                 :            :         [TF_DIR_TX][TF_TBL_TYPE_MIRROR_CONFIG] = {
     191                 :            :                 TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_MIRROR,
     192                 :            :                 0, 0
     193                 :            :         },
     194                 :            :         [TF_DIR_TX][TF_TBL_TYPE_METADATA] = {
     195                 :            :                 TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METADATA,
     196                 :            :                 0, 0
     197                 :            :         },
     198                 :            :         /* Policy - ARs in bank 1 */
     199                 :            :         [TF_DIR_TX][TF_TBL_TYPE_FULL_ACT_RECORD] = {
     200                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_PARENT,
     201                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_1,
     202                 :            :                 .slices          = 8,
     203                 :            :         },
     204                 :            :         [TF_DIR_TX][TF_TBL_TYPE_COMPACT_ACT_RECORD] = {
     205                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     206                 :            :                 .parent_subtype  = TF_TBL_TYPE_FULL_ACT_RECORD,
     207                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_1,
     208                 :            :                 .slices          = 16,
     209                 :            :         },
     210                 :            :         /* Policy - Encaps in bank 2 */
     211                 :            :         [TF_DIR_TX][TF_TBL_TYPE_ACT_ENCAP_8B] = {
     212                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_PARENT,
     213                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     214                 :            :                 .slices          = 16,
     215                 :            :         },
     216                 :            :         [TF_DIR_TX][TF_TBL_TYPE_ACT_ENCAP_16B] = {
     217                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     218                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
     219                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     220                 :            :                 .slices          = 8,
     221                 :            :         },
     222                 :            :         [TF_DIR_TX][TF_TBL_TYPE_ACT_ENCAP_32B] = {
     223                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     224                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
     225                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     226                 :            :                 .slices          = 4,
     227                 :            :         },
     228                 :            :         [TF_DIR_TX][TF_TBL_TYPE_ACT_ENCAP_64B] = {
     229                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     230                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
     231                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     232                 :            :                 .slices          = 2,
     233                 :            :         },
     234                 :            :         [TF_DIR_TX][TF_TBL_TYPE_ACT_ENCAP_128B] = {
     235                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     236                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
     237                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     238                 :            :                 .slices          = 1,
     239                 :            :         },
     240                 :            :         /* Policy - Modify in bank 2 with Encaps */
     241                 :            :         [TF_DIR_TX][TF_TBL_TYPE_ACT_MODIFY_8B] = {
     242                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     243                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
     244                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     245                 :            :                 .slices          = 16,
     246                 :            :         },
     247                 :            :         [TF_DIR_TX][TF_TBL_TYPE_ACT_MODIFY_16B] = {
     248                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     249                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
     250                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     251                 :            :                 .slices          = 8,
     252                 :            :         },
     253                 :            :         [TF_DIR_TX][TF_TBL_TYPE_ACT_MODIFY_32B] = {
     254                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     255                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
     256                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     257                 :            :                 .slices          = 4,
     258                 :            :         },
     259                 :            :         [TF_DIR_TX][TF_TBL_TYPE_ACT_MODIFY_64B] = {
     260                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     261                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
     262                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     263                 :            :                 .slices          = 2,
     264                 :            :         },
     265                 :            :         /* Policy - SP in bank 0 */
     266                 :            :         [TF_DIR_TX][TF_TBL_TYPE_ACT_SP_SMAC] = {
     267                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_PARENT,
     268                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_0,
     269                 :            :                 .slices          = 16,
     270                 :            :         },
     271                 :            :         [TF_DIR_TX][TF_TBL_TYPE_ACT_SP_SMAC_IPV4] = {
     272                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     273                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_SP_SMAC,
     274                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_0,
     275                 :            :                 .slices          = 8,
     276                 :            :         },
     277                 :            :         [TF_DIR_TX][TF_TBL_TYPE_ACT_SP_SMAC_IPV6] = {
     278                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
     279                 :            :                 .parent_subtype  = TF_TBL_TYPE_ACT_SP_SMAC,
     280                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_0,
     281                 :            :                 .slices          = 4,
     282                 :            :         },
     283                 :            :         /* Policy - Stats in bank 3 */
     284                 :            :         [TF_DIR_TX][TF_TBL_TYPE_ACT_STATS_64] = {
     285                 :            :                 .cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_PARENT,
     286                 :            :                 .hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_3,
     287                 :            :                 .slices          = 16,
     288                 :            :         },
     289                 :            : };
     290                 :            : 
     291                 :            : /**
     292                 :            :  * Device specific function that retrieves the MAX number of HCAPI
     293                 :            :  * types the device supports.
     294                 :            :  *
     295                 :            :  * [in] tfp
     296                 :            :  *   Pointer to TF handle
     297                 :            :  *
     298                 :            :  * [out] max_types
     299                 :            :  *   Pointer to the MAX number of HCAPI types supported
     300                 :            :  *
     301                 :            :  * Returns
     302                 :            :  *   - (0) if successful.
     303                 :            :  *   - (-EINVAL) on failure.
     304                 :            :  */
     305                 :            : static int
     306                 :          0 : tf_dev_p58_get_max_types(struct tf *tfp,
     307                 :            :                          uint16_t *max_types)
     308                 :            : {
     309         [ #  # ]:          0 :         if (max_types == NULL || tfp == NULL)
     310                 :            :                 return -EINVAL;
     311                 :            : 
     312                 :          0 :         *max_types = CFA_RESOURCE_TYPE_P58_LAST + 1;
     313                 :            : 
     314                 :          0 :         return 0;
     315                 :            : }
     316                 :            : /**
     317                 :            :  * Device specific function that retrieves a human readable
     318                 :            :  * string to identify a CFA resource type.
     319                 :            :  *
     320                 :            :  * [in] tfp
     321                 :            :  *   Pointer to TF handle
     322                 :            :  *
     323                 :            :  * [in] resource_id
     324                 :            :  *   HCAPI CFA resource id
     325                 :            :  *
     326                 :            :  * [out] resource_str
     327                 :            :  *   Resource string
     328                 :            :  *
     329                 :            :  * Returns
     330                 :            :  *   - (0) if successful.
     331                 :            :  *   - (-EINVAL) on failure.
     332                 :            :  */
     333                 :            : static int
     334                 :          0 : tf_dev_p58_get_resource_str(struct tf *tfp __rte_unused,
     335                 :            :                             uint16_t resource_id,
     336                 :            :                             const char **resource_str)
     337                 :            : {
     338         [ #  # ]:          0 :         if (resource_str == NULL)
     339                 :            :                 return -EINVAL;
     340                 :            : 
     341         [ #  # ]:          0 :         if (resource_id > CFA_RESOURCE_TYPE_P58_LAST)
     342                 :            :                 return -EINVAL;
     343                 :            : 
     344                 :          0 :         *resource_str = tf_resource_str_p58[resource_id];
     345                 :            : 
     346                 :          0 :         return 0;
     347                 :            : }
     348                 :            : 
     349                 :            : /**
     350                 :            :  * Device specific function that set the WC TCAM slices the
     351                 :            :  * device supports.
     352                 :            :  *
     353                 :            :  * [in] tfp
     354                 :            :  *   Pointer to TF handle
     355                 :            :  *
     356                 :            :  * [in] num_slices_per_row
     357                 :            :  *   The WC TCAM row slice configuration
     358                 :            :  *
     359                 :            :  * Returns
     360                 :            :  *   - (0) if successful.
     361                 :            :  *   - (-EINVAL) on failure.
     362                 :            :  */
     363                 :            : static int
     364                 :          0 : tf_dev_p58_set_tcam_slice_info(struct tf *tfp,
     365                 :            :                                enum tf_wc_num_slice num_slices_per_row)
     366                 :            : {
     367                 :            :         int rc;
     368                 :          0 :         struct tf_session *tfs = NULL;
     369                 :            : 
     370                 :            :         /* Retrieve the session information */
     371                 :          0 :         rc = tf_session_get_session_internal(tfp, &tfs);
     372         [ #  # ]:          0 :         if (rc)
     373                 :            :                 return rc;
     374                 :            : 
     375         [ #  # ]:          0 :         switch (num_slices_per_row) {
     376                 :          0 :         case TF_WC_TCAM_1_SLICE_PER_ROW:
     377                 :            :         case TF_WC_TCAM_2_SLICE_PER_ROW:
     378                 :            :         case TF_WC_TCAM_4_SLICE_PER_ROW:
     379                 :          0 :                 tfs->wc_num_slices_per_row = num_slices_per_row;
     380                 :            :         break;
     381                 :            :         default:
     382                 :            :                 return -EINVAL;
     383                 :            :         }
     384                 :            : 
     385                 :          0 :         return 0;
     386                 :            : }
     387                 :            : 
     388                 :            : /**
     389                 :            :  * Device specific function that retrieves the TCAM slices the
     390                 :            :  * device supports.
     391                 :            :  *
     392                 :            :  * [in] tfp
     393                 :            :  *   Pointer to TF handle
     394                 :            :  *
     395                 :            :  * [in] type
     396                 :            :  *   TF TCAM type
     397                 :            :  *
     398                 :            :  * [in] key_sz
     399                 :            :  *   The key size
     400                 :            :  *
     401                 :            :  * [out] num_slices_per_row
     402                 :            :  *   Pointer to the WC TCAM row slice configuration
     403                 :            :  *
     404                 :            :  * Returns
     405                 :            :  *   - (0) if successful.
     406                 :            :  *   - (-EINVAL) on failure.
     407                 :            :  */
     408                 :            : static int
     409                 :          0 : tf_dev_p58_get_tcam_slice_info(struct tf *tfp,
     410                 :            :                                enum tf_tcam_tbl_type type,
     411                 :            :                                uint16_t key_sz,
     412                 :            :                                uint16_t *num_slices_per_row)
     413                 :            : {
     414                 :            :         int rc;
     415                 :          0 :         struct tf_session *tfs = NULL;
     416                 :            : 
     417                 :            :         /* Retrieve the session information */
     418                 :          0 :         rc = tf_session_get_session_internal(tfp, &tfs);
     419         [ #  # ]:          0 :         if (rc)
     420                 :            :                 return rc;
     421                 :            : 
     422                 :            : #define CFA_P58_WC_TCAM_SLICE_SIZE (24)
     423         [ #  # ]:          0 :         if (type == TF_TCAM_TBL_TYPE_WC_TCAM) {
     424         [ #  # ]:          0 :                 if (key_sz <= 1 * CFA_P58_WC_TCAM_SLICE_SIZE)
     425                 :          0 :                         *num_slices_per_row = TF_WC_TCAM_1_SLICE_PER_ROW;
     426         [ #  # ]:          0 :                 else if (key_sz <= 2 * CFA_P58_WC_TCAM_SLICE_SIZE)
     427                 :          0 :                         *num_slices_per_row = TF_WC_TCAM_2_SLICE_PER_ROW;
     428         [ #  # ]:          0 :                 else if (key_sz <= 4 * CFA_P58_WC_TCAM_SLICE_SIZE)
     429                 :          0 :                         *num_slices_per_row = TF_WC_TCAM_4_SLICE_PER_ROW;
     430                 :            :                 else
     431                 :            :                         return -ENOTSUP;
     432                 :            :         } else { /* for other type of tcam */
     433                 :          0 :                 *num_slices_per_row = 1;
     434                 :            :         }
     435                 :            : 
     436                 :            :         return 0;
     437                 :            : }
     438                 :            : 
     439                 :          0 : static int tf_dev_p58_get_mailbox(void)
     440                 :            : {
     441                 :          0 :         return TF_CHIMP_MB;
     442                 :            : }
     443                 :            : 
     444                 :          0 : static int tf_dev_p58_word_align(uint16_t size)
     445                 :            : {
     446                 :          0 :         return ((((size) + 63) >> 6) * 8);
     447                 :            : }
     448                 :            : 
     449                 :            : /**
     450                 :            :  * Device specific function that retrieves the increment
     451                 :            :  * required for certain table types in a shared session
     452                 :            :  *
     453                 :            :  * [in] tfp
     454                 :            :  * tf handle
     455                 :            :  *
     456                 :            :  * [in/out] parms
     457                 :            :  *   pointer to parms structure
     458                 :            :  *
     459                 :            :  * Returns
     460                 :            :  *   - (0) if successful.
     461                 :            :  *   - (-EINVAL) on failure.
     462                 :            :  */
     463                 :          0 : static int tf_dev_p58_get_shared_tbl_increment(struct tf *tfp __rte_unused,
     464                 :            :                                 struct tf_get_shared_tbl_increment_parms *parms)
     465                 :            : {
     466         [ #  # ]:          0 :         switch (parms->type) {
     467                 :          0 :         case TF_TBL_TYPE_FULL_ACT_RECORD:
     468                 :            :         case TF_TBL_TYPE_COMPACT_ACT_RECORD:
     469                 :            :         case TF_TBL_TYPE_ACT_ENCAP_8B:
     470                 :            :         case TF_TBL_TYPE_ACT_ENCAP_16B:
     471                 :            :         case TF_TBL_TYPE_ACT_ENCAP_32B:
     472                 :            :         case TF_TBL_TYPE_ACT_ENCAP_64B:
     473                 :            :         case TF_TBL_TYPE_ACT_ENCAP_128B:
     474                 :            :         case TF_TBL_TYPE_ACT_SP_SMAC:
     475                 :            :         case TF_TBL_TYPE_ACT_SP_SMAC_IPV4:
     476                 :            :         case TF_TBL_TYPE_ACT_SP_SMAC_IPV6:
     477                 :            :         case TF_TBL_TYPE_ACT_STATS_64:
     478                 :            :         case TF_TBL_TYPE_ACT_MODIFY_IPV4:
     479                 :            :         case TF_TBL_TYPE_ACT_MODIFY_8B:
     480                 :            :         case TF_TBL_TYPE_ACT_MODIFY_16B:
     481                 :            :         case TF_TBL_TYPE_ACT_MODIFY_32B:
     482                 :            :         case TF_TBL_TYPE_ACT_MODIFY_64B:
     483                 :          0 :                 parms->increment_cnt = 16;
     484                 :          0 :                 break;
     485                 :          0 :         default:
     486                 :          0 :                 parms->increment_cnt = 1;
     487                 :          0 :                 break;
     488                 :            :         }
     489                 :          0 :         return 0;
     490                 :            : }
     491                 :            : 
     492                 :            : /**
     493                 :            :  * Indicates whether the index table type is SRAM managed
     494                 :            :  *
     495                 :            :  * [in] tfp
     496                 :            :  *   Pointer to TF handle
     497                 :            :  *
     498                 :            :  * [in] type
     499                 :            :  *   Truflow index table type, e.g. TF_TYPE_FULL_ACT_RECORD
     500                 :            :  *
     501                 :            :  * Returns
     502                 :            :  *   - (0) if the table is not managed by the SRAM manager
     503                 :            :  *   - (1) if the table is managed by the SRAM manager
     504                 :            :  */
     505                 :          0 : static bool tf_dev_p58_is_sram_managed(struct tf *tfp __rte_unused,
     506                 :            :                                        enum tf_tbl_type type)
     507                 :            : {
     508         [ #  # ]:          0 :         switch (type) {
     509                 :            :         case TF_TBL_TYPE_FULL_ACT_RECORD:
     510                 :            :         case TF_TBL_TYPE_COMPACT_ACT_RECORD:
     511                 :            :         case TF_TBL_TYPE_ACT_ENCAP_8B:
     512                 :            :         case TF_TBL_TYPE_ACT_ENCAP_16B:
     513                 :            :         case TF_TBL_TYPE_ACT_ENCAP_32B:
     514                 :            :         case TF_TBL_TYPE_ACT_ENCAP_64B:
     515                 :            :         case TF_TBL_TYPE_ACT_ENCAP_128B:
     516                 :            :         case TF_TBL_TYPE_ACT_SP_SMAC:
     517                 :            :         case TF_TBL_TYPE_ACT_SP_SMAC_IPV4:
     518                 :            :         case TF_TBL_TYPE_ACT_SP_SMAC_IPV6:
     519                 :            :         case TF_TBL_TYPE_ACT_STATS_64:
     520                 :            :         case TF_TBL_TYPE_ACT_MODIFY_IPV4:
     521                 :            :         case TF_TBL_TYPE_ACT_MODIFY_8B:
     522                 :            :         case TF_TBL_TYPE_ACT_MODIFY_16B:
     523                 :            :         case TF_TBL_TYPE_ACT_MODIFY_32B:
     524                 :            :         case TF_TBL_TYPE_ACT_MODIFY_64B:
     525                 :            :                 return true;
     526                 :          0 :         default:
     527                 :          0 :                 return false;
     528                 :            :         }
     529                 :            : }
     530                 :            : 
     531                 :            : #define TF_DEV_P58_BANK_SZ_64B 2048
     532                 :            : /**
     533                 :            :  * Get SRAM table information.
     534                 :            :  *
     535                 :            :  * Converts an internal RM allocated element offset to
     536                 :            :  * a user address and vice versa.
     537                 :            :  *
     538                 :            :  * [in] tfp
     539                 :            :  *   Pointer to TF handle
     540                 :            :  *
     541                 :            :  * [in] type
     542                 :            :  *   Truflow index table type, e.g. TF_TYPE_FULL_ACT_RECORD
     543                 :            :  *
     544                 :            :  * [in/out] base
     545                 :            :  *   Pointer to the Base address of the associated SRAM bank used for
     546                 :            :  *   the type of record allocated.
     547                 :            :  *
     548                 :            :  * [in/out] shift
     549                 :            :  *   Pointer to the factor to be used as a multiplier to translate
     550                 :            :  *   between the RM units to the user address.  SRAM manages 128B entries
     551                 :            :  *   Addresses must be shifted to an 8B address.
     552                 :            :  *
     553                 :            :  * Returns
     554                 :            :  *   - (0) if successful.
     555                 :            :  *   - (-EINVAL) on failure.
     556                 :            :  */
     557                 :          0 : static int tf_dev_p58_get_sram_tbl_info(struct tf *tfp __rte_unused,
     558                 :            :                                         void *db,
     559                 :            :                                         enum tf_tbl_type type,
     560                 :            :                                         uint16_t *base,
     561                 :            :                                         uint16_t *shift)
     562                 :            : {
     563                 :            :         uint16_t hcapi_type;
     564                 :            :         struct tf_rm_get_hcapi_parms parms;
     565                 :            :         int rc;
     566                 :            : 
     567                 :          0 :         parms.rm_db = db;
     568                 :          0 :         parms.subtype = type;
     569                 :          0 :         parms.hcapi_type = &hcapi_type;
     570                 :            : 
     571                 :          0 :         rc = tf_rm_get_hcapi_type(&parms);
     572         [ #  # ]:          0 :         if (rc) {
     573                 :          0 :                 *base = 0;
     574                 :          0 :                 *shift = 0;
     575                 :          0 :                 return 0;
     576                 :            :         }
     577                 :            : 
     578   [ #  #  #  #  :          0 :         switch (hcapi_type) {
                      # ]
     579                 :          0 :         case CFA_RESOURCE_TYPE_P58_SRAM_BANK_0:
     580                 :          0 :                 *base = 0;
     581                 :          0 :                 *shift = 3;
     582                 :          0 :                 break;
     583                 :          0 :         case CFA_RESOURCE_TYPE_P58_SRAM_BANK_1:
     584                 :          0 :                 *base = TF_DEV_P58_BANK_SZ_64B;
     585                 :          0 :                 *shift = 3;
     586                 :          0 :                 break;
     587                 :          0 :         case CFA_RESOURCE_TYPE_P58_SRAM_BANK_2:
     588                 :          0 :                 *base = TF_DEV_P58_BANK_SZ_64B * 2;
     589                 :          0 :                 *shift = 3;
     590                 :          0 :                 break;
     591                 :          0 :         case CFA_RESOURCE_TYPE_P58_SRAM_BANK_3:
     592                 :          0 :                 *base = TF_DEV_P58_BANK_SZ_64B * 3;
     593                 :          0 :                 *shift = 3;
     594                 :          0 :                 break;
     595                 :          0 :         default:
     596                 :          0 :                 *base = 0;
     597                 :          0 :                 *shift = 0;
     598                 :          0 :                 break;
     599                 :            :         }
     600                 :            :         return 0;
     601                 :            : }
     602                 :            : 
     603                 :            : /**
     604                 :            :  * Device specific function that maps the hcapi resource types
     605                 :            :  * to Truflow type.
     606                 :            :  *
     607                 :            :  * [in] hcapi_caps
     608                 :            :  *   CFA resource type bitmap
     609                 :            :  *
     610                 :            :  * [out] ident_caps
     611                 :            :  *   Pointer to identifier type bitmap
     612                 :            :  *
     613                 :            :  * [out] tcam_caps
     614                 :            :  *   Pointer to tcam type bitmap
     615                 :            :  *
     616                 :            :  * [out] tbl_caps
     617                 :            :  *   Pointer to table type bitmap
     618                 :            :  *
     619                 :            :  * [out] em_caps
     620                 :            :  *   Pointer to em type bitmap
     621                 :            :  *
     622                 :            :  * Returns
     623                 :            :  *   - (0) if successful.
     624                 :            :  *   - (-EINVAL) on failure.
     625                 :            :  */
     626                 :          0 : static int tf_dev_p58_map_hcapi_caps(uint64_t hcapi_caps,
     627                 :            :                                      uint32_t *ident_caps,
     628                 :            :                                      uint32_t *tcam_caps,
     629                 :            :                                      uint32_t *tbl_caps,
     630                 :            :                                      uint32_t *em_caps)
     631                 :            : {
     632                 :            :         uint32_t i;
     633                 :            : 
     634                 :          0 :         *ident_caps = 0;
     635                 :          0 :         *tcam_caps = 0;
     636                 :          0 :         *tbl_caps = 0;
     637                 :          0 :         *em_caps = 0;
     638                 :            : 
     639         [ #  # ]:          0 :         for (i = 0; i <= CFA_RESOURCE_TYPE_P58_LAST; i++) {
     640         [ #  # ]:          0 :                 if (hcapi_caps & 1ULL << i) {
     641   [ #  #  #  #  :          0 :                         switch (tf_hcapi_res_map_p58[i].module_type) {
                      # ]
     642                 :          0 :                         case TF_MODULE_TYPE_IDENTIFIER:
     643                 :          0 :                                 *ident_caps |= tf_hcapi_res_map_p58[i].type_caps;
     644                 :          0 :                                 break;
     645                 :          0 :                         case TF_MODULE_TYPE_TABLE:
     646                 :          0 :                                 *tbl_caps |= tf_hcapi_res_map_p58[i].type_caps;
     647                 :          0 :                                 break;
     648                 :          0 :                         case TF_MODULE_TYPE_TCAM:
     649                 :          0 :                                 *tcam_caps |= tf_hcapi_res_map_p58[i].type_caps;
     650                 :          0 :                                 break;
     651                 :          0 :                         case TF_MODULE_TYPE_EM:
     652                 :          0 :                                 *em_caps |= tf_hcapi_res_map_p58[i].type_caps;
     653                 :          0 :                                 break;
     654                 :            :                         default:
     655                 :            :                                 return -EINVAL;
     656                 :            :                         }
     657                 :            :                 }
     658                 :            :         }
     659                 :            : 
     660                 :            :         return 0;
     661                 :            : }
     662                 :            : 
     663                 :            : /**
     664                 :            :  * Device specific function that retrieve the sram resource
     665                 :            :  *
     666                 :            :  * [in] query
     667                 :            :  *   Point to resources query result
     668                 :            :  *
     669                 :            :  * [out] sram_bank_caps
     670                 :            :  *   Pointer to SRAM bank capabilities
     671                 :            :  *
     672                 :            :  * [out] dynamic_sram_capable
     673                 :            :  *   Pointer to dynamic sram capable
     674                 :            :  *
     675                 :            :  * Returns
     676                 :            :  *   - (0) if successful.
     677                 :            :  *   - (-EINVAL) on failure.
     678                 :            :  */
     679                 :          0 : static int tf_dev_p58_get_sram_resources(void *q,
     680                 :            :                                          uint32_t *sram_bank_caps,
     681                 :            :                                          bool *dynamic_sram_capable)
     682                 :            : {
     683                 :            :         uint32_t i;
     684                 :            :         struct tf_rm_resc_req_entry *query = q;
     685                 :            : 
     686         [ #  # ]:          0 :         for (i = 0; i < CFA_RESOURCE_TYPE_P58_LAST + 1; i++) {
     687   [ #  #  #  #  :          0 :                 switch (query[i].type) {
                      # ]
     688                 :          0 :                 case CFA_RESOURCE_TYPE_P58_SRAM_BANK_0:
     689                 :          0 :                         sram_bank_caps[0] = query[i].max;
     690                 :          0 :                         break;
     691                 :          0 :                 case CFA_RESOURCE_TYPE_P58_SRAM_BANK_1:
     692                 :          0 :                         sram_bank_caps[1] = query[i].max;
     693                 :          0 :                         break;
     694                 :          0 :                 case CFA_RESOURCE_TYPE_P58_SRAM_BANK_2:
     695                 :          0 :                         sram_bank_caps[2] = query[i].max;
     696                 :          0 :                         break;
     697                 :          0 :                 case CFA_RESOURCE_TYPE_P58_SRAM_BANK_3:
     698                 :          0 :                         sram_bank_caps[3] = query[i].max;
     699                 :          0 :                         break;
     700                 :            :                 default:
     701                 :            :                         break;
     702                 :            :                 }
     703                 :            :         }
     704                 :            : 
     705                 :          0 :         *dynamic_sram_capable = false;
     706                 :            : 
     707                 :          0 :         return 0;
     708                 :            : }
     709                 :            : 
     710                 :            : static int sram_bank_hcapi_type[] = {
     711                 :            :         CFA_RESOURCE_TYPE_P58_SRAM_BANK_0,
     712                 :            :         CFA_RESOURCE_TYPE_P58_SRAM_BANK_1,
     713                 :            :         CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
     714                 :            :         CFA_RESOURCE_TYPE_P58_SRAM_BANK_3
     715                 :            : };
     716                 :            : 
     717                 :            : /**
     718                 :            :  * Device specific function that set the sram policy
     719                 :            :  *
     720                 :            :  * [in] dir
     721                 :            :  *   Receive or transmit direction
     722                 :            :  *
     723                 :            :  * [in] band_id
     724                 :            :  *   SRAM bank id
     725                 :            :  *
     726                 :            :  * Returns
     727                 :            :  *   - (0) if successful.
     728                 :            :  *   - (-EINVAL) on failure.
     729                 :            :  */
     730                 :          0 : static int tf_dev_p58_set_sram_policy(enum tf_dir dir,
     731                 :            :                                       enum tf_sram_bank_id *bank_id)
     732                 :            : {
     733                 :          0 :         struct tf_rm_element_cfg *rm_cfg = tf_tbl_p58[dir];
     734                 :            :         uint8_t type;
     735                 :          0 :         uint8_t parent[TF_SRAM_BANK_ID_MAX] = { 0xFF, 0xFF, 0xFF, 0xFF };
     736                 :            : 
     737                 :          0 :         for (type = TF_TBL_TYPE_FULL_ACT_RECORD;
     738         [ #  # ]:          0 :                         type <= TF_TBL_TYPE_ACT_MODIFY_64B; type++) {
     739         [ #  # ]:          0 :                 if (bank_id[type] >= TF_SRAM_BANK_ID_MAX)
     740                 :            :                         return -EINVAL;
     741                 :            : 
     742                 :          0 :                 rm_cfg[type].hcapi_type = sram_bank_hcapi_type[bank_id[type]];
     743         [ #  # ]:          0 :                 if (parent[bank_id[type]] == 0xFF) {
     744                 :          0 :                         parent[bank_id[type]] = type;
     745                 :          0 :                         rm_cfg[type].cfg_type = TF_RM_ELEM_CFG_HCAPI_BA_PARENT;
     746                 :          0 :                         rm_cfg[type].parent_subtype = 0;
     747         [ #  # ]:          0 :                         if (rm_cfg[type].slices == 0)
     748                 :          0 :                                 rm_cfg[type].slices = 1;
     749                 :            :                 } else {
     750                 :          0 :                         rm_cfg[type].cfg_type = TF_RM_ELEM_CFG_HCAPI_BA_CHILD;
     751                 :          0 :                         rm_cfg[type].parent_subtype = parent[bank_id[type]];
     752                 :            :                 }
     753                 :            :         }
     754                 :            : 
     755                 :            :         return 0;
     756                 :            : }
     757                 :            : 
     758                 :            : /**
     759                 :            :  * Device specific function that get the sram policy
     760                 :            :  *
     761                 :            :  * [in] dir
     762                 :            :  *   Receive or transmit direction
     763                 :            :  *
     764                 :            :  * [out] band_id
     765                 :            :  *   pointer to SRAM bank id
     766                 :            :  *
     767                 :            :  * Returns
     768                 :            :  *   - (0) if successful.
     769                 :            :  *   - (-EINVAL) on failure.
     770                 :            :  */
     771                 :          0 : static int tf_dev_p58_get_sram_policy(enum tf_dir dir,
     772                 :            :                                       enum tf_sram_bank_id *bank_id)
     773                 :            : {
     774                 :          0 :         struct tf_rm_element_cfg *rm_cfg = tf_tbl_p58[dir];
     775                 :            :         uint8_t type;
     776                 :            : 
     777                 :          0 :         for (type = TF_TBL_TYPE_FULL_ACT_RECORD;
     778         [ #  # ]:          0 :                         type < TF_TBL_TYPE_ACT_MODIFY_64B + 1; type++)
     779                 :          0 :                 bank_id[type] = rm_cfg[type].hcapi_type - CFA_RESOURCE_TYPE_P58_SRAM_BANK_0;
     780                 :            : 
     781                 :          0 :         return 0;
     782                 :            : }
     783                 :            : 
     784                 :            : /**
     785                 :            :  * Truflow P58 device specific functions
     786                 :            :  */
     787                 :            : const struct tf_dev_ops tf_dev_ops_p58_init = {
     788                 :            :         .tf_dev_get_max_types = tf_dev_p58_get_max_types,
     789                 :            :         .tf_dev_get_resource_str = tf_dev_p58_get_resource_str,
     790                 :            :         .tf_dev_set_tcam_slice_info = tf_dev_p58_set_tcam_slice_info,
     791                 :            :         .tf_dev_get_tcam_slice_info = tf_dev_p58_get_tcam_slice_info,
     792                 :            :         .tf_dev_alloc_ident = NULL,
     793                 :            :         .tf_dev_free_ident = NULL,
     794                 :            :         .tf_dev_search_ident = NULL,
     795                 :            :         .tf_dev_get_ident_resc_info = NULL,
     796                 :            :         .tf_dev_get_tbl_info = NULL,
     797                 :            :         .tf_dev_is_sram_managed = tf_dev_p58_is_sram_managed,
     798                 :            :         .tf_dev_alloc_ext_tbl = NULL,
     799                 :            :         .tf_dev_alloc_tbl = NULL,
     800                 :            :         .tf_dev_alloc_sram_tbl = NULL,
     801                 :            :         .tf_dev_free_ext_tbl = NULL,
     802                 :            :         .tf_dev_free_tbl = NULL,
     803                 :            :         .tf_dev_free_sram_tbl = NULL,
     804                 :            :         .tf_dev_set_tbl = NULL,
     805                 :            :         .tf_dev_set_ext_tbl = NULL,
     806                 :            :         .tf_dev_set_sram_tbl = NULL,
     807                 :            :         .tf_dev_get_tbl = NULL,
     808                 :            :         .tf_dev_get_sram_tbl = NULL,
     809                 :            :         .tf_dev_get_bulk_tbl = NULL,
     810                 :            :         .tf_dev_get_bulk_sram_tbl = NULL,
     811                 :            :         .tf_dev_get_shared_tbl_increment = tf_dev_p58_get_shared_tbl_increment,
     812                 :            :         .tf_dev_get_tbl_resc_info = NULL,
     813                 :            :         .tf_dev_alloc_tcam = NULL,
     814                 :            :         .tf_dev_free_tcam = NULL,
     815                 :            :         .tf_dev_alloc_search_tcam = NULL,
     816                 :            :         .tf_dev_set_tcam = NULL,
     817                 :            :         .tf_dev_get_tcam = NULL,
     818                 :            :         .tf_dev_get_tcam_resc_info = NULL,
     819                 :            :         .tf_dev_insert_int_em_entry = NULL,
     820                 :            :         .tf_dev_delete_int_em_entry = NULL,
     821                 :            :         .tf_dev_insert_ext_em_entry = NULL,
     822                 :            :         .tf_dev_delete_ext_em_entry = NULL,
     823                 :            :         .tf_dev_get_em_resc_info = NULL,
     824                 :            :         .tf_dev_alloc_tbl_scope = NULL,
     825                 :            :         .tf_dev_map_tbl_scope = NULL,
     826                 :            :         .tf_dev_map_parif = NULL,
     827                 :            :         .tf_dev_free_tbl_scope = NULL,
     828                 :            :         .tf_dev_set_if_tbl = NULL,
     829                 :            :         .tf_dev_get_if_tbl = NULL,
     830                 :            :         .tf_dev_set_global_cfg = NULL,
     831                 :            :         .tf_dev_get_global_cfg = NULL,
     832                 :            :         .tf_dev_get_mailbox = tf_dev_p58_get_mailbox,
     833                 :            :         .tf_dev_word_align = NULL,
     834                 :            :         .tf_dev_map_hcapi_caps = tf_dev_p58_map_hcapi_caps,
     835                 :            :         .tf_dev_get_sram_resources = tf_dev_p58_get_sram_resources,
     836                 :            :         .tf_dev_set_sram_policy = tf_dev_p58_set_sram_policy,
     837                 :            :         .tf_dev_get_sram_policy = tf_dev_p58_get_sram_policy,
     838                 :            : };
     839                 :            : 
     840                 :            : /**
     841                 :            :  * Truflow P58 device specific functions
     842                 :            :  */
     843                 :            : const struct tf_dev_ops tf_dev_ops_p58 = {
     844                 :            :         .tf_dev_get_max_types = tf_dev_p58_get_max_types,
     845                 :            :         .tf_dev_get_resource_str = tf_dev_p58_get_resource_str,
     846                 :            :         .tf_dev_set_tcam_slice_info = tf_dev_p58_set_tcam_slice_info,
     847                 :            :         .tf_dev_get_tcam_slice_info = tf_dev_p58_get_tcam_slice_info,
     848                 :            :         .tf_dev_alloc_ident = tf_ident_alloc,
     849                 :            :         .tf_dev_free_ident = tf_ident_free,
     850                 :            :         .tf_dev_search_ident = tf_ident_search,
     851                 :            :         .tf_dev_get_ident_resc_info = tf_ident_get_resc_info,
     852                 :            :         .tf_dev_is_sram_managed = tf_dev_p58_is_sram_managed,
     853                 :            :         .tf_dev_get_tbl_info = tf_dev_p58_get_sram_tbl_info,
     854                 :            :         .tf_dev_alloc_tbl = tf_tbl_alloc,
     855                 :            :         .tf_dev_alloc_sram_tbl = tf_tbl_sram_alloc,
     856                 :            :         .tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc,
     857                 :            :         .tf_dev_free_tbl = tf_tbl_free,
     858                 :            :         .tf_dev_free_ext_tbl = tf_tbl_ext_free,
     859                 :            :         .tf_dev_free_sram_tbl = tf_tbl_sram_free,
     860                 :            :         .tf_dev_set_tbl = tf_tbl_set,
     861                 :            :         .tf_dev_set_ext_tbl = tf_tbl_ext_common_set,
     862                 :            :         .tf_dev_set_sram_tbl = tf_tbl_sram_set,
     863                 :            :         .tf_dev_get_tbl = tf_tbl_get,
     864                 :            :         .tf_dev_get_sram_tbl = tf_tbl_sram_get,
     865                 :            :         .tf_dev_get_bulk_tbl = tf_tbl_bulk_get,
     866                 :            :         .tf_dev_get_bulk_sram_tbl = tf_tbl_sram_bulk_get,
     867                 :            :         .tf_dev_get_shared_tbl_increment = tf_dev_p58_get_shared_tbl_increment,
     868                 :            :         .tf_dev_get_tbl_resc_info = tf_tbl_get_resc_info,
     869                 :            :         .tf_dev_alloc_tcam = tf_tcam_shared_alloc,
     870                 :            :         .tf_dev_free_tcam = tf_tcam_shared_free,
     871                 :            :         .tf_dev_set_tcam = tf_tcam_shared_set,
     872                 :            :         .tf_dev_get_tcam = tf_tcam_shared_get,
     873                 :            :         .tf_dev_move_tcam = tf_tcam_shared_move_p58,
     874                 :            :         .tf_dev_clear_tcam = tf_tcam_shared_clear,
     875                 :            :         .tf_dev_get_tcam_resc_info = tf_tcam_get_resc_info,
     876                 :            :         .tf_dev_insert_int_em_entry = tf_em_hash_insert_int_entry,
     877                 :            :         .tf_dev_delete_int_em_entry = tf_em_hash_delete_int_entry,
     878                 :            :         .tf_dev_move_int_em_entry = tf_em_move_int_entry,
     879                 :            :         .tf_dev_insert_ext_em_entry = NULL,
     880                 :            :         .tf_dev_delete_ext_em_entry = NULL,
     881                 :            :         .tf_dev_get_em_resc_info = tf_em_get_resc_info,
     882                 :            :         .tf_dev_alloc_tbl_scope = NULL,
     883                 :            :         .tf_dev_map_tbl_scope = NULL,
     884                 :            :         .tf_dev_map_parif = NULL,
     885                 :            :         .tf_dev_free_tbl_scope = NULL,
     886                 :            :         .tf_dev_set_if_tbl = tf_if_tbl_set,
     887                 :            :         .tf_dev_get_if_tbl = tf_if_tbl_get,
     888                 :            :         .tf_dev_set_global_cfg = tf_global_cfg_set,
     889                 :            :         .tf_dev_get_global_cfg = tf_global_cfg_get,
     890                 :            :         .tf_dev_get_mailbox = tf_dev_p58_get_mailbox,
     891                 :            :         .tf_dev_word_align = tf_dev_p58_word_align,
     892                 :            :         .tf_dev_cfa_key_hash = hcapi_cfa_p58_key_hash,
     893                 :            :         .tf_dev_map_hcapi_caps = tf_dev_p58_map_hcapi_caps,
     894                 :            :         .tf_dev_get_sram_resources = tf_dev_p58_get_sram_resources,
     895                 :            :         .tf_dev_set_sram_policy = tf_dev_p58_set_sram_policy,
     896                 :            :         .tf_dev_get_sram_policy = tf_dev_p58_get_sram_policy,
     897                 :            : };

Generated by: LCOV version 1.14