udf.h (7246B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 */ 8 #ifndef __BCM_INT_UDF_H__ 9 #define __BCM_INT_UDF_H__ 10 11 #include <bcm_int/esw/udf_common.h> 12 #if defined (BCM_TRIDENT3_SUPPORT) 13 14 /* Control Flags */ 15 #define _BCM_UDF_TD3_CTRL_RANGE_CHECK (1 << 1) 16 17 /* Object entry flags */ 18 #define _BCM_UDF_TD3_OBJ_IFP (1 << 1) 19 #define _BCM_UDF_TD3_OBJ_VFP (1 << 2) 20 #define _BCM_UDF_TD3_OBJ_RANGE_CHECK (1 << 3) 21 22 /* Number of stages to be used to extract bytes for a given parser */ 23 #define _BCM_UDF_MAX_PARSER_STAGES 2 24 25 /* 26 * UDF object information Structure. 27 */ 28 typedef struct _bcm_udf_td3_obj_info_s { 29 bcm_udf_id_t udf_id; /* UDF Objeect Id */ 30 uint16 offset; /* Start offset in bytes. */ 31 uint16 width; /* Bytes to be extracted. */ 32 uint32 chunk_bmap; /* Chunk bitmap allocated for 33 given UDF object */ 34 uint16 hw_cmd_bmap[_BCM_UDF_MAX_PARSER_STAGES]; 35 /* HW CMD_POLICY_DATA for each stage. */ 36 uint32 flags; /* misc. info */ 37 bcm_udf_abstract_pkt_format_t abstr_pkt_fmt; /* Abstract packet format. */ 38 struct _bcm_udf_td3_obj_info_s *next; /* Next Pointer of Linked-list. */ 39 struct _bcm_udf_td3_obj_info_s *prev; /* Prev Pointer of Linked-list. */ 40 } _bcm_udf_td3_obj_info_t; 41 42 /* 43 * UDF Control Structure. 44 */ 45 typedef struct _bcm_udf_td3_ctrl_s { 46 uint32 flags; /* misc. info */ 47 _bcm_udf_td3_obj_info_t *udf_obj_head; /* UDF object linked-list 48 head node */ 49 } _bcm_udf_td3_ctrl_t; 50 51 /* 52 * Initialize for UDF control structure for MAX supported units. 53 */ 54 extern _bcm_udf_td3_ctrl_t *udf_td3_control[BCM_MAX_NUM_UNITS]; 55 56 /* 57 * UDF Packet Format HW Info Structure. 58 */ 59 typedef struct _bcm_udf_td3_abstr_pkt_fmt_hw_info_e { 60 uint8 parser; /* Parser number */ 61 uint8 num_stages; /* Number stages supported for the given 62 abstract pkt format. */ 63 soc_mem_t stage_policy_mem[_BCM_UDF_MAX_PARSER_STAGES]; 64 /* Parser1/2 Stage Policy Memory to 65 extract first 16 bytes for the given 66 abstract pkt format. */ 67 uint8 hfe_prof_ptr_arr_len[_BCM_UDF_MAX_PARSER_STAGES]; 68 /* HFE Profile pointer array len */ 69 uint32 *hfe_profile_ptr[_BCM_UDF_MAX_PARSER_STAGES]; 70 /* Array of HFE Profile pointers for 71 a given stage */ 72 uint8 num_cmds[_BCM_UDF_MAX_PARSER_STAGES]; 73 /* Number of commands supports 74 for a stage. */ 75 uint8 max_extract_bytes; /* Maximum Number of bytes can be extracted */ 76 uint8 extracted_bytes; /* Bytes already extracted */ 77 uint32 chunk_bmap_used; /* Allocated chunks for a given abstract pkt 78 format in bitmap */ 79 uint16 valid_cmd_bmap[_BCM_UDF_MAX_PARSER_STAGES]; 80 /* Valid Commands configured on respective 81 stage policy mem. */ 82 uint8 *cmd_policy_data[_BCM_UDF_MAX_PARSER_STAGES]; 83 /* Reference to default CMD_POLICY_DATA 84 for given stage hfe_profile_ptr. */ 85 bcm_udf_pkt_base_offset_t base_offset; /* Start base offset. */ 86 uint32 unavail_chunk_bmap; /* Unavailable chunk bitmap */ 87 } _bcm_udf_td3_abstr_pkt_fmt_hw_info_t; 88 89 #if defined (BCM_WARM_BOOT_SUPPORT) 90 /* 91 * Structure to be used for sync and recovery of UDF objects 92 * in case of Warmboot. 93 */ 94 typedef struct _bcm_udf_td3_wb_obj_info_s { 95 bcm_udf_id_t udf_id; /* UDF Objeect Id */ 96 uint16 offset; /* Start offset in bytes. */ 97 uint32 chunk_bmap; /* Chunk bitmap allocated for 98 given UDF object */ 99 uint16 hw_cmd_bmap1; /* HW CMD_POLICY_DATA for stage1. */ 100 uint16 hw_cmd_bmap2; /* HW CMD_POLICY_DATA for stage2. */ 101 bcm_udf_abstract_pkt_format_t abstr_pkt_fmt; /* Abstract packet format. */ 102 } _bcm_udf_td3_wb_obj_info_t; 103 104 /* 105 * Structure to be used for sync and recovery of UDF objects 106 * in case of Warmboot for version 2. 107 */ 108 typedef struct _bcm_udf_td3_wb_obj_info_2_s { 109 bcm_udf_id_t udf_id; /* UDF Objeect Id */ 110 uint16 offset; /* Start offset in bytes. */ 111 uint32 chunk_bmap; /* Chunk bitmap allocated for 112 given UDF object */ 113 uint8 num_stages; /* Number of stages */ 114 uint16 hw_cmd_bmap[_BCM_UDF_MAX_PARSER_STAGES]; 115 /* HW CMD_POLICY_DATA for stage1. */ 116 bcm_udf_abstract_pkt_format_t abstr_pkt_fmt; /* Abstract packet format. */ 117 } _bcm_udf_td3_wb_obj_info_2_t; 118 119 #endif /* BCM_WARM_BOOT_SUPPORT */ 120 121 extern int 122 _bcm_udf_td3_chunk_create( 123 int unit, 124 bcm_udf_alloc_hints_t *hints, 125 bcm_udf_chunk_info_t *udf_info, 126 bcm_udf_id_t *udf_id); 127 128 extern int 129 _bcm_udf_td3_chunk_info_get( 130 int unit, 131 bcm_udf_id_t udf_id, 132 bcm_udf_chunk_info_t *udf_chunk_info); 133 134 extern int 135 _bcm_udf_td3_abstract_pkt_format_object_list_get( 136 int unit, 137 bcm_udf_abstract_pkt_format_t abstract_pkt_format, 138 int max, 139 bcm_udf_id_t *udf_id_list, 140 int *actual); 141 142 extern int 143 _bcm_udf_td3_abstract_pkt_format_info_get( 144 int unit, 145 bcm_udf_abstract_pkt_format_t abstract_pkt_format, 146 bcm_udf_abstract_pkt_format_info_t *pkt_format_info); 147 148 extern void 149 _bcm_udf_td3_functions_init(_bcm_udf_funct_t *functions); 150 151 extern int 152 _bcm_udf_td3_object_info_get( 153 int unit, 154 bcm_udf_id_t udf_id, 155 _bcm_udf_td3_obj_info_t **obj_info); 156 157 extern int 158 _bcm_udf_td3_chunk_id_multi_get( 159 int unit, 160 uint32 udf_chunk_bmap, 161 int max, 162 int *objects_list, 163 int *actual); 164 165 #endif /* BCM_TRIDENT3_SUPPORT */ 166 167 void 168 _bcm_esw_udf_sw_dump(int unit); 169 void 170 _bcm_esw_udf_sw_mem_dump(int unit, soc_mem_t mem, int idx); 171 172 #endif /* __BCM_INT_UDF_H__ */