yu.dong | c33b307 | 2024-08-21 23:14:49 -0700 | [diff] [blame^] | 1 | /******************************************************************************* |
| 2 | * Filename: |
| 3 | * --------- |
| 4 | * prbm_conf.h |
| 5 | * |
| 6 | * Project: |
| 7 | * -------- |
| 8 | * UMOLYA |
| 9 | * |
| 10 | * Description: |
| 11 | * ------------ |
| 12 | * PRBM configuration header file |
| 13 | * |
| 14 | * Author: |
| 15 | * ------- |
| 16 | * ------- |
| 17 | * |
| 18 | * ========================================================================== |
| 19 | * $Log$ |
| 20 | * |
| 21 | * 11 10 2020 wen-zhi.huang |
| 22 | * [MOLY00591398] [MT6833][Palmer][Q0][MP7][SQC][Log profiling] SA DL 2CC profiling |
| 23 | * [SA DL 2CC profiling] Copro log reduction |
| 24 | * |
| 25 | * 06 29 2020 wen-zhi.huang |
| 26 | * [MOLY00536882] [MDFPM] Dynamic switch check in |
| 27 | * log reduction for MDDP-WH |
| 28 | * |
| 29 | * 03 25 2020 chi-yen.yu |
| 30 | * [MOLY00507144] [MT6875][Margaux][Q0][MP3][SQC][China][Kunming][5GMM][NSA][Internal][FT][CT][IS:CT][Static][NSA_Self-Cer_FT_01_026][ASSERT]file:dsp3/coresonic/msonic/modem/brp/nr/nr_brp/src/nr_brp_top_irq.c line:925 |
| 31 | * For log reduction |
| 32 | * |
| 33 | * 09 18 2019 chi-yen.yu |
| 34 | * [MOLY00437845] [Gen97][SMO][UTF2.5] Please move out trace from dpcopro_internal.h |
| 35 | * Increase UL USB PRB size |
| 36 | * . |
| 37 | * |
| 38 | * 07 30 2019 wen-zhi.huang |
| 39 | * [MOLY00423298] [MDDP][GEN97] patch back MDDP-WH |
| 40 | * .merge MDDPWH code to VMOLY TRUNK |
| 41 | * |
| 42 | * 07 04 2019 chi-yen.yu |
| 43 | * [MOLY00396869] [MODIS HW Copro] Work on making Modis to run with ESL HW models and Uplane with ESL |
| 44 | * Fix build error |
| 45 | * |
| 46 | * 07 04 2019 chi-yen.yu |
| 47 | * [MOLY00396869] [MODIS HW Copro] Work on making Modis to run with ESL HW models and Uplane with ESL |
| 48 | * Add compile flag for DPMAIF PRB |
| 49 | * |
| 50 | * 06 26 2019 chi-yen.yu |
| 51 | * [MOLY00396869] [MODIS HW Copro] Work on making Modis to run with ESL HW models and Uplane with ESL |
| 52 | * Add IMS PRB type |
| 53 | * |
| 54 | * 05 09 2019 hsin-hao.huang |
| 55 | * [MOLY00401354] [MT6297][Phone Call][NSA FullStack][Huawei][Shanghai][5G][VMOLY]Assert fail: el2_sec_utility.c 327 - IPCORE |
| 56 | * .LHIF/DPMAIF reorder ehance interface |
| 57 | * |
| 58 | * 10 08 2018 chi-yen.yu |
| 59 | * [MOLY00344818] NRL2 merge back to VMOLY |
| 60 | * Add PRBM type for 97 DPMAIF USB |
| 61 | * |
| 62 | * 10 04 2018 chi-yen.yu |
| 63 | * [MOLY00328022] GEN97 NRL2 driver build error |
| 64 | * Refine inline usage |
| 65 | * |
| 66 | * 09 27 2018 chi-yen.yu |
| 67 | * [MOLY00344818] NRL2 merge back to VMOLY |
| 68 | * Merge back from UMOLYE truck |
| 69 | * |
| 70 | * 09 18 2018 chi-yen.yu |
| 71 | * [MOLY00344818] NRL2 merge back to VMOLY |
| 72 | * Fix code gen error |
| 73 | * |
| 74 | * 08 20 2018 wen-zhi.huang |
| 75 | * [MOLY00252913] MT6295 MML2 driver porting |
| 76 | * [VMOLY] merge driver code back with UMOLYE.TRUNK & 97.DEV |
| 77 | * |
| 78 | * 08 15 2018 chi-yen.yu |
| 79 | * [MOLY00252913] MT6295 MML2 driver porting |
| 80 | * . |
| 81 | * |
| 82 | * 08 08 2018 chi-yen.yu |
| 83 | * [MOLY00328022] GEN97 NRL2 driver build error |
| 84 | * Patch for NRL2 DVT |
| 85 | * |
| 86 | * 08 07 2018 chi-yen.yu |
| 87 | * [MOLY00328022] GEN97 NRL2 driver build error |
| 88 | * Patch cache operation API for VRB |
| 89 | * |
| 90 | * 07 24 2018 chi-yen.yu |
| 91 | * [MOLY00328022] GEN97 NRL2 driver build error |
| 92 | * Add PRB DL DPMAIF |
| 93 | * |
| 94 | * 05 24 2018 chi-yen.yu |
| 95 | * [MOLY00328022] GEN97 NRL2 driver build error |
| 96 | * Fix build error |
| 97 | * |
| 98 | * 04 11 2018 chi-yen.yu |
| 99 | * [MOLY00252913] MT6295 MML2 driver porting |
| 100 | * Extend VRB release to support 32bit length |
| 101 | * |
| 102 | * 03 20 2018 chi-yen.yu |
| 103 | * [MOLY00252913] MT6295 MML2 driver porting |
| 104 | * Patch for 95 MML2 router DVT test |
| 105 | * |
| 106 | * 03 09 2018 chi-yen.yu |
| 107 | * [MOLY00252913] MT6295 MML2 driver porting |
| 108 | * Integrate 95 MML2 router DVT related test |
| 109 | * |
| 110 | * 02 13 2018 chi-yen.yu |
| 111 | * [MOLY00252913] MT6295 MML2 driver porting |
| 112 | * Enhance DMA trigger flow for reduce mask interrupt duration |
| 113 | * |
| 114 | * 11 13 2017 chi-yen.yu |
| 115 | * [MOLY00252913] MT6295 MML2 driver porting |
| 116 | * Merge from 95 DEV branch |
| 117 | * |
| 118 | * 11 13 2017 chao-hung.hsu |
| 119 | * [MOLY00252913] MT6295 MML2 driver porting |
| 120 | * . dpcopro 95 DEV code sync back to R3/TRUNK |
| 121 | * |
| 122 | * 11 10 2017 wei-hao.kuo |
| 123 | * [MOLY00252913] MT6295 MML2 driver porting |
| 124 | * Enable PRB_TYPE_DL_USB for _HIF_USB_SUPPORT_ load |
| 125 | * |
| 126 | * 08 21 2017 chi-yen.yu |
| 127 | * [MOLY00252913] MT6295 MML2 driver porting |
| 128 | * Reduce PRBM size for MT6739 |
| 129 | * |
| 130 | * 08 16 2017 chi-yen.yu |
| 131 | * [MOLY00179693] [Bianco_SMT][Bianco Bring-up]MT6293 Copro driver integration |
| 132 | * PRBM full recover |
| 133 | * |
| 134 | * 07 20 2017 chi-yen.yu |
| 135 | * [MOLY00179693] [Bianco_SMT][Bianco Bring-up]MT6293 Copro driver integration |
| 136 | * Merge UMOLYA TRUCK code to R2 |
| 137 | * |
| 138 | * 07 17 2017 chi-yen.yu |
| 139 | * [MOLY00252913] MT6295 MML2 driver porting |
| 140 | * Merege 95 MML2 driver to truck |
| 141 | * |
| 142 | * 07 13 2017 chi-yen.yu |
| 143 | * [MOLY00252913] MT6295 MML2 driver porting |
| 144 | * . |
| 145 | * |
| 146 | * 06 29 2017 chi-yen.yu |
| 147 | * [MOLY00252913] MT6295 MML2 driver porting |
| 148 | * Port for 95 FPGA |
| 149 | * |
| 150 | * 03 06 2017 chi-yen.yu |
| 151 | * [MOLY00226321] [6293]DCM & Sleep Flow Integration and Verification |
| 152 | * . |
| 153 | * |
| 154 | * 03 06 2017 chi-yen.yu |
| 155 | * [MOLY00232231] [MT6763_234G_Sanity]93 DPCOPRO driver integration |
| 156 | * . |
| 157 | * |
| 158 | * 03 02 2017 chi-yen.yu |
| 159 | * [MOLY00232231] [MT6763_234G_Sanity]93 DPCOPRO driver integration |
| 160 | * . |
| 161 | * |
| 162 | * 01 20 2017 chao-hung.hsu |
| 163 | * [MOLY00226032] [Bianco Bring-up][DPCopro] |
| 164 | * . driver porting |
| 165 | * |
| 166 | * 01 10 2017 chi-yen.yu |
| 167 | * [MOLY00179693] MT6293 Copro driver integration |
| 168 | * . |
| 169 | * |
| 170 | * 10 31 2016 chi-yen.yu |
| 171 | * [MOLY00179693] MT6293 Copro driver integration |
| 172 | * . |
| 173 | * |
| 174 | * 10 06 2016 chi-yen.yu |
| 175 | * [MOLY00179693] MT6293 Copro driver integration |
| 176 | * . |
| 177 | * |
| 178 | * 09 13 2016 chi-yen.yu |
| 179 | * [MOLY00179693] MT6293 Copro driver integration |
| 180 | * . |
| 181 | * |
| 182 | * 09 07 2016 chi-yen.yu |
| 183 | * [MOLY00179693] MT6293 Copro driver integration |
| 184 | * . |
| 185 | * |
| 186 | * 08 24 2016 chi-yen.yu |
| 187 | * [MOLY00179693] MT6293 Copro driver integration |
| 188 | * . |
| 189 | * |
| 190 | * 08 09 2016 chi-yen.yu |
| 191 | * [MOLY00179693] MT6293 Copro driver integration |
| 192 | * . |
| 193 | * |
| 194 | * 08 05 2016 chi-yen.yu |
| 195 | * [MOLY00179693] MT6293 Copro driver integration |
| 196 | * . |
| 197 | * |
| 198 | * 07 19 2016 chi-yen.yu |
| 199 | * [MOLY00179693] MT6293 Copro driver integration |
| 200 | * . |
| 201 | * |
| 202 | * 07 12 2016 chi-yen.yu |
| 203 | * [MOLY00179693] MT6293 Copro driver integration |
| 204 | * . |
| 205 | * |
| 206 | * 07 11 2016 chi-yen.yu |
| 207 | * [MOLY00179693] MT6293 Copro driver integration |
| 208 | * . |
| 209 | * |
| 210 | * 06 30 2016 chi-yen.yu |
| 211 | * [MOLY00179693] MT6293 Copro driver integration |
| 212 | * . |
| 213 | * |
| 214 | * 06 07 2016 chi-yen.yu |
| 215 | * [MOLY00179693] MT6293 Copro driver integration |
| 216 | * . |
| 217 | * |
| 218 | * 05 25 2016 chi-yen.yu |
| 219 | * [MOLY00179693] MT6293 Copro driver integration |
| 220 | * . |
| 221 | * |
| 222 | ****************************************************************************/ |
| 223 | #ifndef __PRBM_H__ |
| 224 | #define __PRBM_H__ |
| 225 | |
| 226 | #ifndef __MTK_TARGET__ |
| 227 | #define inline |
| 228 | #endif |
| 229 | |
| 230 | typedef struct{ |
| 231 | kal_uint32 prb_base; |
| 232 | kal_uint32 prb_size; |
| 233 | kal_uint16 prb_page_num; |
| 234 | kal_uint8 prb_id; |
| 235 | kal_uint8 prb_wrap_buf_unit;// unit:128 bytes |
| 236 | kal_uint32 prb_alloc_align:4;//0: no-align, 1: 2 byte align, 2: 4 byte align, 3: 8 align,...,5: 32 byte align,6: 64 byte align |
| 237 | //prb_psize_cfg:0 => page size= 16 byte |
| 238 | //prb_psize_cfg:1 => page size= 32 byte |
| 239 | //prb_psize_cfg:2 => page size= 64 byte |
| 240 | //prb_psize_cfg:3 => page size= 128 byte |
| 241 | //... |
| 242 | //prb_page_size:N => page size= 2^(4+prb_psize_cfg) byte |
| 243 | kal_uint32 prb_psize_cfg:4; |
| 244 | //when no_seq_rel=0, PRB is sequence release, |
| 245 | //When no_seq_rel=1, PRB is no-sequence release, |
| 246 | kal_uint32 rel_type:4; |
| 247 | kal_uint32 wrap_full_cover:1; |
| 248 | kal_uint32 multi_task_aloc:1; |
| 249 | kal_uint32 resv:18; |
| 250 | }prbm_config_t; |
| 251 | |
| 252 | typedef enum |
| 253 | { |
| 254 | PRB_TYPE_UL_ROHC=0, |
| 255 | PRB_TYPE_DL_ROHC, |
| 256 | PRB_TYPE_DL_IPHC, |
| 257 | PRB_TYPE_DL_CIPHER_META, |
| 258 | PRB_TYPE_DL_IP_FRAG, // 4 |
| 259 | //=====start of HW PRB |
| 260 | PRB_TYPE_AP_UL_Q1, |
| 261 | PRB_TYPE_SHARE, |
| 262 | #ifndef __MD93__ |
| 263 | PRB_TYPE_DL_IPF, |
| 264 | #endif |
| 265 | #if !defined(__MD93__) && !defined(__TEMP_MDDP_WH_SUPPORT__) |
| 266 | PRB_TYPE_DL_NAT_SHRAM, |
| 267 | #endif |
| 268 | #ifdef ATEST_DPCOPRO_EN |
| 269 | PRB_TYPE_DPC_UT_CFG, |
| 270 | #endif |
| 271 | //Due to only MODEM only load has MODEM USB function |
| 272 | //only enable DL USB buffer in MODEM only load |
| 273 | //#ifdef __MODEM_ONLY__ |
| 274 | //L1S_L1DISABLE also has MODEM USB function. PRB_TYPE_DL_USB is needed as long as __HIF_USB_SUPPORT__ is defined. |
| 275 | PRB_TYPE_IMS, |
| 276 | #ifdef __HIF_USB_SUPPORT__ |
| 277 | PRB_TYPE_DL_USB, |
| 278 | #endif |
| 279 | #ifdef __MD97__ |
| 280 | PRB_TYPE_DL_LHIF, |
| 281 | PRB_TYPE_DL_DPMAIF, |
| 282 | #endif |
| 283 | PRB_TYPE_AP_UL_ACK, |
| 284 | #ifdef __HIF_DPMAIF_DP_SUPPORT__ |
| 285 | PRB_TYPE_DL_DPMAIF_BAT, |
| 286 | PRB_TYPE_DL_DPMAIF_FRAGBAT, |
| 287 | #endif |
| 288 | #ifdef __TEMP_MDDP_WH_SUPPORT__ |
| 289 | #if defined(__MDDP_USB_SUPPORT__) || defined(__MDDP_WH_SUPPORT__) |
| 290 | PRB_TYPE_DL_NAT_SHRAM, |
| 291 | #endif |
| 292 | #endif |
| 293 | PRB_TYPE_NUM |
| 294 | }prbm_type; |
| 295 | |
| 296 | // PRB_TYPE_UL_IPHC, // not used in 2/3G |
| 297 | // PRB_TYPE_DL_FLC, // not used in 2/3G |
| 298 | |
| 299 | enum{ |
| 300 | PRB_PSIZE_CFG_16=0, |
| 301 | PRB_PSIZE_CFG_32, |
| 302 | PRB_PSIZE_CFG_64, |
| 303 | PRB_PSIZE_CFG_128, |
| 304 | PRB_PSIZE_CFG_256, |
| 305 | PRB_PSIZE_CFG_512, |
| 306 | PRB_PSIZE_CFG_1024, |
| 307 | PRB_PSIZE_CFG_2048, |
| 308 | PRB_PSIZE_CFG_4096, |
| 309 | PRB_PSIZE_CFG_NUM, |
| 310 | }; |
| 311 | |
| 312 | enum{ |
| 313 | PRB_ALLOC_ALIGN_1=0, |
| 314 | PRB_ALLOC_ALIGN_2, |
| 315 | PRB_ALLOC_ALIGN_4, |
| 316 | PRB_ALLOC_ALIGN_8, |
| 317 | PRB_ALLOC_ALIGN_16, |
| 318 | PRB_ALLOC_ALIGN_32, |
| 319 | PRB_ALLOC_ALIGN_64, |
| 320 | PRB_ALLOC_ALIGN_NUM, |
| 321 | }; |
| 322 | |
| 323 | enum{ |
| 324 | PRB_REL_TYPE_SEQ=0, |
| 325 | PRB_REL_TYPE_NOSEQ, |
| 326 | PRB_REL_TYPE_HW_ALOC, |
| 327 | PRB_REL_TYPE_NUM, |
| 328 | }; |
| 329 | #define PRB_FULL_RESERVE_SIZE 4 |
| 330 | #define PRBM_INIT_REM_SIZE(_prb_size) ((_prb_size)-PRB_FULL_RESERVE_SIZE) |
| 331 | #define PRBM_WRAP_BUF_UNIT (128) |
| 332 | #define PSZIE_CFG_BIT_NUM(psize_cfg) ((kal_uint32)(psize_cfg)+4) |
| 333 | #define PSIZE_CFG_SIZE(psize_cfg) (1<<PSZIE_CFG_BIT_NUM(psize_cfg)) |
| 334 | //#define PRB_GET_MEM_SIZE(P_SIZE,P_NUM, REL_TYPE) (PSIZE_CFG_SIZE(P_SIZE)*P_NUM)+(REL_TYPE*(sizeof(kal_uint16)*P_NUM)) |
| 335 | #define PRBM_PT_SIZE(P_NUM) (sizeof(kal_uint16)*(P_NUM)) |
| 336 | #define PRB_GET_MEM_SIZE(PAGE_SIZE_CFG,WRAP_SIZE_CFG,PAGE_NUM, REL_TYPE) ((PSIZE_CFG_SIZE(PAGE_SIZE_CFG)*(PAGE_NUM))+(WRAP_SIZE_CFG*PRBM_WRAP_BUF_UNIT)+((REL_TYPE>0)*PRBM_PT_SIZE(PAGE_NUM))) |
| 337 | |
| 338 | typedef kal_uint32(*HW_ALOC_OFS_CB)(void);//CB function to get write offset for HW ALLOC type |
| 339 | typedef kal_uint32(*HW_ADD_REM_SIZE_CB)(kal_uint32);//CB function to add remain buffer size to HW & return current remain buffer size |
| 340 | |
| 341 | void _do_prbm_output_rel_merge_log(void); |
| 342 | kal_bool prbm_get_def_cfg(prbm_config_t *cfg,kal_uint8 prbm_id); |
| 343 | kal_bool prbm_set_def_cfg(prbm_config_t *cfg,kal_uint8 prbm_id); |
| 344 | kal_uint32 prbm_get_def_mem_size(kal_uint8 prbm_id); |
| 345 | void prbm_get_cfg(prbm_config_t *cfg,kal_uint8 prb_id); |
| 346 | void prbm_get_cfg_for_hw_aloc_type(prbm_config_t *cfg,HW_ALOC_OFS_CB aloc_cb,HW_ADD_REM_SIZE_CB add_rem_size_cb,kal_uint8 prb_id); |
| 347 | void prbm_init_cfg(prbm_config_t *prbm_cfg,HW_ALOC_OFS_CB wofs_cb,HW_ADD_REM_SIZE_CB add_rem_size_cb,kal_uint8 prbid); |
| 348 | |
| 349 | void prbm_reconfig(kal_uint32 base_addr,kal_uint32 size,kal_uint8 page_size_cfg,kal_uint32 page_num_unit,kal_uint32 max_pkt_size,kal_uint8 rel_type,kal_uint8 prbm_id); |
| 350 | |
| 351 | void prbm_init(void); |
| 352 | kal_uint8* prbm_get_base(kal_uint8 prb_id); |
| 353 | kal_uint8* prbm_allocate(kal_uint32 aloc_size, kal_uint8 prb_id); |
| 354 | kal_uint32 prbm_release(void* addr, kal_uint32 rel_size, kal_uint8 prb_id); |
| 355 | kal_uint32 prbm_get_remain_size(kal_uint8 prb_id); |
| 356 | kal_uint32 prbm_get_alloc_size(kal_uint8 prb_id); |
| 357 | kal_bool prbm_check_region(kal_uint32 addr, kal_uint32 len,kal_uint8 prb_id); |
| 358 | #ifdef __TEMP_MDDP_WH_SUPPORT__ |
| 359 | kal_uint32 prbm_get_rel_ofs(kal_uint8 prb_id); |
| 360 | #endif |
| 361 | |
| 362 | //in order to make packet in end of buffer in PRBM to be continuously |
| 363 | //copy data from base of PRBM to wrap buffer region |
| 364 | kal_bool prbm_wrap_buf_handle(kal_uint8 *pkt_addr, kal_uint16 pkt_len,kal_uint8 prb_id,kal_uint8 hw_write); |
| 365 | |
| 366 | typedef struct{ |
| 367 | kal_uint32 buf_add_size:24; |
| 368 | kal_uint32 prbm_id:7; |
| 369 | kal_uint32 do_rel:1; |
| 370 | }PRBM_TRY_REL_T; |
| 371 | PRBM_TRY_REL_T _prbm_try_release(kal_uint32 addr, kal_uint32 rel_size); |
| 372 | |
| 373 | |
| 374 | typedef kal_bool (*prb_rel_cb_t)(void*, kal_uint32); |
| 375 | kal_uint8* prbm_usb_init(prb_rel_cb_t rel_cb); |
| 376 | void prbm_wifi_init(prb_rel_cb_t rel_cb); |
| 377 | |
| 378 | #define PRB_SIZE_UL_USB (1*1024*1024) |
| 379 | #endif |