18923de59SPiotr Kubaj /* SPDX-License-Identifier: BSD-3-Clause */ 2015f8cc5SEric Joyner /* Copyright (c) 2024, Intel Corporation 38923de59SPiotr Kubaj * All rights reserved. 48923de59SPiotr Kubaj * 58923de59SPiotr Kubaj * Redistribution and use in source and binary forms, with or without 68923de59SPiotr Kubaj * modification, are permitted provided that the following conditions are met: 78923de59SPiotr Kubaj * 88923de59SPiotr Kubaj * 1. Redistributions of source code must retain the above copyright notice, 98923de59SPiotr Kubaj * this list of conditions and the following disclaimer. 108923de59SPiotr Kubaj * 118923de59SPiotr Kubaj * 2. Redistributions in binary form must reproduce the above copyright 128923de59SPiotr Kubaj * notice, this list of conditions and the following disclaimer in the 138923de59SPiotr Kubaj * documentation and/or other materials provided with the distribution. 148923de59SPiotr Kubaj * 158923de59SPiotr Kubaj * 3. Neither the name of the Intel Corporation nor the names of its 168923de59SPiotr Kubaj * contributors may be used to endorse or promote products derived from 178923de59SPiotr Kubaj * this software without specific prior written permission. 188923de59SPiotr Kubaj * 198923de59SPiotr Kubaj * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 208923de59SPiotr Kubaj * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 218923de59SPiotr Kubaj * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 228923de59SPiotr Kubaj * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 238923de59SPiotr Kubaj * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 248923de59SPiotr Kubaj * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 258923de59SPiotr Kubaj * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 268923de59SPiotr Kubaj * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 278923de59SPiotr Kubaj * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 288923de59SPiotr Kubaj * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 298923de59SPiotr Kubaj * POSSIBILITY OF SUCH DAMAGE. 308923de59SPiotr Kubaj */ 318923de59SPiotr Kubaj 329dc2f6e2SEric Joyner #ifndef _ICE_DDP_COMMON_H_ 339dc2f6e2SEric Joyner #define _ICE_DDP_COMMON_H_ 348923de59SPiotr Kubaj 358923de59SPiotr Kubaj #include "ice_osdep.h" 368923de59SPiotr Kubaj #include "ice_adminq_cmd.h" 378923de59SPiotr Kubaj #include "ice_controlq.h" 388923de59SPiotr Kubaj #include "ice_status.h" 398923de59SPiotr Kubaj #include "ice_flex_type.h" 408923de59SPiotr Kubaj #include "ice_protocol_type.h" 418923de59SPiotr Kubaj 428923de59SPiotr Kubaj /* Package minimal version supported */ 438923de59SPiotr Kubaj #define ICE_PKG_SUPP_VER_MAJ 1 448923de59SPiotr Kubaj #define ICE_PKG_SUPP_VER_MNR 3 458923de59SPiotr Kubaj 468923de59SPiotr Kubaj /* Package format version */ 478923de59SPiotr Kubaj #define ICE_PKG_FMT_VER_MAJ 1 488923de59SPiotr Kubaj #define ICE_PKG_FMT_VER_MNR 0 498923de59SPiotr Kubaj #define ICE_PKG_FMT_VER_UPD 0 508923de59SPiotr Kubaj #define ICE_PKG_FMT_VER_DFT 0 518923de59SPiotr Kubaj 528923de59SPiotr Kubaj #define ICE_PKG_CNT 4 538923de59SPiotr Kubaj 548923de59SPiotr Kubaj enum ice_ddp_state { 558923de59SPiotr Kubaj /* Indicates that this call to ice_init_pkg 568923de59SPiotr Kubaj * successfully loaded the requested DDP package 578923de59SPiotr Kubaj */ 588923de59SPiotr Kubaj ICE_DDP_PKG_SUCCESS = 0, 598923de59SPiotr Kubaj 608923de59SPiotr Kubaj /* Generic error for already loaded errors, it is mapped later to 618923de59SPiotr Kubaj * the more specific one (one of the next 3) 628923de59SPiotr Kubaj */ 638923de59SPiotr Kubaj ICE_DDP_PKG_ALREADY_LOADED = -1, 648923de59SPiotr Kubaj 658923de59SPiotr Kubaj /* Indicates that a DDP package of the same version has already been 668923de59SPiotr Kubaj * loaded onto the device by a previous call or by another PF 678923de59SPiotr Kubaj */ 688923de59SPiotr Kubaj ICE_DDP_PKG_SAME_VERSION_ALREADY_LOADED = -2, 698923de59SPiotr Kubaj 708923de59SPiotr Kubaj /* The device has a DDP package that is not supported by the driver */ 718923de59SPiotr Kubaj ICE_DDP_PKG_ALREADY_LOADED_NOT_SUPPORTED = -3, 728923de59SPiotr Kubaj 738923de59SPiotr Kubaj /* The device has a compatible package 748923de59SPiotr Kubaj * (but different from the request) already loaded 758923de59SPiotr Kubaj */ 768923de59SPiotr Kubaj ICE_DDP_PKG_COMPATIBLE_ALREADY_LOADED = -4, 778923de59SPiotr Kubaj 788923de59SPiotr Kubaj /* The firmware loaded on the device is not compatible with 798923de59SPiotr Kubaj * the DDP package loaded 808923de59SPiotr Kubaj */ 818923de59SPiotr Kubaj ICE_DDP_PKG_FW_MISMATCH = -5, 828923de59SPiotr Kubaj 838923de59SPiotr Kubaj /* The DDP package file is invalid */ 848923de59SPiotr Kubaj ICE_DDP_PKG_INVALID_FILE = -6, 858923de59SPiotr Kubaj 868923de59SPiotr Kubaj /* The version of the DDP package provided is higher than 878923de59SPiotr Kubaj * the driver supports 888923de59SPiotr Kubaj */ 898923de59SPiotr Kubaj ICE_DDP_PKG_FILE_VERSION_TOO_HIGH = -7, 908923de59SPiotr Kubaj 918923de59SPiotr Kubaj /* The version of the DDP package provided is lower than the 928923de59SPiotr Kubaj * driver supports 938923de59SPiotr Kubaj */ 948923de59SPiotr Kubaj ICE_DDP_PKG_FILE_VERSION_TOO_LOW = -8, 958923de59SPiotr Kubaj 968923de59SPiotr Kubaj /* Missing security manifest in DDP pkg */ 978923de59SPiotr Kubaj ICE_DDP_PKG_NO_SEC_MANIFEST = -9, 988923de59SPiotr Kubaj 998923de59SPiotr Kubaj /* The RSA signature of the DDP package file provided is invalid */ 1008923de59SPiotr Kubaj ICE_DDP_PKG_FILE_SIGNATURE_INVALID = -10, 1018923de59SPiotr Kubaj 1028923de59SPiotr Kubaj /* The DDP package file security revision is too low and not 1038923de59SPiotr Kubaj * supported by firmware 1048923de59SPiotr Kubaj */ 1058923de59SPiotr Kubaj ICE_DDP_PKG_SECURE_VERSION_NBR_TOO_LOW = -11, 1068923de59SPiotr Kubaj 1078923de59SPiotr Kubaj /* Manifest hash mismatch */ 1088923de59SPiotr Kubaj ICE_DDP_PKG_MANIFEST_INVALID = -12, 1098923de59SPiotr Kubaj 1108923de59SPiotr Kubaj /* Buffer hash mismatches manifest */ 1118923de59SPiotr Kubaj ICE_DDP_PKG_BUFFER_INVALID = -13, 1128923de59SPiotr Kubaj 1138923de59SPiotr Kubaj /* Other errors */ 1148923de59SPiotr Kubaj ICE_DDP_PKG_ERR = -14, 1158923de59SPiotr Kubaj }; 1168923de59SPiotr Kubaj 1178923de59SPiotr Kubaj /* Package and segment headers and tables */ 1188923de59SPiotr Kubaj struct ice_pkg_hdr { 1198923de59SPiotr Kubaj struct ice_pkg_ver pkg_format_ver; 1208923de59SPiotr Kubaj __le32 seg_count; 1218923de59SPiotr Kubaj __le32 seg_offset[STRUCT_HACK_VAR_LEN]; 1228923de59SPiotr Kubaj }; 1238923de59SPiotr Kubaj 1248923de59SPiotr Kubaj /* Package signing algorithm types */ 1258923de59SPiotr Kubaj #define SEGMENT_SIGN_TYPE_INVALID 0x00000000 1268923de59SPiotr Kubaj #define SEGMENT_SIGN_TYPE_RSA2K 0x00000001 1278923de59SPiotr Kubaj #define SEGMENT_SIGN_TYPE_RSA3K 0x00000002 1288923de59SPiotr Kubaj #define SEGMENT_SIGN_TYPE_RSA3K_SBB 0x00000003 /* Secure Boot Block */ 1299c30461dSEric Joyner #define SEGMENT_SIGN_TYPE_RSA3K_E825 0x00000005 1308923de59SPiotr Kubaj 1318923de59SPiotr Kubaj /* generic segment */ 1328923de59SPiotr Kubaj struct ice_generic_seg_hdr { 1338923de59SPiotr Kubaj #define SEGMENT_TYPE_INVALID 0x00000000 1348923de59SPiotr Kubaj #define SEGMENT_TYPE_METADATA 0x00000001 1358923de59SPiotr Kubaj #define SEGMENT_TYPE_ICE_E810 0x00000010 1368923de59SPiotr Kubaj #define SEGMENT_TYPE_SIGNING 0x00001001 137f2635e84SEric Joyner #define SEGMENT_TYPE_ICE_E830 0x00000017 1388923de59SPiotr Kubaj #define SEGMENT_TYPE_ICE_RUN_TIME_CFG 0x00000020 1398923de59SPiotr Kubaj __le32 seg_type; 1408923de59SPiotr Kubaj struct ice_pkg_ver seg_format_ver; 1418923de59SPiotr Kubaj __le32 seg_size; 1428923de59SPiotr Kubaj char seg_id[ICE_PKG_NAME_SIZE]; 1438923de59SPiotr Kubaj }; 1448923de59SPiotr Kubaj 1458923de59SPiotr Kubaj /* ice specific segment */ 1468923de59SPiotr Kubaj 1478923de59SPiotr Kubaj union ice_device_id { 1488923de59SPiotr Kubaj struct { 1498923de59SPiotr Kubaj __le16 device_id; 1508923de59SPiotr Kubaj __le16 vendor_id; 1518923de59SPiotr Kubaj } dev_vend_id; 1528923de59SPiotr Kubaj __le32 id; 1538923de59SPiotr Kubaj }; 1548923de59SPiotr Kubaj 1558923de59SPiotr Kubaj struct ice_device_id_entry { 1568923de59SPiotr Kubaj union ice_device_id device; 1578923de59SPiotr Kubaj union ice_device_id sub_device; 1588923de59SPiotr Kubaj }; 1598923de59SPiotr Kubaj 1608923de59SPiotr Kubaj struct ice_seg { 1618923de59SPiotr Kubaj struct ice_generic_seg_hdr hdr; 1628923de59SPiotr Kubaj __le32 device_table_count; 1638923de59SPiotr Kubaj struct ice_device_id_entry device_table[STRUCT_HACK_VAR_LEN]; 1648923de59SPiotr Kubaj }; 1658923de59SPiotr Kubaj 1668923de59SPiotr Kubaj struct ice_nvm_table { 1678923de59SPiotr Kubaj __le32 table_count; 1688923de59SPiotr Kubaj __le32 vers[STRUCT_HACK_VAR_LEN]; 1698923de59SPiotr Kubaj }; 1708923de59SPiotr Kubaj 1718923de59SPiotr Kubaj struct ice_buf { 1728923de59SPiotr Kubaj #define ICE_PKG_BUF_SIZE 4096 1738923de59SPiotr Kubaj u8 buf[ICE_PKG_BUF_SIZE]; 1748923de59SPiotr Kubaj }; 1758923de59SPiotr Kubaj 1768923de59SPiotr Kubaj struct ice_buf_table { 1778923de59SPiotr Kubaj __le32 buf_count; 1788923de59SPiotr Kubaj struct ice_buf buf_array[STRUCT_HACK_VAR_LEN]; 1798923de59SPiotr Kubaj }; 1808923de59SPiotr Kubaj 1818923de59SPiotr Kubaj struct ice_run_time_cfg_seg { 1828923de59SPiotr Kubaj struct ice_generic_seg_hdr hdr; 1838923de59SPiotr Kubaj u8 rsvd[8]; 1848923de59SPiotr Kubaj struct ice_buf_table buf_table; 1858923de59SPiotr Kubaj }; 1868923de59SPiotr Kubaj 1878923de59SPiotr Kubaj /* global metadata specific segment */ 1888923de59SPiotr Kubaj struct ice_global_metadata_seg { 1898923de59SPiotr Kubaj struct ice_generic_seg_hdr hdr; 1908923de59SPiotr Kubaj struct ice_pkg_ver pkg_ver; 1918923de59SPiotr Kubaj __le32 rsvd; 1928923de59SPiotr Kubaj char pkg_name[ICE_PKG_NAME_SIZE]; 1938923de59SPiotr Kubaj }; 1948923de59SPiotr Kubaj 1958923de59SPiotr Kubaj #define ICE_MIN_S_OFF 12 1968923de59SPiotr Kubaj #define ICE_MAX_S_OFF 4095 1978923de59SPiotr Kubaj #define ICE_MIN_S_SZ 1 1988923de59SPiotr Kubaj #define ICE_MAX_S_SZ 4084 1998923de59SPiotr Kubaj 2008923de59SPiotr Kubaj struct ice_sign_seg { 2018923de59SPiotr Kubaj struct ice_generic_seg_hdr hdr; 2028923de59SPiotr Kubaj __le32 seg_id; 2038923de59SPiotr Kubaj __le32 sign_type; 2048923de59SPiotr Kubaj __le32 signed_seg_idx; 2058923de59SPiotr Kubaj __le32 signed_buf_start; 2068923de59SPiotr Kubaj __le32 signed_buf_count; 207*440addc6SEric Joyner #define ICE_SIGN_SEG_FLAGS_VALID 0x80000000 208*440addc6SEric Joyner #define ICE_SIGN_SEG_FLAGS_LAST 0x00000001 209*440addc6SEric Joyner __le32 flags; 210*440addc6SEric Joyner #define ICE_SIGN_SEG_RESERVED_COUNT 40 2118923de59SPiotr Kubaj u8 reserved[ICE_SIGN_SEG_RESERVED_COUNT]; 2128923de59SPiotr Kubaj struct ice_buf_table buf_tbl; 2138923de59SPiotr Kubaj }; 2148923de59SPiotr Kubaj 2158923de59SPiotr Kubaj /* section information */ 2168923de59SPiotr Kubaj struct ice_section_entry { 2178923de59SPiotr Kubaj __le32 type; 2188923de59SPiotr Kubaj __le16 offset; 2198923de59SPiotr Kubaj __le16 size; 2208923de59SPiotr Kubaj }; 2218923de59SPiotr Kubaj 2228923de59SPiotr Kubaj #define ICE_MIN_S_COUNT 1 2238923de59SPiotr Kubaj #define ICE_MAX_S_COUNT 511 2248923de59SPiotr Kubaj #define ICE_MIN_S_DATA_END 12 2258923de59SPiotr Kubaj #define ICE_MAX_S_DATA_END 4096 2268923de59SPiotr Kubaj 2278923de59SPiotr Kubaj #define ICE_METADATA_BUF 0x80000000 2288923de59SPiotr Kubaj 2298923de59SPiotr Kubaj struct ice_buf_hdr { 2308923de59SPiotr Kubaj __le16 section_count; 2318923de59SPiotr Kubaj __le16 data_end; 2328923de59SPiotr Kubaj struct ice_section_entry section_entry[STRUCT_HACK_VAR_LEN]; 2338923de59SPiotr Kubaj }; 2348923de59SPiotr Kubaj 2358923de59SPiotr Kubaj #define ICE_MAX_ENTRIES_IN_BUF(hd_sz, ent_sz) ((ICE_PKG_BUF_SIZE - \ 2368923de59SPiotr Kubaj ice_struct_size((struct ice_buf_hdr *)0, section_entry, 1) - (hd_sz)) /\ 2378923de59SPiotr Kubaj (ent_sz)) 2388923de59SPiotr Kubaj 2398923de59SPiotr Kubaj /* ice package section IDs */ 2408923de59SPiotr Kubaj #define ICE_SID_METADATA 1 2418923de59SPiotr Kubaj #define ICE_SID_XLT0_SW 10 2428923de59SPiotr Kubaj #define ICE_SID_XLT_KEY_BUILDER_SW 11 2438923de59SPiotr Kubaj #define ICE_SID_XLT1_SW 12 2448923de59SPiotr Kubaj #define ICE_SID_XLT2_SW 13 2458923de59SPiotr Kubaj #define ICE_SID_PROFID_TCAM_SW 14 2468923de59SPiotr Kubaj #define ICE_SID_PROFID_REDIR_SW 15 2478923de59SPiotr Kubaj #define ICE_SID_FLD_VEC_SW 16 2488923de59SPiotr Kubaj #define ICE_SID_CDID_KEY_BUILDER_SW 17 2498923de59SPiotr Kubaj #define ICE_SID_CDID_REDIR_SW 18 2508923de59SPiotr Kubaj 2518923de59SPiotr Kubaj #define ICE_SID_XLT0_ACL 20 2528923de59SPiotr Kubaj #define ICE_SID_XLT_KEY_BUILDER_ACL 21 2538923de59SPiotr Kubaj #define ICE_SID_XLT1_ACL 22 2548923de59SPiotr Kubaj #define ICE_SID_XLT2_ACL 23 2558923de59SPiotr Kubaj #define ICE_SID_PROFID_TCAM_ACL 24 2568923de59SPiotr Kubaj #define ICE_SID_PROFID_REDIR_ACL 25 2578923de59SPiotr Kubaj #define ICE_SID_FLD_VEC_ACL 26 2588923de59SPiotr Kubaj #define ICE_SID_CDID_KEY_BUILDER_ACL 27 2598923de59SPiotr Kubaj #define ICE_SID_CDID_REDIR_ACL 28 2608923de59SPiotr Kubaj 2618923de59SPiotr Kubaj #define ICE_SID_XLT0_FD 30 2628923de59SPiotr Kubaj #define ICE_SID_XLT_KEY_BUILDER_FD 31 2638923de59SPiotr Kubaj #define ICE_SID_XLT1_FD 32 2648923de59SPiotr Kubaj #define ICE_SID_XLT2_FD 33 2658923de59SPiotr Kubaj #define ICE_SID_PROFID_TCAM_FD 34 2668923de59SPiotr Kubaj #define ICE_SID_PROFID_REDIR_FD 35 2678923de59SPiotr Kubaj #define ICE_SID_FLD_VEC_FD 36 2688923de59SPiotr Kubaj #define ICE_SID_CDID_KEY_BUILDER_FD 37 2698923de59SPiotr Kubaj #define ICE_SID_CDID_REDIR_FD 38 2708923de59SPiotr Kubaj 2718923de59SPiotr Kubaj #define ICE_SID_XLT0_RSS 40 2728923de59SPiotr Kubaj #define ICE_SID_XLT_KEY_BUILDER_RSS 41 2738923de59SPiotr Kubaj #define ICE_SID_XLT1_RSS 42 2748923de59SPiotr Kubaj #define ICE_SID_XLT2_RSS 43 2758923de59SPiotr Kubaj #define ICE_SID_PROFID_TCAM_RSS 44 2768923de59SPiotr Kubaj #define ICE_SID_PROFID_REDIR_RSS 45 2778923de59SPiotr Kubaj #define ICE_SID_FLD_VEC_RSS 46 2788923de59SPiotr Kubaj #define ICE_SID_CDID_KEY_BUILDER_RSS 47 2798923de59SPiotr Kubaj #define ICE_SID_CDID_REDIR_RSS 48 2808923de59SPiotr Kubaj 2818923de59SPiotr Kubaj #define ICE_SID_RXPARSER_CAM 50 2828923de59SPiotr Kubaj #define ICE_SID_RXPARSER_NOMATCH_CAM 51 2838923de59SPiotr Kubaj #define ICE_SID_RXPARSER_IMEM 52 2848923de59SPiotr Kubaj #define ICE_SID_RXPARSER_XLT0_BUILDER 53 2858923de59SPiotr Kubaj #define ICE_SID_RXPARSER_NODE_PTYPE 54 2868923de59SPiotr Kubaj #define ICE_SID_RXPARSER_MARKER_PTYPE 55 2878923de59SPiotr Kubaj #define ICE_SID_RXPARSER_BOOST_TCAM 56 2888923de59SPiotr Kubaj #define ICE_SID_RXPARSER_PROTO_GRP 57 2898923de59SPiotr Kubaj #define ICE_SID_RXPARSER_METADATA_INIT 58 2908923de59SPiotr Kubaj #define ICE_SID_RXPARSER_XLT0 59 2918923de59SPiotr Kubaj 2928923de59SPiotr Kubaj #define ICE_SID_TXPARSER_CAM 60 2938923de59SPiotr Kubaj #define ICE_SID_TXPARSER_NOMATCH_CAM 61 2948923de59SPiotr Kubaj #define ICE_SID_TXPARSER_IMEM 62 2958923de59SPiotr Kubaj #define ICE_SID_TXPARSER_XLT0_BUILDER 63 2968923de59SPiotr Kubaj #define ICE_SID_TXPARSER_NODE_PTYPE 64 2978923de59SPiotr Kubaj #define ICE_SID_TXPARSER_MARKER_PTYPE 65 2988923de59SPiotr Kubaj #define ICE_SID_TXPARSER_BOOST_TCAM 66 2998923de59SPiotr Kubaj #define ICE_SID_TXPARSER_PROTO_GRP 67 3008923de59SPiotr Kubaj #define ICE_SID_TXPARSER_METADATA_INIT 68 3018923de59SPiotr Kubaj #define ICE_SID_TXPARSER_XLT0 69 3028923de59SPiotr Kubaj 3038923de59SPiotr Kubaj #define ICE_SID_RXPARSER_INIT_REDIR 70 3048923de59SPiotr Kubaj #define ICE_SID_TXPARSER_INIT_REDIR 71 3058923de59SPiotr Kubaj #define ICE_SID_RXPARSER_MARKER_GRP 72 3068923de59SPiotr Kubaj #define ICE_SID_TXPARSER_MARKER_GRP 73 3078923de59SPiotr Kubaj #define ICE_SID_RXPARSER_LAST_PROTO 74 3088923de59SPiotr Kubaj #define ICE_SID_TXPARSER_LAST_PROTO 75 3098923de59SPiotr Kubaj #define ICE_SID_RXPARSER_PG_SPILL 76 3108923de59SPiotr Kubaj #define ICE_SID_TXPARSER_PG_SPILL 77 3118923de59SPiotr Kubaj #define ICE_SID_RXPARSER_NOMATCH_SPILL 78 3128923de59SPiotr Kubaj #define ICE_SID_TXPARSER_NOMATCH_SPILL 79 3138923de59SPiotr Kubaj 3148923de59SPiotr Kubaj #define ICE_SID_XLT0_PE 80 3158923de59SPiotr Kubaj #define ICE_SID_XLT_KEY_BUILDER_PE 81 3168923de59SPiotr Kubaj #define ICE_SID_XLT1_PE 82 3178923de59SPiotr Kubaj #define ICE_SID_XLT2_PE 83 3188923de59SPiotr Kubaj #define ICE_SID_PROFID_TCAM_PE 84 3198923de59SPiotr Kubaj #define ICE_SID_PROFID_REDIR_PE 85 3208923de59SPiotr Kubaj #define ICE_SID_FLD_VEC_PE 86 3218923de59SPiotr Kubaj #define ICE_SID_CDID_KEY_BUILDER_PE 87 3228923de59SPiotr Kubaj #define ICE_SID_CDID_REDIR_PE 88 3238923de59SPiotr Kubaj 3248923de59SPiotr Kubaj #define ICE_SID_RXPARSER_FLAG_REDIR 97 3258923de59SPiotr Kubaj 3268923de59SPiotr Kubaj /* Label Metadata section IDs */ 3278923de59SPiotr Kubaj #define ICE_SID_LBL_FIRST 0x80000010 3288923de59SPiotr Kubaj #define ICE_SID_LBL_RXPARSER_IMEM 0x80000010 3298923de59SPiotr Kubaj #define ICE_SID_LBL_TXPARSER_IMEM 0x80000011 3308923de59SPiotr Kubaj #define ICE_SID_LBL_RESERVED_12 0x80000012 3318923de59SPiotr Kubaj #define ICE_SID_LBL_RESERVED_13 0x80000013 3328923de59SPiotr Kubaj #define ICE_SID_LBL_RXPARSER_MARKER 0x80000014 3338923de59SPiotr Kubaj #define ICE_SID_LBL_TXPARSER_MARKER 0x80000015 3348923de59SPiotr Kubaj #define ICE_SID_LBL_PTYPE 0x80000016 3358923de59SPiotr Kubaj #define ICE_SID_LBL_PROTOCOL_ID 0x80000017 3368923de59SPiotr Kubaj #define ICE_SID_LBL_RXPARSER_TMEM 0x80000018 3378923de59SPiotr Kubaj #define ICE_SID_LBL_TXPARSER_TMEM 0x80000019 3388923de59SPiotr Kubaj #define ICE_SID_LBL_RXPARSER_PG 0x8000001A 3398923de59SPiotr Kubaj #define ICE_SID_LBL_TXPARSER_PG 0x8000001B 3408923de59SPiotr Kubaj #define ICE_SID_LBL_RXPARSER_M_TCAM 0x8000001C 3418923de59SPiotr Kubaj #define ICE_SID_LBL_TXPARSER_M_TCAM 0x8000001D 3428923de59SPiotr Kubaj #define ICE_SID_LBL_SW_PROFID_TCAM 0x8000001E 3438923de59SPiotr Kubaj #define ICE_SID_LBL_ACL_PROFID_TCAM 0x8000001F 3448923de59SPiotr Kubaj #define ICE_SID_LBL_PE_PROFID_TCAM 0x80000020 3458923de59SPiotr Kubaj #define ICE_SID_LBL_RSS_PROFID_TCAM 0x80000021 3468923de59SPiotr Kubaj #define ICE_SID_LBL_FD_PROFID_TCAM 0x80000022 3478923de59SPiotr Kubaj #define ICE_SID_LBL_FLAG 0x80000023 3488923de59SPiotr Kubaj #define ICE_SID_LBL_REG 0x80000024 3498923de59SPiotr Kubaj #define ICE_SID_LBL_SW_PTG 0x80000025 3508923de59SPiotr Kubaj #define ICE_SID_LBL_ACL_PTG 0x80000026 3518923de59SPiotr Kubaj #define ICE_SID_LBL_PE_PTG 0x80000027 3528923de59SPiotr Kubaj #define ICE_SID_LBL_RSS_PTG 0x80000028 3538923de59SPiotr Kubaj #define ICE_SID_LBL_FD_PTG 0x80000029 3548923de59SPiotr Kubaj #define ICE_SID_LBL_SW_VSIG 0x8000002A 3558923de59SPiotr Kubaj #define ICE_SID_LBL_ACL_VSIG 0x8000002B 3568923de59SPiotr Kubaj #define ICE_SID_LBL_PE_VSIG 0x8000002C 3578923de59SPiotr Kubaj #define ICE_SID_LBL_RSS_VSIG 0x8000002D 3588923de59SPiotr Kubaj #define ICE_SID_LBL_FD_VSIG 0x8000002E 3598923de59SPiotr Kubaj #define ICE_SID_LBL_PTYPE_META 0x8000002F 3608923de59SPiotr Kubaj #define ICE_SID_LBL_SW_PROFID 0x80000030 3618923de59SPiotr Kubaj #define ICE_SID_LBL_ACL_PROFID 0x80000031 3628923de59SPiotr Kubaj #define ICE_SID_LBL_PE_PROFID 0x80000032 3638923de59SPiotr Kubaj #define ICE_SID_LBL_RSS_PROFID 0x80000033 3648923de59SPiotr Kubaj #define ICE_SID_LBL_FD_PROFID 0x80000034 3658923de59SPiotr Kubaj #define ICE_SID_LBL_RXPARSER_MARKER_GRP 0x80000035 3668923de59SPiotr Kubaj #define ICE_SID_LBL_TXPARSER_MARKER_GRP 0x80000036 3678923de59SPiotr Kubaj #define ICE_SID_LBL_RXPARSER_PROTO 0x80000037 3688923de59SPiotr Kubaj #define ICE_SID_LBL_TXPARSER_PROTO 0x80000038 3698923de59SPiotr Kubaj /* The following define MUST be updated to reflect the last label section ID */ 3708923de59SPiotr Kubaj #define ICE_SID_LBL_LAST 0x80000038 3718923de59SPiotr Kubaj 3728923de59SPiotr Kubaj /* Label ICE runtime configuration section IDs */ 3738923de59SPiotr Kubaj #define ICE_SID_TX_5_LAYER_TOPO 0x10 3748923de59SPiotr Kubaj 3758923de59SPiotr Kubaj enum ice_block { 3768923de59SPiotr Kubaj ICE_BLK_SW = 0, 3778923de59SPiotr Kubaj ICE_BLK_ACL, 3788923de59SPiotr Kubaj ICE_BLK_FD, 3798923de59SPiotr Kubaj ICE_BLK_RSS, 3808923de59SPiotr Kubaj ICE_BLK_PE, 3818923de59SPiotr Kubaj ICE_BLK_COUNT 3828923de59SPiotr Kubaj }; 3838923de59SPiotr Kubaj 3848923de59SPiotr Kubaj enum ice_sect { 3858923de59SPiotr Kubaj ICE_XLT0 = 0, 3868923de59SPiotr Kubaj ICE_XLT_KB, 3878923de59SPiotr Kubaj ICE_XLT1, 3888923de59SPiotr Kubaj ICE_XLT2, 3898923de59SPiotr Kubaj ICE_PROF_TCAM, 3908923de59SPiotr Kubaj ICE_PROF_REDIR, 3918923de59SPiotr Kubaj ICE_VEC_TBL, 3928923de59SPiotr Kubaj ICE_CDID_KB, 3938923de59SPiotr Kubaj ICE_CDID_REDIR, 3948923de59SPiotr Kubaj ICE_SECT_COUNT 3958923de59SPiotr Kubaj }; 3968923de59SPiotr Kubaj 3978923de59SPiotr Kubaj /* package buffer building */ 3988923de59SPiotr Kubaj 3998923de59SPiotr Kubaj struct ice_buf_build { 4008923de59SPiotr Kubaj struct ice_buf buf; 4018923de59SPiotr Kubaj u16 reserved_section_table_entries; 4028923de59SPiotr Kubaj }; 4038923de59SPiotr Kubaj 4048923de59SPiotr Kubaj struct ice_pkg_enum { 4058923de59SPiotr Kubaj struct ice_buf_table *buf_table; 4068923de59SPiotr Kubaj u32 buf_idx; 4078923de59SPiotr Kubaj 4088923de59SPiotr Kubaj u32 type; 4098923de59SPiotr Kubaj struct ice_buf_hdr *buf; 4108923de59SPiotr Kubaj u32 sect_idx; 4118923de59SPiotr Kubaj void *sect; 4128923de59SPiotr Kubaj u32 sect_type; 4138923de59SPiotr Kubaj 4148923de59SPiotr Kubaj u32 entry_idx; 4158923de59SPiotr Kubaj void *(*handler)(u32 sect_type, void *section, u32 index, u32 *offset); 4168923de59SPiotr Kubaj }; 4178923de59SPiotr Kubaj 4188923de59SPiotr Kubaj struct ice_hw; 4198923de59SPiotr Kubaj 420f2635e84SEric Joyner int 4218923de59SPiotr Kubaj ice_acquire_change_lock(struct ice_hw *hw, enum ice_aq_res_access_type access); 4228923de59SPiotr Kubaj void ice_release_change_lock(struct ice_hw *hw); 4238923de59SPiotr Kubaj 4248923de59SPiotr Kubaj struct ice_buf_build *ice_pkg_buf_alloc(struct ice_hw *hw); 4258923de59SPiotr Kubaj void * 4268923de59SPiotr Kubaj ice_pkg_buf_alloc_section(struct ice_buf_build *bld, u32 type, u16 size); 427f2635e84SEric Joyner int 4288923de59SPiotr Kubaj ice_pkg_buf_reserve_section(struct ice_buf_build *bld, u16 count); 429f2635e84SEric Joyner int 4308923de59SPiotr Kubaj ice_get_sw_fv_list(struct ice_hw *hw, struct ice_prot_lkup_ext *lkups, 4318923de59SPiotr Kubaj ice_bitmap_t *bm, struct LIST_HEAD_TYPE *fv_list); 432f2635e84SEric Joyner int 4338923de59SPiotr Kubaj ice_pkg_buf_unreserve_section(struct ice_buf_build *bld, u16 count); 4348923de59SPiotr Kubaj u16 ice_pkg_buf_get_free_space(struct ice_buf_build *bld); 4358923de59SPiotr Kubaj u16 ice_pkg_buf_get_active_sections(struct ice_buf_build *bld); 4368923de59SPiotr Kubaj 437f2635e84SEric Joyner int 4388923de59SPiotr Kubaj ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count); 439f2635e84SEric Joyner int 4408923de59SPiotr Kubaj ice_update_pkg_no_lock(struct ice_hw *hw, struct ice_buf *bufs, u32 count); 4418923de59SPiotr Kubaj void ice_release_global_cfg_lock(struct ice_hw *hw); 4428923de59SPiotr Kubaj struct ice_generic_seg_hdr * 4438923de59SPiotr Kubaj ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type, 4448923de59SPiotr Kubaj struct ice_pkg_hdr *pkg_hdr); 4458923de59SPiotr Kubaj enum ice_ddp_state 4468923de59SPiotr Kubaj ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len); 4478923de59SPiotr Kubaj enum ice_ddp_state 4488923de59SPiotr Kubaj ice_get_pkg_info(struct ice_hw *hw); 4498923de59SPiotr Kubaj void ice_init_pkg_hints(struct ice_hw *hw, struct ice_seg *ice_seg); 4508923de59SPiotr Kubaj struct ice_buf_table *ice_find_buf_table(struct ice_seg *ice_seg); 451f2635e84SEric Joyner int 4528923de59SPiotr Kubaj ice_acquire_global_cfg_lock(struct ice_hw *hw, 4538923de59SPiotr Kubaj enum ice_aq_res_access_type access); 4548923de59SPiotr Kubaj 4558923de59SPiotr Kubaj struct ice_buf_table *ice_find_buf_table(struct ice_seg *ice_seg); 4568923de59SPiotr Kubaj struct ice_buf_hdr * 4578923de59SPiotr Kubaj ice_pkg_enum_buf(struct ice_seg *ice_seg, struct ice_pkg_enum *state); 4588923de59SPiotr Kubaj bool 4598923de59SPiotr Kubaj ice_pkg_advance_sect(struct ice_seg *ice_seg, struct ice_pkg_enum *state); 4608923de59SPiotr Kubaj void * 4618923de59SPiotr Kubaj ice_pkg_enum_entry(struct ice_seg *ice_seg, struct ice_pkg_enum *state, 4628923de59SPiotr Kubaj u32 sect_type, u32 *offset, 4638923de59SPiotr Kubaj void *(*handler)(u32 sect_type, void *section, 4648923de59SPiotr Kubaj u32 index, u32 *offset)); 4658923de59SPiotr Kubaj void * 4668923de59SPiotr Kubaj ice_pkg_enum_section(struct ice_seg *ice_seg, struct ice_pkg_enum *state, 4678923de59SPiotr Kubaj u32 sect_type); 4688923de59SPiotr Kubaj enum ice_ddp_state ice_init_pkg(struct ice_hw *hw, u8 *buff, u32 len); 4698923de59SPiotr Kubaj enum ice_ddp_state 4708923de59SPiotr Kubaj ice_copy_and_init_pkg(struct ice_hw *hw, const u8 *buf, u32 len); 4718923de59SPiotr Kubaj bool ice_is_init_pkg_successful(enum ice_ddp_state state); 4728923de59SPiotr Kubaj void ice_free_seg(struct ice_hw *hw); 4738923de59SPiotr Kubaj 4748923de59SPiotr Kubaj struct ice_buf_build * 4758923de59SPiotr Kubaj ice_pkg_buf_alloc_single_section(struct ice_hw *hw, u32 type, u16 size, 4768923de59SPiotr Kubaj void **section); 4778923de59SPiotr Kubaj struct ice_buf *ice_pkg_buf(struct ice_buf_build *bld); 4788923de59SPiotr Kubaj void ice_pkg_buf_free(struct ice_hw *hw, struct ice_buf_build *bld); 4798923de59SPiotr Kubaj 480f2635e84SEric Joyner int ice_cfg_tx_topo(struct ice_hw *hw, u8 *buf, u32 len); 4818923de59SPiotr Kubaj 482f2635e84SEric Joyner #endif /* _ICE_DDP_H_ */ 483