1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2019 Broadcom 3 * All rights reserved. 4 */ 5 #ifndef _HWRM_TF_H_ 6 #define _HWRM_TF_H_ 7 8 #include "tf_core.h" 9 10 typedef enum tf_type { 11 TF_TYPE_TRUFLOW, 12 TF_TYPE_LAST = TF_TYPE_TRUFLOW, 13 } tf_type_t; 14 15 typedef enum tf_subtype { 16 HWRM_TFT_GET_GLOBAL_CFG = 821, 17 HWRM_TFT_SET_GLOBAL_CFG = 822, 18 HWRM_TFT_TBL_TYPE_BULK_GET = 825, 19 HWRM_TFT_IF_TBL_SET = 827, 20 HWRM_TFT_IF_TBL_GET = 828, 21 TF_SUBTYPE_LAST = HWRM_TFT_IF_TBL_GET, 22 } tf_subtype_t; 23 24 /* Request and Response compile time checking */ 25 /* u32_t tlv_req_value[26]; */ 26 #define TF_MAX_REQ_SIZE 104 27 /* u32_t tlv_resp_value[170]; */ 28 #define TF_MAX_RESP_SIZE 680 29 30 /* Use this to allocate/free any kind of 31 * indexes over HWRM and fill the parms pointer 32 */ 33 #define TF_BULK_RECV 128 34 #define TF_BULK_SEND 16 35 36 /* EM Key value */ 37 #define TF_DEV_DATA_TYPE_TF_EM_RULE_INSERT_KEY_DATA 0x2e30UL 38 /* EM Key value */ 39 #define TF_DEV_DATA_TYPE_TF_EM_RULE_DELETE_KEY_DATA 0x2e40UL 40 /* L2 Context DMA Address Type */ 41 #define TF_DEV_DATA_TYPE_TF_L2_CTX_DMA_ADDR 0x2fe0UL 42 /* L2 Context Entry */ 43 #define TF_DEV_DATA_TYPE_TF_L2_CTX_ENTRY 0x2fe1UL 44 /* Prof tcam DMA Address Type */ 45 #define TF_DEV_DATA_TYPE_TF_PROF_TCAM_DMA_ADDR 0x3030UL 46 /* Prof tcam Entry */ 47 #define TF_DEV_DATA_TYPE_TF_PROF_TCAM_ENTRY 0x3031UL 48 /* WC DMA Address Type */ 49 #define TF_DEV_DATA_TYPE_TF_WC_DMA_ADDR 0x30d0UL 50 /* WC Entry */ 51 #define TF_DEV_DATA_TYPE_TF_WC_ENTRY 0x30d1UL 52 /* SPIF DFLT L2 CTXT Entry */ 53 #define TF_DEV_DATA_TYPE_SPIF_DFLT_L2_CTXT 0x3131UL 54 /* PARIF DFLT ACT REC PTR Entry */ 55 #define TF_DEV_DATA_TYPE_PARIF_DFLT_ACT_REC 0x3132UL 56 /* PARIF ERR DFLT ACT REC PTR Entry */ 57 #define TF_DEV_DATA_TYPE_PARIF_ERR_DFLT_ACT_REC 0x3133UL 58 /* ILT Entry */ 59 #define TF_DEV_DATA_TYPE_ILT 0x3134UL 60 /* VNIC SVIF entry */ 61 #define TF_DEV_DATA_TYPE_VNIC_SVIF 0x3135UL 62 /* Action Data */ 63 #define TF_DEV_DATA_TYPE_TF_ACTION_DATA 0x3170UL 64 #define TF_DEV_DATA_TYPE_LAST TF_DEV_DATA_TYPE_TF_ACTION_DATA 65 66 #define TF_BITS2BYTES(x) (((x) + 7) >> 3) 67 #define TF_BITS2BYTES_WORD_ALIGN(x) ((((x) + 31) >> 5) * 4) 68 69 struct tf_set_global_cfg_input; 70 struct tf_get_global_cfg_input; 71 struct tf_get_global_cfg_output; 72 struct tf_tbl_type_bulk_get_input; 73 struct tf_tbl_type_bulk_get_output; 74 struct tf_if_tbl_set_input; 75 struct tf_if_tbl_get_input; 76 struct tf_if_tbl_get_output; 77 /* Input params for global config set */ 78 typedef struct tf_set_global_cfg_input { 79 /* Session Id */ 80 uint32_t fw_session_id; 81 /* flags */ 82 uint32_t flags; 83 /* When set to 0, indicates the query apply to RX */ 84 #define TF_SET_GLOBAL_CFG_INPUT_FLAGS_DIR_RX (0x0) 85 /* When set to 1, indicates the query apply to TX */ 86 #define TF_SET_GLOBAL_CFG_INPUT_FLAGS_DIR_TX (0x1) 87 /* Config type */ 88 uint32_t type; 89 /* Offset of the type */ 90 uint32_t offset; 91 /* Size of the data to set in bytes */ 92 uint16_t size; 93 /* Data to set */ 94 uint8_t data[TF_BULK_SEND]; 95 } tf_set_global_cfg_input_t, *ptf_set_global_cfg_input_t; 96 97 /* Input params for global config to get */ 98 typedef struct tf_get_global_cfg_input { 99 /* Session Id */ 100 uint32_t fw_session_id; 101 /* flags */ 102 uint32_t flags; 103 /* When set to 0, indicates the query apply to RX */ 104 #define TF_GET_GLOBAL_CFG_INPUT_FLAGS_DIR_RX (0x0) 105 /* When set to 1, indicates the query apply to TX */ 106 #define TF_GET_GLOBAL_CFG_INPUT_FLAGS_DIR_TX (0x1) 107 /* Config to retrieve */ 108 uint32_t type; 109 /* Offset to retrieve */ 110 uint32_t offset; 111 /* Size of the data to set in bytes */ 112 uint16_t size; 113 } tf_get_global_cfg_input_t, *ptf_get_global_cfg_input_t; 114 115 /* Output params for global config */ 116 typedef struct tf_get_global_cfg_output { 117 /* Size of the total data read in bytes */ 118 uint16_t size; 119 /* Data to get */ 120 uint8_t data[TF_BULK_SEND]; 121 } tf_get_global_cfg_output_t, *ptf_get_global_cfg_output_t; 122 123 /* Input params for table type get */ 124 typedef struct tf_tbl_type_bulk_get_input { 125 /* Session Id */ 126 uint32_t fw_session_id; 127 /* flags */ 128 uint32_t flags; 129 /* When set to 0, indicates the get apply to RX */ 130 #define TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_DIR_RX (0x0) 131 /* When set to 1, indicates the get apply to TX */ 132 #define TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_DIR_TX (0x1) 133 /* When set to 1, indicates the clear entry on read */ 134 #define TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_CLEAR_ON_READ (0x2) 135 /* Type of the object to set */ 136 uint32_t type; 137 /* Starting index to get from */ 138 uint32_t start_index; 139 /* Number of entries to get */ 140 uint32_t num_entries; 141 /* Host memory where data will be stored */ 142 uint64_t host_addr; 143 } tf_tbl_type_bulk_get_input_t, *ptf_tbl_type_bulk_get_input_t; 144 145 /* Output params for table type get */ 146 typedef struct tf_tbl_type_bulk_get_output { 147 /* Size of the total data read in bytes */ 148 uint16_t size; 149 } tf_tbl_type_bulk_get_output_t, *ptf_tbl_type_bulk_get_output_t; 150 151 /* Input params for if tbl set */ 152 typedef struct tf_if_tbl_set_input { 153 /* Session Id */ 154 uint32_t fw_session_id; 155 /* flags */ 156 uint16_t flags; 157 /* When set to 0, indicates the query apply to RX */ 158 #define TF_IF_TBL_SET_INPUT_FLAGS_DIR_RX (0x0) 159 /* When set to 1, indicates the query apply to TX */ 160 #define TF_IF_TBL_SET_INPUT_FLAGS_DIR_TX (0x1) 161 /* if table type */ 162 uint16_t tf_if_tbl_type; 163 /* index of table entry */ 164 uint16_t idx; 165 /* size of the data write to table entry */ 166 uint32_t data_sz_in_bytes; 167 /* data to write into table entry */ 168 uint32_t data[2]; 169 } tf_if_tbl_set_input_t, *ptf_if_tbl_set_input_t; 170 171 /* Input params for if tbl get */ 172 typedef struct tf_if_tbl_get_input { 173 /* Session Id */ 174 uint32_t fw_session_id; 175 /* flags */ 176 uint16_t flags; 177 /* When set to 0, indicates the query apply to RX */ 178 #define TF_IF_TBL_GET_INPUT_FLAGS_DIR_RX (0x0) 179 /* When set to 1, indicates the query apply to TX */ 180 #define TF_IF_TBL_GET_INPUT_FLAGS_DIR_TX (0x1) 181 /* if table type */ 182 uint16_t tf_if_tbl_type; 183 /* size of the data get from table entry */ 184 uint32_t data_sz_in_bytes; 185 /* index of table entry */ 186 uint16_t idx; 187 } tf_if_tbl_get_input_t, *ptf_if_tbl_get_input_t; 188 189 /* output params for if tbl get */ 190 typedef struct tf_if_tbl_get_output { 191 /* Value read from table entry */ 192 uint32_t data[2]; 193 } tf_if_tbl_get_output_t, *ptf_if_tbl_get_output_t; 194 195 #endif /* _HWRM_TF_H_ */ 196