18187694bSMichael Wildt /* SPDX-License-Identifier: BSD-3-Clause 2*580fcb3dSRandy Schacher * Copyright(c) 2019-2024 Broadcom 38187694bSMichael Wildt * All rights reserved. 48187694bSMichael Wildt */ 58187694bSMichael Wildt 68187694bSMichael Wildt #ifndef _TF_DEVICE_H_ 78187694bSMichael Wildt #define _TF_DEVICE_H_ 88187694bSMichael Wildt 9588e333eSJay Ding #include "cfa_resource_types.h" 108187694bSMichael Wildt #include "tf_core.h" 118187694bSMichael Wildt #include "tf_identifier.h" 12ced3cdedSMichael Wildt #include "tf_tbl.h" 138187694bSMichael Wildt #include "tf_tcam.h" 1487286092SFarah Smith #include "tf_tcam_shared.h" 15f3502f5cSJay Ding #include "tf_if_tbl.h" 16a11f87d3SJay Ding #include "tf_global_cfg.h" 178187694bSMichael Wildt 188187694bSMichael Wildt struct tf; 198187694bSMichael Wildt struct tf_session; 208187694bSMichael Wildt 218187694bSMichael Wildt /** 228187694bSMichael Wildt * The Device module provides a general device template. A supported 238187694bSMichael Wildt * device type should implement one or more of the listed function 248187694bSMichael Wildt * pointers according to its capabilities. 258187694bSMichael Wildt * 268187694bSMichael Wildt * If a device function pointer is NULL the device capability is not 278187694bSMichael Wildt * supported. 288187694bSMichael Wildt */ 298187694bSMichael Wildt 308187694bSMichael Wildt /** 318187694bSMichael Wildt * TF device information 328187694bSMichael Wildt */ 338187694bSMichael Wildt struct tf_dev_info { 34a46bbb57SMichael Wildt enum tf_device_type type; 358187694bSMichael Wildt const struct tf_dev_ops *ops; 368187694bSMichael Wildt }; 378187694bSMichael Wildt 388187694bSMichael Wildt /** 39588e333eSJay Ding * This structure can be used to translate the CFA resource type to TF type. 40588e333eSJay Ding */ 41588e333eSJay Ding struct tf_hcapi_resource_map { 42588e333eSJay Ding /** 43588e333eSJay Ding * Truflow module type associated with this resource type. 44588e333eSJay Ding */ 45588e333eSJay Ding enum tf_module_type module_type; 46588e333eSJay Ding 47588e333eSJay Ding /** 48588e333eSJay Ding * Bitmap of TF sub-type for the element. 49588e333eSJay Ding */ 50588e333eSJay Ding uint32_t type_caps; 51588e333eSJay Ding }; 52588e333eSJay Ding 53588e333eSJay Ding /** 548187694bSMichael Wildt * @page device Device 558187694bSMichael Wildt * 568187694bSMichael Wildt * @ref tf_dev_bind 578187694bSMichael Wildt * 588187694bSMichael Wildt * @ref tf_dev_unbind 598187694bSMichael Wildt */ 608187694bSMichael Wildt 618187694bSMichael Wildt /** 628187694bSMichael Wildt * Device bind handles the initialization of the specified device 638187694bSMichael Wildt * type. 648187694bSMichael Wildt * 658187694bSMichael Wildt * [in] tfp 668187694bSMichael Wildt * Pointer to TF handle 678187694bSMichael Wildt * 688187694bSMichael Wildt * [in] type 698187694bSMichael Wildt * Device type 708187694bSMichael Wildt * 718187694bSMichael Wildt * [in] resources 728187694bSMichael Wildt * Pointer to resource allocation information 738187694bSMichael Wildt * 7437ff91c1SFarah Smith * [in] wc_num_slices 7537ff91c1SFarah Smith * Number of slices per row for WC 7637ff91c1SFarah Smith * 778187694bSMichael Wildt * [out] dev_handle 788187694bSMichael Wildt * Device handle 798187694bSMichael Wildt * 808187694bSMichael Wildt * Returns 818187694bSMichael Wildt * - (0) if successful. 82a46bbb57SMichael Wildt * - (-EINVAL) parameter failure. 83a46bbb57SMichael Wildt * - (-ENODEV) no such device supported. 848187694bSMichael Wildt */ 85eee264adSMichael Wildt int tf_dev_bind(struct tf *tfp, 868187694bSMichael Wildt enum tf_device_type type, 878187694bSMichael Wildt struct tf_session_resources *resources, 8837ff91c1SFarah Smith uint16_t wc_num_slices, 898187694bSMichael Wildt struct tf_dev_info *dev_handle); 908187694bSMichael Wildt 918187694bSMichael Wildt /** 928187694bSMichael Wildt * Device release handles cleanup of the device specific information. 938187694bSMichael Wildt * 948187694bSMichael Wildt * [in] tfp 958187694bSMichael Wildt * Pointer to TF handle 968187694bSMichael Wildt * 978187694bSMichael Wildt * [in] dev_handle 988187694bSMichael Wildt * Device handle 99a46bbb57SMichael Wildt * 100a46bbb57SMichael Wildt * Returns 101a46bbb57SMichael Wildt * - (0) if successful. 102a46bbb57SMichael Wildt * - (-EINVAL) parameter failure. 103a46bbb57SMichael Wildt * - (-ENODEV) no such device supported. 1048187694bSMichael Wildt */ 105eee264adSMichael Wildt int tf_dev_unbind(struct tf *tfp, 1068187694bSMichael Wildt struct tf_dev_info *dev_handle); 1078187694bSMichael Wildt 1083d3ab7dfSPeter Spreadborough int 1093d3ab7dfSPeter Spreadborough tf_dev_bind_ops(enum tf_device_type type, 1103d3ab7dfSPeter Spreadborough struct tf_dev_info *dev_handle); 1113d3ab7dfSPeter Spreadborough 1128187694bSMichael Wildt /** 1138187694bSMichael Wildt * Truflow device specific function hooks structure 1148187694bSMichael Wildt * 1158187694bSMichael Wildt * The following device hooks can be defined; unless noted otherwise, 1168187694bSMichael Wildt * they are optional and can be filled with a null pointer. The 1178187694bSMichael Wildt * purpose of these hooks is to support Truflow device operations for 1188187694bSMichael Wildt * different device variants. 1198187694bSMichael Wildt */ 1208187694bSMichael Wildt struct tf_dev_ops { 1218187694bSMichael Wildt /** 122a46bbb57SMichael Wildt * Retrieves the MAX number of resource types that the device 123a46bbb57SMichael Wildt * supports. 124a46bbb57SMichael Wildt * 125a46bbb57SMichael Wildt * [in] tfp 126a46bbb57SMichael Wildt * Pointer to TF handle 127a46bbb57SMichael Wildt * 128a46bbb57SMichael Wildt * [out] max_types 129a46bbb57SMichael Wildt * Pointer to MAX number of types the device supports 130a46bbb57SMichael Wildt * 131a46bbb57SMichael Wildt * Returns 132a46bbb57SMichael Wildt * - (0) if successful. 133a46bbb57SMichael Wildt * - (-EINVAL) on failure. 134a46bbb57SMichael Wildt */ 135a46bbb57SMichael Wildt int (*tf_dev_get_max_types)(struct tf *tfp, 136a46bbb57SMichael Wildt uint16_t *max_types); 137a46bbb57SMichael Wildt 138a46bbb57SMichael Wildt /** 1396c9aff87SFarah Smith * Retrieves the string description for the CFA resource 1406c9aff87SFarah Smith * type 1416c9aff87SFarah Smith * 1426c9aff87SFarah Smith * [in] tfp 1436c9aff87SFarah Smith * Pointer to TF handle 1446c9aff87SFarah Smith * 1456c9aff87SFarah Smith * [in] resource_id 1466c9aff87SFarah Smith * HCAPI cfa resource type id 1476c9aff87SFarah Smith * 1486c9aff87SFarah Smith * [out] resource_str 1496c9aff87SFarah Smith * Pointer to a string 1506c9aff87SFarah Smith * 1516c9aff87SFarah Smith * Returns 1526c9aff87SFarah Smith * - (0) if successful. 1536c9aff87SFarah Smith * - (-EINVAL) on failure. 1546c9aff87SFarah Smith */ 1556c9aff87SFarah Smith int (*tf_dev_get_resource_str)(struct tf *tfp, 1566c9aff87SFarah Smith uint16_t resource_id, 1576c9aff87SFarah Smith const char **resource_str); 1586c9aff87SFarah Smith 1596c9aff87SFarah Smith /** 16037ff91c1SFarah Smith * Set the WC TCAM slice information that the device 16137ff91c1SFarah Smith * supports. 16237ff91c1SFarah Smith * 16337ff91c1SFarah Smith * [in] tfp 16437ff91c1SFarah Smith * Pointer to TF handle 16537ff91c1SFarah Smith * 16637ff91c1SFarah Smith * [in] num_slices_per_row 16737ff91c1SFarah Smith * Number of slices per row the device supports 16837ff91c1SFarah Smith * 16937ff91c1SFarah Smith * Returns 17037ff91c1SFarah Smith * - (0) if successful. 17137ff91c1SFarah Smith * - (-EINVAL) on failure. 17237ff91c1SFarah Smith */ 17337ff91c1SFarah Smith int (*tf_dev_set_tcam_slice_info)(struct tf *tfp, 17437ff91c1SFarah Smith enum tf_wc_num_slice num_slices_per_row); 17537ff91c1SFarah Smith 17637ff91c1SFarah Smith /** 177a46bbb57SMichael Wildt * Retrieves the WC TCAM slice information that the device 178a46bbb57SMichael Wildt * supports. 179a46bbb57SMichael Wildt * 180a46bbb57SMichael Wildt * [in] tfp 181a46bbb57SMichael Wildt * Pointer to TF handle 182a46bbb57SMichael Wildt * 1838de01320SJay Ding * [in] type 1848de01320SJay Ding * TCAM table type 1858de01320SJay Ding * 1868de01320SJay Ding * [in] key_sz 1878de01320SJay Ding * Key size 188a46bbb57SMichael Wildt * 189a46bbb57SMichael Wildt * [out] num_slices_per_row 190a46bbb57SMichael Wildt * Pointer to number of slices per row the device supports 191a46bbb57SMichael Wildt * 192a46bbb57SMichael Wildt * Returns 193a46bbb57SMichael Wildt * - (0) if successful. 194a46bbb57SMichael Wildt * - (-EINVAL) on failure. 195a46bbb57SMichael Wildt */ 1968de01320SJay Ding int (*tf_dev_get_tcam_slice_info)(struct tf *tfp, 1978de01320SJay Ding enum tf_tcam_tbl_type type, 1988de01320SJay Ding uint16_t key_sz, 199a46bbb57SMichael Wildt uint16_t *num_slices_per_row); 200a46bbb57SMichael Wildt 201a46bbb57SMichael Wildt /** 2028187694bSMichael Wildt * Allocation of an identifier element. 2038187694bSMichael Wildt * 2048187694bSMichael Wildt * This API allocates the specified identifier element from a 2058187694bSMichael Wildt * device specific identifier DB. The allocated element is 2068187694bSMichael Wildt * returned. 2078187694bSMichael Wildt * 2088187694bSMichael Wildt * [in] tfp 2098187694bSMichael Wildt * Pointer to TF handle 2108187694bSMichael Wildt * 2118187694bSMichael Wildt * [in] parms 2128187694bSMichael Wildt * Pointer to identifier allocation parameters 2138187694bSMichael Wildt * 2148187694bSMichael Wildt * Returns 2158187694bSMichael Wildt * - (0) if successful. 2168187694bSMichael Wildt * - (-EINVAL) on failure. 2178187694bSMichael Wildt */ 2188187694bSMichael Wildt int (*tf_dev_alloc_ident)(struct tf *tfp, 2198187694bSMichael Wildt struct tf_ident_alloc_parms *parms); 2208187694bSMichael Wildt 2218187694bSMichael Wildt /** 2228187694bSMichael Wildt * Free of an identifier element. 2238187694bSMichael Wildt * 2248187694bSMichael Wildt * This API free's a previous allocated identifier element from a 2258187694bSMichael Wildt * device specific identifier DB. 2268187694bSMichael Wildt * 2278187694bSMichael Wildt * [in] tfp 2288187694bSMichael Wildt * Pointer to TF handle 2298187694bSMichael Wildt * 2308187694bSMichael Wildt * [in] parms 2318187694bSMichael Wildt * Pointer to identifier free parameters 2328187694bSMichael Wildt * 2338187694bSMichael Wildt * Returns 2348187694bSMichael Wildt * - (0) if successful. 2358187694bSMichael Wildt * - (-EINVAL) on failure. 2368187694bSMichael Wildt */ 2378187694bSMichael Wildt int (*tf_dev_free_ident)(struct tf *tfp, 2388187694bSMichael Wildt struct tf_ident_free_parms *parms); 2398187694bSMichael Wildt 2408187694bSMichael Wildt /** 2418ee821cfSJay Ding * Search of an identifier element. 2428ee821cfSJay Ding * 2438ee821cfSJay Ding * This API search the specified identifier element from a 2448ee821cfSJay Ding * device specific identifier shadow DB. The allocated element 2458ee821cfSJay Ding * is returned. 2468ee821cfSJay Ding * 2478ee821cfSJay Ding * [in] tfp 2488ee821cfSJay Ding * Pointer to TF handle 2498ee821cfSJay Ding * 2508ee821cfSJay Ding * [in] parms 2518ee821cfSJay Ding * Pointer to identifier search parameters 2528ee821cfSJay Ding * 2538ee821cfSJay Ding * Returns 2548ee821cfSJay Ding * - (0) if successful. 2558ee821cfSJay Ding * - (-EINVAL) on failure. 2568ee821cfSJay Ding */ 2578ee821cfSJay Ding int (*tf_dev_search_ident)(struct tf *tfp, 2588ee821cfSJay Ding struct tf_ident_search_parms *parms); 259873661aaSJay Ding 260873661aaSJay Ding /** 261873661aaSJay Ding * Retrieves the identifier resource info. 262873661aaSJay Ding * 263873661aaSJay Ding * This API retrieves the identifier resource info from the rm db. 264873661aaSJay Ding * 265873661aaSJay Ding * [in] tfp 266873661aaSJay Ding * Pointer to TF handle 267873661aaSJay Ding * 268873661aaSJay Ding * [in] parms 269873661aaSJay Ding * Pointer to identifier info 270873661aaSJay Ding * 271873661aaSJay Ding * Returns 272873661aaSJay Ding * - (0) if successful. 273873661aaSJay Ding * - (-EINVAL) on failure. 274873661aaSJay Ding */ 275873661aaSJay Ding int (*tf_dev_get_ident_resc_info)(struct tf *tfp, 276873661aaSJay Ding struct tf_identifier_resource_info *parms); 277873661aaSJay Ding 27820339b09SFarah Smith /** 27937ff91c1SFarah Smith * Indicates whether the index table type is SRAM managed 28037ff91c1SFarah Smith * 28137ff91c1SFarah Smith * [in] tfp 28237ff91c1SFarah Smith * Pointer to TF handle 28337ff91c1SFarah Smith * 28437ff91c1SFarah Smith * [in] type 28537ff91c1SFarah Smith * Truflow index table type, e.g. TF_TYPE_FULL_ACT_RECORD 28637ff91c1SFarah Smith * 28737ff91c1SFarah Smith * Returns 28837ff91c1SFarah Smith * - (0) if the table is not managed by the SRAM manager 28937ff91c1SFarah Smith * - (1) if the table is managed by the SRAM manager 29037ff91c1SFarah Smith */ 29137ff91c1SFarah Smith bool (*tf_dev_is_sram_managed)(struct tf *tfp, 29237ff91c1SFarah Smith enum tf_tbl_type tbl_type); 29337ff91c1SFarah Smith 29437ff91c1SFarah Smith /** 29520339b09SFarah Smith * Get SRAM table information. 29620339b09SFarah Smith * 29720339b09SFarah Smith * Converts an internal RM allocated element offset to 29820339b09SFarah Smith * a user address and vice versa. 29920339b09SFarah Smith * 30020339b09SFarah Smith * [in] tfp 30120339b09SFarah Smith * Pointer to TF handle 30220339b09SFarah Smith * 30320339b09SFarah Smith * [in] type 30420339b09SFarah Smith * Truflow index table type, e.g. TF_TYPE_FULL_ACT_RECORD 30520339b09SFarah Smith * 30620339b09SFarah Smith * [in/out] base 30720339b09SFarah Smith * Pointer to the base address of the associated table type. 30820339b09SFarah Smith * 30920339b09SFarah Smith * [in/out] shift 31020339b09SFarah Smith * Pointer to any shift required for the associated table type. 31120339b09SFarah Smith * 31220339b09SFarah Smith * Returns 31320339b09SFarah Smith * - (0) if successful. 31420339b09SFarah Smith * - (-EINVAL) on failure. 31520339b09SFarah Smith */ 31620339b09SFarah Smith int (*tf_dev_get_tbl_info)(struct tf *tfp, 31720339b09SFarah Smith void *tbl_db, 31820339b09SFarah Smith enum tf_tbl_type type, 31920339b09SFarah Smith uint16_t *base, 32020339b09SFarah Smith uint16_t *shift); 3218ee821cfSJay Ding 3228ee821cfSJay Ding /** 32320339b09SFarah Smith * Allocation of an index table type element. 3248187694bSMichael Wildt * 3258187694bSMichael Wildt * This API allocates the specified table type element from a 3268187694bSMichael Wildt * device specific table type DB. The allocated element is 3278187694bSMichael Wildt * returned. 3288187694bSMichael Wildt * 3298187694bSMichael Wildt * [in] tfp 3308187694bSMichael Wildt * Pointer to TF handle 3318187694bSMichael Wildt * 3328187694bSMichael Wildt * [in] parms 333a46bbb57SMichael Wildt * Pointer to table allocation parameters 3348187694bSMichael Wildt * 3358187694bSMichael Wildt * Returns 3368187694bSMichael Wildt * - (0) if successful. 3378187694bSMichael Wildt * - (-EINVAL) on failure. 3388187694bSMichael Wildt */ 339a46bbb57SMichael Wildt int (*tf_dev_alloc_tbl)(struct tf *tfp, 340a46bbb57SMichael Wildt struct tf_tbl_alloc_parms *parms); 3418187694bSMichael Wildt 3428187694bSMichael Wildt /** 34337ff91c1SFarah Smith * Allocation of an SRAM index table type element. 34437ff91c1SFarah Smith * 34537ff91c1SFarah Smith * This API allocates the specified table type element from a 34637ff91c1SFarah Smith * device specific table type DB. The allocated element is 34737ff91c1SFarah Smith * returned. 34837ff91c1SFarah Smith * 34937ff91c1SFarah Smith * [in] tfp 35037ff91c1SFarah Smith * Pointer to TF handle 35137ff91c1SFarah Smith * 35237ff91c1SFarah Smith * [in] parms 35337ff91c1SFarah Smith * Pointer to table allocation parameters 35437ff91c1SFarah Smith * 35537ff91c1SFarah Smith * Returns 35637ff91c1SFarah Smith * - (0) if successful. 35737ff91c1SFarah Smith * - (-EINVAL) on failure. 35837ff91c1SFarah Smith */ 35937ff91c1SFarah Smith int (*tf_dev_alloc_sram_tbl)(struct tf *tfp, 36037ff91c1SFarah Smith struct tf_tbl_alloc_parms *parms); 36137ff91c1SFarah Smith /** 362f000d3dcSJay Ding * Allocation of a external table type element. 363f000d3dcSJay Ding * 364f000d3dcSJay Ding * This API allocates the specified table type element from a 365f000d3dcSJay Ding * device specific table type DB. The allocated element is 366f000d3dcSJay Ding * returned. 367f000d3dcSJay Ding * 368f000d3dcSJay Ding * [in] tfp 369f000d3dcSJay Ding * Pointer to TF handle 370f000d3dcSJay Ding * 371f000d3dcSJay Ding * [in] parms 372f000d3dcSJay Ding * Pointer to table allocation parameters 373f000d3dcSJay Ding * 374f000d3dcSJay Ding * Returns 375f000d3dcSJay Ding * - (0) if successful. 376f000d3dcSJay Ding * - (-EINVAL) on failure. 377f000d3dcSJay Ding */ 378f000d3dcSJay Ding int (*tf_dev_alloc_ext_tbl)(struct tf *tfp, 379f000d3dcSJay Ding struct tf_tbl_alloc_parms *parms); 380f000d3dcSJay Ding 381f000d3dcSJay Ding /** 3828187694bSMichael Wildt * Free of a table type element. 3838187694bSMichael Wildt * 3848187694bSMichael Wildt * This API free's a previous allocated table type element from a 3858187694bSMichael Wildt * device specific table type DB. 3868187694bSMichael Wildt * 3878187694bSMichael Wildt * [in] tfp 3888187694bSMichael Wildt * Pointer to TF handle 3898187694bSMichael Wildt * 3908187694bSMichael Wildt * [in] parms 391a46bbb57SMichael Wildt * Pointer to table free parameters 3928187694bSMichael Wildt * 3938187694bSMichael Wildt * Returns 3948187694bSMichael Wildt * - (0) if successful. 3958187694bSMichael Wildt * - (-EINVAL) on failure. 3968187694bSMichael Wildt */ 397a46bbb57SMichael Wildt int (*tf_dev_free_tbl)(struct tf *tfp, 398a46bbb57SMichael Wildt struct tf_tbl_free_parms *parms); 39937ff91c1SFarah Smith /** 40037ff91c1SFarah Smith * Free of an SRAM table type element. 40137ff91c1SFarah Smith * 40237ff91c1SFarah Smith * This API free's a previous allocated table type element from a 40337ff91c1SFarah Smith * device specific table type DB. 40437ff91c1SFarah Smith * 40537ff91c1SFarah Smith * [in] tfp 40637ff91c1SFarah Smith * Pointer to TF handle 40737ff91c1SFarah Smith * 40837ff91c1SFarah Smith * [in] parms 40937ff91c1SFarah Smith * Pointer to table free parameters 41037ff91c1SFarah Smith * 41137ff91c1SFarah Smith * Returns 41237ff91c1SFarah Smith * - (0) if successful. 41337ff91c1SFarah Smith * - (-EINVAL) on failure. 41437ff91c1SFarah Smith */ 41537ff91c1SFarah Smith int (*tf_dev_free_sram_tbl)(struct tf *tfp, 41637ff91c1SFarah Smith struct tf_tbl_free_parms *parms); 4178187694bSMichael Wildt /** 418f000d3dcSJay Ding * Free of a external table type element. 419f000d3dcSJay Ding * 420f000d3dcSJay Ding * This API free's a previous allocated table type element from a 421f000d3dcSJay Ding * device specific table type DB. 422f000d3dcSJay Ding * 423f000d3dcSJay Ding * [in] tfp 424f000d3dcSJay Ding * Pointer to TF handle 425f000d3dcSJay Ding * 426f000d3dcSJay Ding * [in] parms 427f000d3dcSJay Ding * Pointer to table free parameters 428f000d3dcSJay Ding * 429f000d3dcSJay Ding * Returns 430f000d3dcSJay Ding * - (0) if successful. 431f000d3dcSJay Ding * - (-EINVAL) on failure. 432f000d3dcSJay Ding */ 433f000d3dcSJay Ding int (*tf_dev_free_ext_tbl)(struct tf *tfp, 434f000d3dcSJay Ding struct tf_tbl_free_parms *parms); 435f000d3dcSJay Ding 436f000d3dcSJay Ding /** 4378187694bSMichael Wildt * Sets the specified table type element. 4388187694bSMichael Wildt * 4398187694bSMichael Wildt * This API sets the specified element data by invoking the 4408187694bSMichael Wildt * firmware. 4418187694bSMichael Wildt * 4428187694bSMichael Wildt * [in] tfp 4438187694bSMichael Wildt * Pointer to TF handle 4448187694bSMichael Wildt * 4458187694bSMichael Wildt * [in] parms 446a46bbb57SMichael Wildt * Pointer to table set parameters 4478187694bSMichael Wildt * 4488187694bSMichael Wildt * Returns 4498187694bSMichael Wildt * - (0) if successful. 4508187694bSMichael Wildt * - (-EINVAL) on failure. 4518187694bSMichael Wildt */ 452a46bbb57SMichael Wildt int (*tf_dev_set_tbl)(struct tf *tfp, 453a46bbb57SMichael Wildt struct tf_tbl_set_parms *parms); 4548187694bSMichael Wildt 4558187694bSMichael Wildt /** 456f000d3dcSJay Ding * Sets the specified external table type element. 457f000d3dcSJay Ding * 458f000d3dcSJay Ding * This API sets the specified element data by invoking the 459f000d3dcSJay Ding * firmware. 460f000d3dcSJay Ding * 461f000d3dcSJay Ding * [in] tfp 462f000d3dcSJay Ding * Pointer to TF handle 463f000d3dcSJay Ding * 464f000d3dcSJay Ding * [in] parms 465f000d3dcSJay Ding * Pointer to table set parameters 466f000d3dcSJay Ding * 467f000d3dcSJay Ding * Returns 468f000d3dcSJay Ding * - (0) if successful. 469f000d3dcSJay Ding * - (-EINVAL) on failure. 470f000d3dcSJay Ding */ 471f000d3dcSJay Ding int (*tf_dev_set_ext_tbl)(struct tf *tfp, 472f000d3dcSJay Ding struct tf_tbl_set_parms *parms); 473f000d3dcSJay Ding 474f000d3dcSJay Ding /** 47537ff91c1SFarah Smith * Sets the specified SRAM table type element. 47637ff91c1SFarah Smith * 47737ff91c1SFarah Smith * This API sets the specified element data by invoking the 47837ff91c1SFarah Smith * firmware. 47937ff91c1SFarah Smith * 48037ff91c1SFarah Smith * [in] tfp 48137ff91c1SFarah Smith * Pointer to TF handle 48237ff91c1SFarah Smith * 48337ff91c1SFarah Smith * [in] parms 48437ff91c1SFarah Smith * Pointer to table set parameters 48537ff91c1SFarah Smith * 48637ff91c1SFarah Smith * Returns 48737ff91c1SFarah Smith * - (0) if successful. 48837ff91c1SFarah Smith * - (-EINVAL) on failure. 48937ff91c1SFarah Smith */ 49037ff91c1SFarah Smith int (*tf_dev_set_sram_tbl)(struct tf *tfp, 49137ff91c1SFarah Smith struct tf_tbl_set_parms *parms); 49237ff91c1SFarah Smith 49337ff91c1SFarah Smith /** 4948187694bSMichael Wildt * Retrieves the specified table type element. 4958187694bSMichael Wildt * 4968187694bSMichael Wildt * This API retrieves the specified element data by invoking the 4978187694bSMichael Wildt * firmware. 4988187694bSMichael Wildt * 4998187694bSMichael Wildt * [in] tfp 5008187694bSMichael Wildt * Pointer to TF handle 5018187694bSMichael Wildt * 5028187694bSMichael Wildt * [in] parms 503a46bbb57SMichael Wildt * Pointer to table get parameters 5048187694bSMichael Wildt * 5058187694bSMichael Wildt * Returns 5068187694bSMichael Wildt * - (0) if successful. 5078187694bSMichael Wildt * - (-EINVAL) on failure. 5088187694bSMichael Wildt */ 509a46bbb57SMichael Wildt int (*tf_dev_get_tbl)(struct tf *tfp, 510a46bbb57SMichael Wildt struct tf_tbl_get_parms *parms); 5118187694bSMichael Wildt 5128187694bSMichael Wildt /** 51337ff91c1SFarah Smith * Retrieves the specified SRAM table type element. 51437ff91c1SFarah Smith * 51537ff91c1SFarah Smith * This API retrieves the specified element data by invoking the 51637ff91c1SFarah Smith * firmware. 51737ff91c1SFarah Smith * 51837ff91c1SFarah Smith * [in] tfp 51937ff91c1SFarah Smith * Pointer to TF handle 52037ff91c1SFarah Smith * 52137ff91c1SFarah Smith * [in] parms 52237ff91c1SFarah Smith * Pointer to table get parameters 52337ff91c1SFarah Smith * 52437ff91c1SFarah Smith * Returns 52537ff91c1SFarah Smith * - (0) if successful. 52637ff91c1SFarah Smith * - (-EINVAL) on failure. 52737ff91c1SFarah Smith */ 52837ff91c1SFarah Smith int (*tf_dev_get_sram_tbl)(struct tf *tfp, 52937ff91c1SFarah Smith struct tf_tbl_get_parms *parms); 53037ff91c1SFarah Smith 53137ff91c1SFarah Smith /** 532ced3cdedSMichael Wildt * Retrieves the specified table type element using 'bulk' 533ced3cdedSMichael Wildt * mechanism. 534ced3cdedSMichael Wildt * 535ced3cdedSMichael Wildt * This API retrieves the specified element data by invoking the 536ced3cdedSMichael Wildt * firmware. 537ced3cdedSMichael Wildt * 538ced3cdedSMichael Wildt * [in] tfp 539ced3cdedSMichael Wildt * Pointer to TF handle 540ced3cdedSMichael Wildt * 541ced3cdedSMichael Wildt * [in] parms 542ced3cdedSMichael Wildt * Pointer to table get bulk parameters 543ced3cdedSMichael Wildt * 544ced3cdedSMichael Wildt * Returns 545ced3cdedSMichael Wildt * - (0) if successful. 546ced3cdedSMichael Wildt * - (-EINVAL) on failure. 547ced3cdedSMichael Wildt */ 548ced3cdedSMichael Wildt int (*tf_dev_get_bulk_tbl)(struct tf *tfp, 549ced3cdedSMichael Wildt struct tf_tbl_get_bulk_parms *parms); 550ced3cdedSMichael Wildt 551ced3cdedSMichael Wildt /** 55237ff91c1SFarah Smith * Retrieves the specified SRAM table type element using 'bulk' 55337ff91c1SFarah Smith * mechanism. 55437ff91c1SFarah Smith * 55537ff91c1SFarah Smith * This API retrieves the specified element data by invoking the 55637ff91c1SFarah Smith * firmware. 55737ff91c1SFarah Smith * 55837ff91c1SFarah Smith * [in] tfp 55937ff91c1SFarah Smith * Pointer to TF handle 56037ff91c1SFarah Smith * 56137ff91c1SFarah Smith * [in] parms 56237ff91c1SFarah Smith * Pointer to table get bulk parameters 56337ff91c1SFarah Smith * 56437ff91c1SFarah Smith * Returns 56537ff91c1SFarah Smith * - (0) if successful. 56637ff91c1SFarah Smith * - (-EINVAL) on failure. 56737ff91c1SFarah Smith */ 56837ff91c1SFarah Smith int (*tf_dev_get_bulk_sram_tbl)(struct tf *tfp, 56937ff91c1SFarah Smith struct tf_tbl_get_bulk_parms *parms); 57037ff91c1SFarah Smith 57137ff91c1SFarah Smith /** 572c87bd543SFarah Smith * Gets the increment value to add to the shared session resource 573c87bd543SFarah Smith * start offset by for each count in the "stride" 574c87bd543SFarah Smith * 575c87bd543SFarah Smith * [in] tfp 576c87bd543SFarah Smith * Pointer to TF handle 577c87bd543SFarah Smith * 578c87bd543SFarah Smith * [in] parms 579c87bd543SFarah Smith * Pointer to get shared tbl increment parameters 580c87bd543SFarah Smith * 581c87bd543SFarah Smith * Returns 582c87bd543SFarah Smith * - (0) if successful. 583c87bd543SFarah Smith * - (-EINVAL) on failure. 584c87bd543SFarah Smith */ 585c87bd543SFarah Smith int (*tf_dev_get_shared_tbl_increment)(struct tf *tfp, 586c87bd543SFarah Smith struct tf_get_shared_tbl_increment_parms *parms); 587c87bd543SFarah Smith 588c87bd543SFarah Smith /** 589873661aaSJay Ding * Retrieves the table resource info. 590873661aaSJay Ding * 591873661aaSJay Ding * This API retrieves the table resource info from the rm db. 592873661aaSJay Ding * 593873661aaSJay Ding * [in] tfp 594873661aaSJay Ding * Pointer to TF handle 595873661aaSJay Ding * 596873661aaSJay Ding * [in] parms 597873661aaSJay Ding * Pointer to tbl info 598873661aaSJay Ding * 599873661aaSJay Ding * Returns 600873661aaSJay Ding * - (0) if successful. 601873661aaSJay Ding * - (-EINVAL) on failure. 602873661aaSJay Ding */ 603873661aaSJay Ding int (*tf_dev_get_tbl_resc_info)(struct tf *tfp, 604873661aaSJay Ding struct tf_tbl_resource_info *parms); 605873661aaSJay Ding 606873661aaSJay Ding /** 6078187694bSMichael Wildt * Allocation of a tcam element. 6088187694bSMichael Wildt * 6098187694bSMichael Wildt * This API allocates the specified tcam element from a device 6108187694bSMichael Wildt * specific tcam DB. The allocated element is returned. 6118187694bSMichael Wildt * 6128187694bSMichael Wildt * [in] tfp 6138187694bSMichael Wildt * Pointer to TF handle 6148187694bSMichael Wildt * 6158187694bSMichael Wildt * [in] parms 6168187694bSMichael Wildt * Pointer to tcam allocation parameters 6178187694bSMichael Wildt * 6188187694bSMichael Wildt * Returns 6198187694bSMichael Wildt * - (0) if successful. 6208187694bSMichael Wildt * - (-EINVAL) on failure. 6218187694bSMichael Wildt */ 6228187694bSMichael Wildt int (*tf_dev_alloc_tcam)(struct tf *tfp, 6238187694bSMichael Wildt struct tf_tcam_alloc_parms *parms); 6248187694bSMichael Wildt 6258187694bSMichael Wildt /** 6268187694bSMichael Wildt * Free of a tcam element. 6278187694bSMichael Wildt * 6288187694bSMichael Wildt * This API free's a previous allocated tcam element from a 6298187694bSMichael Wildt * device specific tcam DB. 6308187694bSMichael Wildt * 6318187694bSMichael Wildt * [in] tfp 6328187694bSMichael Wildt * Pointer to TF handle 6338187694bSMichael Wildt * 6348187694bSMichael Wildt * [in] parms 6358187694bSMichael Wildt * Pointer to tcam free parameters 6368187694bSMichael Wildt * 6378187694bSMichael Wildt * Returns 6388187694bSMichael Wildt * - (0) if successful. 6398187694bSMichael Wildt * - (-EINVAL) on failure. 6408187694bSMichael Wildt */ 6418187694bSMichael Wildt int (*tf_dev_free_tcam)(struct tf *tfp, 6428187694bSMichael Wildt struct tf_tcam_free_parms *parms); 6438187694bSMichael Wildt 6448187694bSMichael Wildt /** 6458187694bSMichael Wildt * Searches for the specified tcam element in a shadow DB. 6468187694bSMichael Wildt * 6478187694bSMichael Wildt * This API searches for the specified tcam element in a 6488187694bSMichael Wildt * device specific shadow DB. If the element is found the 6498187694bSMichael Wildt * reference count for the element is updated. If the element 6508187694bSMichael Wildt * is not found a new element is allocated from the tcam DB 6518187694bSMichael Wildt * and then inserted into the shadow DB. 6528187694bSMichael Wildt * 6538187694bSMichael Wildt * [in] tfp 6548187694bSMichael Wildt * Pointer to TF handle 6558187694bSMichael Wildt * 6568187694bSMichael Wildt * [in] parms 6578187694bSMichael Wildt * Pointer to tcam allocation and search parameters 6588187694bSMichael Wildt * 6598187694bSMichael Wildt * Returns 6608187694bSMichael Wildt * - (0) if successful. 6618187694bSMichael Wildt * - (-EINVAL) on failure. 6628187694bSMichael Wildt */ 6638187694bSMichael Wildt int (*tf_dev_alloc_search_tcam) 6648187694bSMichael Wildt (struct tf *tfp, 6658187694bSMichael Wildt struct tf_tcam_alloc_search_parms *parms); 6668187694bSMichael Wildt 6678187694bSMichael Wildt /** 6688187694bSMichael Wildt * Sets the specified tcam element. 6698187694bSMichael Wildt * 6708187694bSMichael Wildt * This API sets the specified element data by invoking the 6718187694bSMichael Wildt * firmware. 6728187694bSMichael Wildt * 6738187694bSMichael Wildt * [in] tfp 6748187694bSMichael Wildt * Pointer to TF handle 6758187694bSMichael Wildt * 6768187694bSMichael Wildt * [in] parms 6778187694bSMichael Wildt * Pointer to tcam set parameters 6788187694bSMichael Wildt * 6798187694bSMichael Wildt * Returns 6808187694bSMichael Wildt * - (0) if successful. 6818187694bSMichael Wildt * - (-EINVAL) on failure. 6828187694bSMichael Wildt */ 6838187694bSMichael Wildt int (*tf_dev_set_tcam)(struct tf *tfp, 6848187694bSMichael Wildt struct tf_tcam_set_parms *parms); 6858187694bSMichael Wildt 6868187694bSMichael Wildt /** 6878187694bSMichael Wildt * Retrieves the specified tcam element. 6888187694bSMichael Wildt * 6898187694bSMichael Wildt * This API retrieves the specified element data by invoking the 6908187694bSMichael Wildt * firmware. 6918187694bSMichael Wildt * 6928187694bSMichael Wildt * [in] tfp 6938187694bSMichael Wildt * Pointer to TF handle 6948187694bSMichael Wildt * 6958187694bSMichael Wildt * [in] parms 6968187694bSMichael Wildt * Pointer to tcam get parameters 6978187694bSMichael Wildt * 6988187694bSMichael Wildt * Returns 6998187694bSMichael Wildt * - (0) if successful. 7008187694bSMichael Wildt * - (-EINVAL) on failure. 7018187694bSMichael Wildt */ 7028187694bSMichael Wildt int (*tf_dev_get_tcam)(struct tf *tfp, 7038187694bSMichael Wildt struct tf_tcam_get_parms *parms); 70477805a17SRandy Schacher 70583680d37SFarah Smith /** 70683680d37SFarah Smith * Move TCAM shared entries 70783680d37SFarah Smith * 70883680d37SFarah Smith * [in] tfp 70983680d37SFarah Smith * Pointer to TF handle 71083680d37SFarah Smith * 71183680d37SFarah Smith * [in] parms 71283680d37SFarah Smith * Pointer to parameters 71383680d37SFarah Smith * 71483680d37SFarah Smith * returns: 71583680d37SFarah Smith * 0 - Success 71683680d37SFarah Smith * -EINVAL - Error 71783680d37SFarah Smith */ 71883680d37SFarah Smith int (*tf_dev_move_tcam)(struct tf *tfp, 71983680d37SFarah Smith struct tf_move_tcam_shared_entries_parms *parms); 7204e61f0f4SFarah Smith 7214e61f0f4SFarah Smith /** 7224e61f0f4SFarah Smith * Move TCAM shared entries 7234e61f0f4SFarah Smith * 7244e61f0f4SFarah Smith * [in] tfp 7254e61f0f4SFarah Smith * Pointer to TF handle 7264e61f0f4SFarah Smith * 7274e61f0f4SFarah Smith * [in] parms 7284e61f0f4SFarah Smith * Pointer to parameters 7294e61f0f4SFarah Smith * 7304e61f0f4SFarah Smith * returns: 7314e61f0f4SFarah Smith * 0 - Success 7324e61f0f4SFarah Smith * -EINVAL - Error 7334e61f0f4SFarah Smith */ 7344e61f0f4SFarah Smith int (*tf_dev_clear_tcam)(struct tf *tfp, 7354e61f0f4SFarah Smith struct tf_clear_tcam_shared_entries_parms *parms); 7364e61f0f4SFarah Smith 73777805a17SRandy Schacher /** 738873661aaSJay Ding * Retrieves the tcam resource info. 739873661aaSJay Ding * 740873661aaSJay Ding * This API retrieves the tcam resource info from the rm db. 741873661aaSJay Ding * 742873661aaSJay Ding * [in] tfp 743873661aaSJay Ding * Pointer to TF handle 744873661aaSJay Ding * 745873661aaSJay Ding * [in] parms 746873661aaSJay Ding * Pointer to tcam info 747873661aaSJay Ding * 748873661aaSJay Ding * Returns 749873661aaSJay Ding * - (0) if successful. 750873661aaSJay Ding * - (-EINVAL) on failure. 751873661aaSJay Ding */ 752873661aaSJay Ding int (*tf_dev_get_tcam_resc_info)(struct tf *tfp, 753873661aaSJay Ding struct tf_tcam_resource_info *parms); 754873661aaSJay Ding 755873661aaSJay Ding /** 75677805a17SRandy Schacher * Insert EM hash entry API 75777805a17SRandy Schacher * 75877805a17SRandy Schacher * [in] tfp 75977805a17SRandy Schacher * Pointer to TF handle 76077805a17SRandy Schacher * 76177805a17SRandy Schacher * [in] parms 76277805a17SRandy Schacher * Pointer to E/EM insert parameters 76377805a17SRandy Schacher * 76477805a17SRandy Schacher * Returns: 76577805a17SRandy Schacher * 0 - Success 76677805a17SRandy Schacher * -EINVAL - Error 76777805a17SRandy Schacher */ 768ca5e61bdSPeter Spreadborough int (*tf_dev_insert_int_em_entry)(struct tf *tfp, 76977805a17SRandy Schacher struct tf_insert_em_entry_parms *parms); 77077805a17SRandy Schacher 77177805a17SRandy Schacher /** 77277805a17SRandy Schacher * Delete EM hash entry API 77377805a17SRandy Schacher * 77477805a17SRandy Schacher * [in] tfp 77577805a17SRandy Schacher * Pointer to TF handle 77677805a17SRandy Schacher * 77777805a17SRandy Schacher * [in] parms 77877805a17SRandy Schacher * Pointer to E/EM delete parameters 77977805a17SRandy Schacher * 78077805a17SRandy Schacher * returns: 78177805a17SRandy Schacher * 0 - Success 78277805a17SRandy Schacher * -EINVAL - Error 78377805a17SRandy Schacher */ 784ca5e61bdSPeter Spreadborough int (*tf_dev_delete_int_em_entry)(struct tf *tfp, 78577805a17SRandy Schacher struct tf_delete_em_entry_parms *parms); 786ca5e61bdSPeter Spreadborough 787ca5e61bdSPeter Spreadborough /** 78805b405d5SPeter Spreadborough * Move EM hash entry API 78905b405d5SPeter Spreadborough * 79005b405d5SPeter Spreadborough * [in] tfp 79105b405d5SPeter Spreadborough * Pointer to TF handle 79205b405d5SPeter Spreadborough * 79305b405d5SPeter Spreadborough * [in] parms 79405b405d5SPeter Spreadborough * Pointer to E/EM move parameters 79505b405d5SPeter Spreadborough * 79605b405d5SPeter Spreadborough * returns: 79705b405d5SPeter Spreadborough * 0 - Success 79805b405d5SPeter Spreadborough * -EINVAL - Error 79905b405d5SPeter Spreadborough */ 80005b405d5SPeter Spreadborough int (*tf_dev_move_int_em_entry)(struct tf *tfp, 80105b405d5SPeter Spreadborough struct tf_move_em_entry_parms *parms); 80205b405d5SPeter Spreadborough 80305b405d5SPeter Spreadborough /** 804ca5e61bdSPeter Spreadborough * Insert EEM hash entry API 805ca5e61bdSPeter Spreadborough * 806ca5e61bdSPeter Spreadborough * [in] tfp 807ca5e61bdSPeter Spreadborough * Pointer to TF handle 808ca5e61bdSPeter Spreadborough * 809ca5e61bdSPeter Spreadborough * [in] parms 810ca5e61bdSPeter Spreadborough * Pointer to E/EM insert parameters 811ca5e61bdSPeter Spreadborough * 812ca5e61bdSPeter Spreadborough * Returns: 813ca5e61bdSPeter Spreadborough * 0 - Success 814ca5e61bdSPeter Spreadborough * -EINVAL - Error 815ca5e61bdSPeter Spreadborough */ 816ca5e61bdSPeter Spreadborough int (*tf_dev_insert_ext_em_entry)(struct tf *tfp, 817ca5e61bdSPeter Spreadborough struct tf_insert_em_entry_parms *parms); 818ca5e61bdSPeter Spreadborough 819ca5e61bdSPeter Spreadborough /** 820ca5e61bdSPeter Spreadborough * Delete EEM hash entry API 821ca5e61bdSPeter Spreadborough * 822ca5e61bdSPeter Spreadborough * [in] tfp 823ca5e61bdSPeter Spreadborough * Pointer to TF handle 824ca5e61bdSPeter Spreadborough * 825ca5e61bdSPeter Spreadborough * [in] parms 826ca5e61bdSPeter Spreadborough * Pointer to E/EM delete parameters 827ca5e61bdSPeter Spreadborough * 828ca5e61bdSPeter Spreadborough * returns: 829ca5e61bdSPeter Spreadborough * 0 - Success 830ca5e61bdSPeter Spreadborough * -EINVAL - Error 831ca5e61bdSPeter Spreadborough */ 832ca5e61bdSPeter Spreadborough int (*tf_dev_delete_ext_em_entry)(struct tf *tfp, 833ca5e61bdSPeter Spreadborough struct tf_delete_em_entry_parms *parms); 834ca5e61bdSPeter Spreadborough 835ca5e61bdSPeter Spreadborough /** 836873661aaSJay Ding * Retrieves the em resource info. 837873661aaSJay Ding * 838873661aaSJay Ding * This API retrieves the em resource info from the rm db. 839873661aaSJay Ding * 840873661aaSJay Ding * [in] tfp 841873661aaSJay Ding * Pointer to TF handle 842873661aaSJay Ding * 843873661aaSJay Ding * [in] parms 844873661aaSJay Ding * Pointer to em info 845873661aaSJay Ding * 846873661aaSJay Ding * Returns 847873661aaSJay Ding * - (0) if successful. 848873661aaSJay Ding * - (-EINVAL) on failure. 849873661aaSJay Ding */ 850873661aaSJay Ding int (*tf_dev_get_em_resc_info)(struct tf *tfp, 851873661aaSJay Ding struct tf_em_resource_info *parms); 852873661aaSJay Ding 853873661aaSJay Ding /** 85405b405d5SPeter Spreadborough * Move EEM hash entry API 85505b405d5SPeter Spreadborough * 85605b405d5SPeter Spreadborough * Pointer to E/EM move parameters 85705b405d5SPeter Spreadborough * 85805b405d5SPeter Spreadborough * [in] tfp 85905b405d5SPeter Spreadborough * Pointer to TF handle 86005b405d5SPeter Spreadborough * 86105b405d5SPeter Spreadborough * [in] parms 86205b405d5SPeter Spreadborough * Pointer to em info 86305b405d5SPeter Spreadborough * 86405b405d5SPeter Spreadborough * returns: 86505b405d5SPeter Spreadborough * 0 - Success 86605b405d5SPeter Spreadborough * -EINVAL - Error 86705b405d5SPeter Spreadborough */ 86805b405d5SPeter Spreadborough int (*tf_dev_move_ext_em_entry)(struct tf *tfp, 86905b405d5SPeter Spreadborough struct tf_move_em_entry_parms *parms); 87005b405d5SPeter Spreadborough 87105b405d5SPeter Spreadborough /** 872ca5e61bdSPeter Spreadborough * Allocate EEM table scope 873ca5e61bdSPeter Spreadborough * 874ca5e61bdSPeter Spreadborough * [in] tfp 875ca5e61bdSPeter Spreadborough * Pointer to TF handle 876ca5e61bdSPeter Spreadborough * 877ca5e61bdSPeter Spreadborough * [in] parms 878ca5e61bdSPeter Spreadborough * Pointer to table scope alloc parameters 879ca5e61bdSPeter Spreadborough * 880ca5e61bdSPeter Spreadborough * returns: 881ca5e61bdSPeter Spreadborough * 0 - Success 882ca5e61bdSPeter Spreadborough * -EINVAL - Error 883ca5e61bdSPeter Spreadborough */ 884ca5e61bdSPeter Spreadborough int (*tf_dev_alloc_tbl_scope)(struct tf *tfp, 885ca5e61bdSPeter Spreadborough struct tf_alloc_tbl_scope_parms *parms); 8865ca95058SJay Ding /** 8875ca95058SJay Ding * Map EEM parif 8885ca95058SJay Ding * 8895ca95058SJay Ding * [in] tfp 8905ca95058SJay Ding * Pointer to TF handle 8915ca95058SJay Ding * 8920ea250f8SFarah Smith * [in] pf 8930ea250f8SFarah Smith * PF associated with the table scope 8940ea250f8SFarah Smith * 8950ea250f8SFarah Smith * [in] parif_bitmask 8960ea250f8SFarah Smith * Bitmask of PARIFs to enable 8975ca95058SJay Ding * 8985ca95058SJay Ding * [in/out] pointer to the parif_2_pf data to be updated 8995ca95058SJay Ding * 9005ca95058SJay Ding * [in/out] pointer to the parif_2_pf mask to be updated 9015ca95058SJay Ding * 9025ca95058SJay Ding * [in] sz_in_bytes - number of bytes to be written 9035ca95058SJay Ding * 9045ca95058SJay Ding * returns: 9055ca95058SJay Ding * 0 - Success 9065ca95058SJay Ding * -EINVAL - Error 9075ca95058SJay Ding */ 9085ca95058SJay Ding int (*tf_dev_map_parif)(struct tf *tfp, 9090ea250f8SFarah Smith uint16_t parif_bitmask, 9100ea250f8SFarah Smith uint16_t pf, 9115ca95058SJay Ding uint8_t *data, 9125ca95058SJay Ding uint8_t *mask, 9135ca95058SJay Ding uint16_t sz_in_bytes); 9145ca95058SJay Ding /** 9155ca95058SJay Ding * Map EEM table scope 9165ca95058SJay Ding * 9175ca95058SJay Ding * [in] tfp 9185ca95058SJay Ding * Pointer to TF handle 9195ca95058SJay Ding * 9205ca95058SJay Ding * [in] parms 9215ca95058SJay Ding * Pointer to table scope map parameters 9225ca95058SJay Ding * 9235ca95058SJay Ding * returns: 9245ca95058SJay Ding * 0 - Success 9255ca95058SJay Ding * -EINVAL - Error 9265ca95058SJay Ding */ 9275ca95058SJay Ding int (*tf_dev_map_tbl_scope)(struct tf *tfp, 9285ca95058SJay Ding struct tf_map_tbl_scope_parms *parms); 929ca5e61bdSPeter Spreadborough 930ca5e61bdSPeter Spreadborough /** 931ca5e61bdSPeter Spreadborough * Free EEM table scope 932ca5e61bdSPeter Spreadborough * 933ca5e61bdSPeter Spreadborough * [in] tfp 934ca5e61bdSPeter Spreadborough * Pointer to TF handle 935ca5e61bdSPeter Spreadborough * 936ca5e61bdSPeter Spreadborough * [in] parms 937ca5e61bdSPeter Spreadborough * Pointer to table scope free parameters 938ca5e61bdSPeter Spreadborough * 939ca5e61bdSPeter Spreadborough * returns: 940ca5e61bdSPeter Spreadborough * 0 - Success 941ca5e61bdSPeter Spreadborough * -EINVAL - Error 942ca5e61bdSPeter Spreadborough */ 943ca5e61bdSPeter Spreadborough int (*tf_dev_free_tbl_scope)(struct tf *tfp, 944ca5e61bdSPeter Spreadborough struct tf_free_tbl_scope_parms *parms); 945f3502f5cSJay Ding 946f3502f5cSJay Ding /** 947f3502f5cSJay Ding * Sets the specified interface table type element. 948f3502f5cSJay Ding * 949f3502f5cSJay Ding * This API sets the specified element data by invoking the 950f3502f5cSJay Ding * firmware. 951f3502f5cSJay Ding * 952f3502f5cSJay Ding * [in] tfp 953f3502f5cSJay Ding * Pointer to TF handle 954f3502f5cSJay Ding * 955f3502f5cSJay Ding * [in] parms 956f3502f5cSJay Ding * Pointer to interface table set parameters 957f3502f5cSJay Ding * 958f3502f5cSJay Ding * Returns 959f3502f5cSJay Ding * - (0) if successful. 960f3502f5cSJay Ding * - (-EINVAL) on failure. 961f3502f5cSJay Ding */ 962f3502f5cSJay Ding int (*tf_dev_set_if_tbl)(struct tf *tfp, 963f3502f5cSJay Ding struct tf_if_tbl_set_parms *parms); 964f3502f5cSJay Ding 965f3502f5cSJay Ding /** 966f3502f5cSJay Ding * Retrieves the specified interface table type element. 967f3502f5cSJay Ding * 968f3502f5cSJay Ding * This API retrieves the specified element data by invoking the 969f3502f5cSJay Ding * firmware. 970f3502f5cSJay Ding * 971f3502f5cSJay Ding * [in] tfp 972f3502f5cSJay Ding * Pointer to TF handle 973f3502f5cSJay Ding * 974f3502f5cSJay Ding * [in] parms 975f3502f5cSJay Ding * Pointer to table get parameters 976f3502f5cSJay Ding * 977f3502f5cSJay Ding * Returns 978f3502f5cSJay Ding * - (0) if successful. 979f3502f5cSJay Ding * - (-EINVAL) on failure. 980f3502f5cSJay Ding */ 981f3502f5cSJay Ding int (*tf_dev_get_if_tbl)(struct tf *tfp, 982f3502f5cSJay Ding struct tf_if_tbl_get_parms *parms); 983a11f87d3SJay Ding 984a11f87d3SJay Ding /** 985a11f87d3SJay Ding * Update global cfg 986a11f87d3SJay Ding * 987a11f87d3SJay Ding * [in] tfp 988a11f87d3SJay Ding * Pointer to TF handle 989a11f87d3SJay Ding * 990a11f87d3SJay Ding * [in] parms 991a11f87d3SJay Ding * Pointer to global cfg parameters 992a11f87d3SJay Ding * 993a11f87d3SJay Ding * returns: 994a11f87d3SJay Ding * 0 - Success 995a11f87d3SJay Ding * -EINVAL - Error 996a11f87d3SJay Ding */ 997a11f87d3SJay Ding int (*tf_dev_set_global_cfg)(struct tf *tfp, 9985ca95058SJay Ding struct tf_global_cfg_parms *parms); 999a11f87d3SJay Ding 1000a11f87d3SJay Ding /** 1001a11f87d3SJay Ding * Get global cfg 1002a11f87d3SJay Ding * 1003a11f87d3SJay Ding * [in] tfp 1004a11f87d3SJay Ding * Pointer to TF handle 1005a11f87d3SJay Ding * 1006a11f87d3SJay Ding * [in] parms 1007a11f87d3SJay Ding * Pointer to global cfg parameters 1008a11f87d3SJay Ding * 1009a11f87d3SJay Ding * returns: 1010a11f87d3SJay Ding * 0 - Success 1011a11f87d3SJay Ding * -EINVAL - Error 1012a11f87d3SJay Ding */ 1013a11f87d3SJay Ding int (*tf_dev_get_global_cfg)(struct tf *tfp, 10145ca95058SJay Ding struct tf_global_cfg_parms *parms); 10153d3ab7dfSPeter Spreadborough 10163d3ab7dfSPeter Spreadborough /** 10173d3ab7dfSPeter Spreadborough * Get mailbox 10183d3ab7dfSPeter Spreadborough * 10193d3ab7dfSPeter Spreadborough * returns: 10203d3ab7dfSPeter Spreadborough * mailbox 10213d3ab7dfSPeter Spreadborough */ 10223d3ab7dfSPeter Spreadborough int (*tf_dev_get_mailbox)(void); 1023a9597be7SJay Ding 1024a9597be7SJay Ding /** 1025a9597be7SJay Ding * Convert length in bit to length in byte and align to word. 1026a9597be7SJay Ding * The word length depends on device type. 1027a9597be7SJay Ding * 1028a9597be7SJay Ding * [in] size 1029a9597be7SJay Ding * Size in bit 1030a9597be7SJay Ding * 1031a9597be7SJay Ding * Returns 1032a9597be7SJay Ding * Size in byte 1033a9597be7SJay Ding */ 1034a9597be7SJay Ding int (*tf_dev_word_align)(uint16_t size); 1035b56a8975SPeter Spreadborough 1036b56a8975SPeter Spreadborough /** 1037b56a8975SPeter Spreadborough * Hash key using crc32 and lookup3 1038b56a8975SPeter Spreadborough * 1039b56a8975SPeter Spreadborough * [in] key_data 1040b56a8975SPeter Spreadborough * Pointer to key 1041b56a8975SPeter Spreadborough * 1042b56a8975SPeter Spreadborough * [in] bitlen 1043b56a8975SPeter Spreadborough * Number of key bits 1044b56a8975SPeter Spreadborough * 1045b56a8975SPeter Spreadborough * Returns 1046b56a8975SPeter Spreadborough * Hashes 1047b56a8975SPeter Spreadborough */ 1048b56a8975SPeter Spreadborough uint64_t (*tf_dev_cfa_key_hash)(uint64_t *key_data, 1049b56a8975SPeter Spreadborough uint16_t bitlen); 1050588e333eSJay Ding 1051588e333eSJay Ding /** 1052588e333eSJay Ding * Translate the CFA resource type to Truflow type 1053588e333eSJay Ding * 1054588e333eSJay Ding * [in] hcapi_types 1055588e333eSJay Ding * CFA resource type bitmap 1056588e333eSJay Ding * 1057588e333eSJay Ding * [out] ident_types 1058588e333eSJay Ding * Pointer to identifier type bitmap 1059588e333eSJay Ding * 1060588e333eSJay Ding * [out] tcam_types 1061588e333eSJay Ding * Pointer to tcam type bitmap 1062588e333eSJay Ding * 1063588e333eSJay Ding * [out] tbl_types 1064588e333eSJay Ding * Pointer to table type bitmap 1065588e333eSJay Ding * 1066588e333eSJay Ding * [out] em_types 1067588e333eSJay Ding * Pointer to em type bitmap 1068588e333eSJay Ding * 1069588e333eSJay Ding * Returns 1070588e333eSJay Ding * - (0) if successful. 1071588e333eSJay Ding * - (-EINVAL) on failure. 1072588e333eSJay Ding */ 1073588e333eSJay Ding int (*tf_dev_map_hcapi_caps)(uint64_t hcapi_caps, 1074588e333eSJay Ding uint32_t *ident_caps, 1075588e333eSJay Ding uint32_t *tcam_caps, 1076588e333eSJay Ding uint32_t *tbl_caps, 1077588e333eSJay Ding uint32_t *em_caps); 10784d05ce4eSJay Ding 10794d05ce4eSJay Ding /** 1080d1bd2897SJay Ding * Device specific function that retrieves the sram resource 10814d05ce4eSJay Ding * 10824d05ce4eSJay Ding * [in] query 10834d05ce4eSJay Ding * Point to resources query result 10844d05ce4eSJay Ding * 10854d05ce4eSJay Ding * [out] sram_bank_caps 10864d05ce4eSJay Ding * Pointer to SRAM bank capabilities 10874d05ce4eSJay Ding * 10884d05ce4eSJay Ding * [out] dynamic_sram_capable 10894d05ce4eSJay Ding * Pointer to dynamic sram capable 10904d05ce4eSJay Ding * 10914d05ce4eSJay Ding * Returns 10924d05ce4eSJay Ding * - (0) if successful. 10934d05ce4eSJay Ding * - (-EINVAL) on failure. 10944d05ce4eSJay Ding */ 10954d05ce4eSJay Ding int (*tf_dev_get_sram_resources)(void *query, 10964d05ce4eSJay Ding uint32_t *sram_bank_caps, 10974d05ce4eSJay Ding bool *dynamic_sram_capable); 1098d1bd2897SJay Ding 1099d1bd2897SJay Ding /** 1100d1bd2897SJay Ding * Device specific function that sets the sram policy 1101d1bd2897SJay Ding * 1102d1bd2897SJay Ding * [in] dir 1103d1bd2897SJay Ding * Receive or transmit direction 1104d1bd2897SJay Ding * 1105d1bd2897SJay Ding * [in] band_id 1106d1bd2897SJay Ding * SRAM bank id 1107d1bd2897SJay Ding * 1108d1bd2897SJay Ding * Returns 1109d1bd2897SJay Ding * - (0) if successful. 1110d1bd2897SJay Ding * - (-EINVAL) on failure. 1111d1bd2897SJay Ding */ 1112d1bd2897SJay Ding int (*tf_dev_set_sram_policy)(enum tf_dir dir, 1113f2c730d4SJay Ding enum tf_sram_bank_id *bank_id); 1114d1bd2897SJay Ding 1115d1bd2897SJay Ding /** 1116d1bd2897SJay Ding * Device specific function that gets the sram policy 1117d1bd2897SJay Ding * 1118d1bd2897SJay Ding * [in] dir 1119d1bd2897SJay Ding * Receive or transmit direction 1120d1bd2897SJay Ding * 1121d1bd2897SJay Ding * [in] band_id 1122d1bd2897SJay Ding * pointer to SRAM bank id 1123d1bd2897SJay Ding * 1124d1bd2897SJay Ding * Returns 1125d1bd2897SJay Ding * - (0) if successful. 1126d1bd2897SJay Ding * - (-EINVAL) on failure. 1127d1bd2897SJay Ding */ 1128d1bd2897SJay Ding int (*tf_dev_get_sram_policy)(enum tf_dir dir, 1129f2c730d4SJay Ding enum tf_sram_bank_id *bank_id); 113019f3ac61SShuanglin Wang 113119f3ac61SShuanglin Wang #ifdef TF_FLOW_SCALE_QUERY 113219f3ac61SShuanglin Wang /** 113319f3ac61SShuanglin Wang * Update resource usage state with firmware 113419f3ac61SShuanglin Wang * 113519f3ac61SShuanglin Wang * [in] tfp 113619f3ac61SShuanglin Wang * Pointer to TF handle 113719f3ac61SShuanglin Wang * 113819f3ac61SShuanglin Wang * [in] dir 113919f3ac61SShuanglin Wang * Receive or transmit direction 114019f3ac61SShuanglin Wang * 114119f3ac61SShuanglin Wang * [in] flow_resc_type 114219f3ac61SShuanglin Wang * Resource type to update its usage state 114319f3ac61SShuanglin Wang * 114419f3ac61SShuanglin Wang * returns: 114519f3ac61SShuanglin Wang * 0 - Success 114619f3ac61SShuanglin Wang * -EINVAL - Error 114719f3ac61SShuanglin Wang */ 114819f3ac61SShuanglin Wang int (*tf_dev_update_resc_usage)(struct tf *tfp, 114919f3ac61SShuanglin Wang enum tf_dir dir, 115019f3ac61SShuanglin Wang enum tf_flow_resc_type flow_resc_type); 115119f3ac61SShuanglin Wang 115219f3ac61SShuanglin Wang /** 115319f3ac61SShuanglin Wang * Query resource usage state from firmware 115419f3ac61SShuanglin Wang * 115519f3ac61SShuanglin Wang * [in] tfp 115619f3ac61SShuanglin Wang * Pointer to TF handle 115719f3ac61SShuanglin Wang * 115819f3ac61SShuanglin Wang * [in] dir 115919f3ac61SShuanglin Wang * Receive or transmit direction 116019f3ac61SShuanglin Wang * 116119f3ac61SShuanglin Wang * [in] flow_resc_type 116219f3ac61SShuanglin Wang * Resource type to query its usage state 116319f3ac61SShuanglin Wang * 116419f3ac61SShuanglin Wang * returns: 116519f3ac61SShuanglin Wang * 0 - Success 116619f3ac61SShuanglin Wang * -EINVAL - Error 116719f3ac61SShuanglin Wang */ 116819f3ac61SShuanglin Wang int (*tf_dev_query_resc_usage)(struct tf *tfp, 116919f3ac61SShuanglin Wang struct tf_query_resc_usage_parms *parms); 117019f3ac61SShuanglin Wang 117119f3ac61SShuanglin Wang /** 117219f3ac61SShuanglin Wang * Update buffer of table usage 117319f3ac61SShuanglin Wang * 117419f3ac61SShuanglin Wang * [in] session_id 117519f3ac61SShuanglin Wang * The TruFlow session id 117619f3ac61SShuanglin Wang * 117719f3ac61SShuanglin Wang * [in] dir 117819f3ac61SShuanglin Wang * Receive or transmit direction 117919f3ac61SShuanglin Wang * 118019f3ac61SShuanglin Wang * [in] tbl_type 118119f3ac61SShuanglin Wang * SRAM table type to update its usage state 118219f3ac61SShuanglin Wang * 118319f3ac61SShuanglin Wang * [in] resc_opt 118419f3ac61SShuanglin Wang * Alloca or free resource 118519f3ac61SShuanglin Wang * 118619f3ac61SShuanglin Wang * returns: 118719f3ac61SShuanglin Wang * 0 - Success 118819f3ac61SShuanglin Wang * -EINVAL - Error 118919f3ac61SShuanglin Wang */ 1190*580fcb3dSRandy Schacher int (*tf_dev_update_tbl_usage_buffer)(struct tf *tfp, 119119f3ac61SShuanglin Wang enum tf_dir dir, 119219f3ac61SShuanglin Wang enum tf_tbl_type tbl_type, 119319f3ac61SShuanglin Wang uint32_t resc_opt); 119419f3ac61SShuanglin Wang #endif /* TF_FLOW_SCALE_QUERY */ 11958187694bSMichael Wildt }; 11968187694bSMichael Wildt 11978187694bSMichael Wildt /** 11988187694bSMichael Wildt * Supported device operation structures 11998187694bSMichael Wildt */ 120048d3dff2SMichael Wildt extern const struct tf_dev_ops tf_dev_ops_p4_init; 12018187694bSMichael Wildt extern const struct tf_dev_ops tf_dev_ops_p4; 12026c9aff87SFarah Smith extern const struct tf_dev_ops tf_dev_ops_p58_init; 12036c9aff87SFarah Smith extern const struct tf_dev_ops tf_dev_ops_p58; 12048187694bSMichael Wildt 1205588e333eSJay Ding /** 1206588e333eSJay Ding * Supported device resource type mapping structures 1207588e333eSJay Ding */ 1208588e333eSJay Ding extern const struct tf_hcapi_resource_map tf_hcapi_res_map_p4[CFA_RESOURCE_TYPE_P4_LAST + 1]; 1209588e333eSJay Ding extern const struct tf_hcapi_resource_map tf_hcapi_res_map_p58[CFA_RESOURCE_TYPE_P58_LAST + 1]; 12108187694bSMichael Wildt #endif /* _TF_DEVICE_H_ */ 1211