rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | #!/usr/bin/perl |
| 2 | # |
| 3 | # Copyright Statement: |
| 4 | # -------------------- |
| 5 | # This software is protected by Copyright and the information contained |
| 6 | # herein is confidential. The software may not be copied and the information |
| 7 | # contained herein may not be used or disclosed except with the written |
| 8 | # permission of MediaTek Inc. (C) 2011 |
| 9 | # |
| 10 | # BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 11 | # THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 12 | # RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 13 | # AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 14 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 15 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 16 | # NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 17 | # SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 18 | # SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 19 | # THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 20 | # NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 21 | # SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 22 | # |
| 23 | # BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 24 | # LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 25 | # AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 26 | # OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 27 | # MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 28 | # |
| 29 | # THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 30 | # WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 31 | # LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 32 | # RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 33 | # THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 34 | # |
| 35 | # |
| 36 | #***************************************************************************** |
| 37 | #*============================================================================ |
| 38 | #* HISTORY |
| 39 | #* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 40 | #*------------------------------------------------------------------------------ |
| 41 | #* $Revision$ |
| 42 | #* $Modtime$ |
| 43 | #* $Log$ |
| 44 | #* |
| 45 | #* 11 11 2020 elvin.wang |
| 46 | #* [MOLY00593559] [Gen97][Colgin] NR15.R3.MD700.MP branch out & call for check-in |
| 47 | #* Merge patch from NR15.R3.T700.MP to NR15.R3.MD700.MP |
| 48 | #* |
| 49 | #* 09 18 2020 yao.liu |
| 50 | #* [MOLY00569908] [Layout] Colgin patch back to NR15.R3.MP. |
| 51 | #* [NR15.R3.MP] Porting Colgin layout to R3.MP branch. |
| 52 | #* |
| 53 | #* 09 08 2020 yao.liu |
| 54 | #* [MOLY00372891] [MT6297][CM] Code change |
| 55 | #* [Petrus-P] Move CSIF section to Bank0. |
| 56 | #* |
| 57 | #* 07 15 2020 yao.liu |
| 58 | #* [MOLY00546498] [MT6893] Porting layout for Palmer. |
| 59 | #* [NR15.R3.MP] Porting layout for MT6893. |
| 60 | #* |
| 61 | #* 06 11 2020 yao.liu |
| 62 | #* [MOLY00521482] [MT6297][NR][SMT]Petrus NA SKU SMT4 for ATT & VZW Sku ??? |
| 63 | #* |
| 64 | #* [NR15.R3.MP] Move CSIF section to Bank0. |
| 65 | #* |
| 66 | #* 04 17 2020 yao.liu |
| 67 | #* [MOLY00511795] [NR15.R3.MP]L2cache lock new solution |
| 68 | #* [NR15.R3.MP] New L2Cache Lock-AutoGen patch. |
| 69 | #* |
| 70 | #* 01 09 2020 yao.liu |
| 71 | #* [MOLY00470528] [VMOLY]Remove L2C lock feature |
| 72 | #* [VMOLY] Remove L2$ LOCK sections. |
| 73 | #* |
| 74 | #* 01 08 2020 yao.liu |
| 75 | #* [MOLY00470423] [GEN98 FPGA Phone Call][Gen97] MPU/AutoGen bug fix. NMI cannot be servicve by non-offending VPEs. |
| 76 | #* |
| 77 | #* [VMOLY] Add mpu to protect bootslave. |
| 78 | #* |
| 79 | #* 12 06 2019 yao.liu |
| 80 | #* [MOLY00462117] [VMOLY] Extend DRDI set to 64. |
| 81 | #* [VMOLY] Extend DRDI set to 64. |
| 82 | #* |
| 83 | #* 12 04 2019 yao.liu |
| 84 | #* [MOLY00462595] [VMOLY] Rename sections for memory utility. |
| 85 | #* |
| 86 | #* [VMOLY] Rename section for memory utility. |
| 87 | #* |
| 88 | #* 12 02 2019 yao.liu |
| 89 | #* [MOLY00462186] [VMOLY] Change mpu setting for Security Develop. |
| 90 | #* [Gen97] MPU setting review. |
| 91 | #* |
| 92 | #* 10 08 2019 yao.liu |
| 93 | #* [MOLY00447280] [Gen97][Image Layout] DRDI feature cause DSP Base address move to Bank 1 from Bank 0 |
| 94 | #* [MT6885] Move DSP to the end of Bank1. |
| 95 | #* |
| 96 | #* 08 21 2019 yao.liu |
| 97 | #* [MOLY00433621] Porting feature and add Mercury option to AutoGen. |
| 98 | #* [VMOLY.APOLLO.SQC]Porting ALPS03884302 feature and add Mercury option for Auto-Gen. |
| 99 | #* |
| 100 | #* 07 04 2019 yao.liu |
| 101 | #* [MOLY00418931] [VMOLY] Change Gen97 prefetch range. |
| 102 | #* [VMOLY] Adjust prefetch range. |
| 103 | #* |
| 104 | #* 03 18 2019 yao.liu |
| 105 | #* [MOLY00391736] Change L2CACHE_LOCK attribute from RW to RO. |
| 106 | #* [VMOLY] Adjust L2C_LOCK vma= lma. |
| 107 | #* |
| 108 | #* 01 14 2019 frank.hu |
| 109 | #* [MOLY00363660] [Auto-Gen] Merge 2 links to 1 link to save more build time. |
| 110 | #* |
| 111 | #* VMOLY.DEV.SEPT - Merge 2Links -> 1Link. |
| 112 | #* |
| 113 | #* 12 11 2018 tero.jarkko |
| 114 | #* [MOLY00372134] [Gen97][SystemService][AutoGen]Fixed MT6885_FPGA mpu table |
| 115 | #* |
| 116 | #* . |
| 117 | #* |
| 118 | #* 12 07 2018 tero.jarkko |
| 119 | #* [MOLY00371534] [Gen97][SystemService]Increased HARQ buffer size for MT6297 EVB |
| 120 | #* |
| 121 | #* . |
| 122 | #* |
| 123 | #* 12 03 2018 tero.jarkko |
| 124 | #* [MOLY00369424] [Gen97][SystemService]Fix build error for MT6297 |
| 125 | #* |
| 126 | #* . |
| 127 | #* |
| 128 | #* 11 13 2018 tero.jarkko |
| 129 | #* [MOLY00364280] [Gen97][SystemService][AutoGen]Added ULTRA region to memory layout |
| 130 | #* |
| 131 | #* . |
| 132 | #* |
| 133 | #* 11 07 2018 tero.jarkko |
| 134 | #* [MOLY00363118] [BusMPU][Gen97] the IOCU protection framework |
| 135 | #* |
| 136 | #* . |
| 137 | #* |
| 138 | #* 11 02 2018 tero.jarkko |
| 139 | #* [MOLY00359227] [Gen97][SystemService][AutoGen]512MB memory map configured for MT6297 EVB |
| 140 | #* |
| 141 | #* . |
| 142 | #* |
| 143 | #* 10 29 2018 tero.jarkko |
| 144 | #* [MOLY00359227] [Gen97][SystemService][AutoGen]512MB memory map configured for MT6297 EVB |
| 145 | #* |
| 146 | #* . |
| 147 | #* |
| 148 | #* 10 26 2018 tero.jarkko |
| 149 | #* [MOLY00359227] [Gen97][SystemService][AutoGen]512MB memory map configured for MT6297 EVB |
| 150 | #* |
| 151 | #* . |
| 152 | #* |
| 153 | #* 10 17 2018 tero.jarkko |
| 154 | #* [MOLY00359227] [Gen97][SystemService][AutoGen]512MB memory map configured for MT6297 EVB |
| 155 | #* |
| 156 | #* . |
| 157 | #* |
| 158 | #* 09 26 2018 tero.jarkko |
| 159 | #* [MOLY00355587] [Gen97][SystemService]Updated MT6297 MPU maximum region count |
| 160 | #* |
| 161 | #* . |
| 162 | #* |
| 163 | #* 09 24 2018 tero.jarkko |
| 164 | #* [MOLY00351701] [Gen97][SystemService][Auto-Gen]Added L2-WB areas |
| 165 | #* |
| 166 | #* . |
| 167 | #* |
| 168 | #* 09 04 2018 tero.jarkko |
| 169 | #* [MOLY00349311] [VMOLY build] Solve VMOLY build error |
| 170 | #* |
| 171 | #* . |
| 172 | #* |
| 173 | #* 08 29 2018 tero.jarkko |
| 174 | #* [MOLY00345457] [Gen97][SystemService][AutoGen]MT6297 merge |
| 175 | #* |
| 176 | #* . |
| 177 | #* |
| 178 | #* 08 14 2018 tero.jarkko |
| 179 | #* [MOLY00345457] [Gen97][SystemService][AutoGen]MT6297 merge |
| 180 | #* |
| 181 | #* . |
| 182 | #* |
| 183 | #* 07 30 2018 frank.hu |
| 184 | #* [MOLY00343013] [Create New Project][PMA used] |
| 185 | #* Add LDS for MT6779. |
| 186 | #* |
| 187 | #* 07 13 2018 tero.jarkko |
| 188 | #* [MOLY00338780] [MT6295] New MPU APIs for pretecting Consys MD-AP share memory. |
| 189 | #* |
| 190 | #* . |
| 191 | #* |
| 192 | #* 06 19 2018 tero.jarkko |
| 193 | #* [MOLY00334042] [System Service][MOLY Kernel Internal Request] DRDI Patch on LR13 |
| 194 | #* |
| 195 | #* . |
| 196 | #* |
| 197 | #* 05 28 2018 tero.jarkko |
| 198 | #* [MOLY00327744] [Gen95][SystemService][Auto-Gen]Added L2-WB areas |
| 199 | #* |
| 200 | #* . |
| 201 | #* |
| 202 | #* 05 22 2018 tero.jarkko |
| 203 | #* [MOLY00327744] [Gen95][SystemService][Auto-Gen]Added L2-WB areas |
| 204 | #* |
| 205 | #* . |
| 206 | #* |
| 207 | #* 02 27 2018 tero.jarkko |
| 208 | #* [MOLY00310353] [Gen95][System Service][Auto-Gen]Static L2C locked input sections are placed into EMI |
| 209 | #* |
| 210 | #* . |
| 211 | #* |
| 212 | #* 01 18 2018 tero.jarkko |
| 213 | #* [MOLY00303145] [Gen95] [SystemService][DSMGR] Dynamic L2CACHE lock implementation |
| 214 | #* |
| 215 | #* . |
| 216 | #* |
| 217 | #* 01 18 2018 tero.jarkko |
| 218 | #* [MOLY00303145] [Gen95] [SystemService][DSMGR] Dynamic L2CACHE lock implementation |
| 219 | #* |
| 220 | #* . |
| 221 | #* |
| 222 | #* 12 05 2017 tero.jarkko |
| 223 | #* [MOLY00294063] [Gen93][MT6739][SystemService][Auto-Gen]Fix DRDI memory dump |
| 224 | #* |
| 225 | #* . |
| 226 | #* |
| 227 | #* 11 22 2017 tero.jarkko |
| 228 | #* [MOLY00290966] [Gen93][MT6739][SystemService][Auto-Gen] AMMS DRDI stage 4 (Modify layout) |
| 229 | #* |
| 230 | #* . |
| 231 | #* |
| 232 | #* 11 10 2017 tero.jarkko |
| 233 | #* [MOLY00281660] [MT6295M][SystemService][Autogen] Updated MT6295M memory map |
| 234 | #* |
| 235 | #* . |
| 236 | #* |
| 237 | #* 08 29 2017 tero.jarkko |
| 238 | #* [MOLY00269781] [Gen93][SystemService][Auto-Gen]I/DSPRAM MPU settings update |
| 239 | #* |
| 240 | #* . |
| 241 | #* |
| 242 | #* 08 28 2017 tero.jarkko |
| 243 | #* [MOLY00269781] [Gen93][SystemService][Auto-Gen]I/DSPRAM MPU settings update |
| 244 | #* |
| 245 | #* . |
| 246 | #* |
| 247 | #* 08 23 2017 tero.jarkko |
| 248 | #* [MOLY00269781] [Gen93][SystemService][Auto-Gen]I/DSPRAM MPU settings update |
| 249 | #* |
| 250 | #* . |
| 251 | #* |
| 252 | #* 08 10 2017 tero.jarkko |
| 253 | #* [MOLY00269510] [BIANCO][MT6763][RDIT][PHONE][PHYTest][SW] Modem only load can't boot in trunk/R2 branch |
| 254 | #* |
| 255 | #* . |
| 256 | #* |
| 257 | #* 07 31 2017 carl.kao |
| 258 | #* [MOLY00267693] [Gen93] [SystemService] [Auto-Gen] Modify MPU for setting RAMDISK to RW |
| 259 | #* . |
| 260 | #* |
| 261 | #* 07 25 2017 carl.kao |
| 262 | #* [MOLY00265930] [Gen93] [SystemService] [Auto-Gen] AMMS DRDI stage 3 (integrate AMMS with MD DRDI) |
| 263 | #* [AMMS STAGE 3/DRDI] main code |
| 264 | #* |
| 265 | #* 07 12 2017 tero.jarkko |
| 266 | #* [MOLY00263922] [Gen93][SystemService][Auto-Gen]MPU size optimization |
| 267 | #* |
| 268 | #* . |
| 269 | #* |
| 270 | #* 06 08 2017 tero.jarkko |
| 271 | #* [MOLY00256019] [BIANCO][MT6763][RDIT][FT][FDD][CU][SH][SIM1:CU][SIM2:NA][Fatal error(task)] err_code1:0x00003104 err_code2:0x00000000 err_code3:0xCCCCCCCC |
| 272 | #* |
| 273 | #* . |
| 274 | #* |
| 275 | #* 05 18 2017 tero.jarkko |
| 276 | #* [MOLY00250578] [System Software]change backdoor as UC to avoid coherence issue |
| 277 | #* |
| 278 | #* . |
| 279 | #* |
| 280 | #* 05 16 2017 tero.jarkko |
| 281 | #* [MOLY00249784] [Gen93][SystemService][Auto-Gen]Split static L2C LOCK and dynamic L2C LOCK section to different output section |
| 282 | #* |
| 283 | #* . |
| 284 | #* |
| 285 | #* 05 03 2017 carl.kao |
| 286 | #* [MOLY00245670] [Gen93] [SystemService] [Auto-Gen] (1) Reduce MPU entry and (2) Set CUIF bank6 as cacheable |
| 287 | #* Set EXTSRAM as RW |
| 288 | #* |
| 289 | #* 05 03 2017 carl.kao |
| 290 | #* [MOLY00245670] [Gen93] [SystemService] [Auto-Gen] (1) Reduce MPU entry and (2) Set CUIF bank6 as cacheable |
| 291 | #* 1 MB MPU granularity taken in use |
| 292 | #* |
| 293 | #* 05 02 2017 carl.kao |
| 294 | #* [MOLY00245670] [Gen93] [SystemService] [Auto-Gen] (1) Reduce MPU entry and (2) Set CUIF bank6 as cacheable |
| 295 | #* Rollback "cross core access to I/DSPRAM enabled" to save MPU entries |
| 296 | #* |
| 297 | #* 05 02 2017 carl.kao |
| 298 | #* [MOLY00245670] [Gen93] [SystemService] [Auto-Gen] (1) Reduce MPU entry and (2) Set CUIF bank6 as cacheable |
| 299 | #* AutoGen, regioninit, DSM part |
| 300 | #* |
| 301 | #* 04 04 2017 tero.jarkko |
| 302 | #* [MOLY00239310] [Gen93/LR13][SystemService][Auto-Gen][MT6763]Fix core1 null protection |
| 303 | #* |
| 304 | #* . |
| 305 | #* |
| 306 | #* 03 02 2017 tero.jarkko |
| 307 | #* [MOLY00232738] [Gen93][MT6763][SystemService][DSMGR]DSMGR support for MT6763 |
| 308 | #* |
| 309 | #* . |
| 310 | #* |
| 311 | #* 01 20 2017 tero.jarkko |
| 312 | #* [MOLY00226093] [Gen93/LR13][SystemService][Auto-Gen][Bianco Bring-up]Modify SPRAM size and address |
| 313 | #* |
| 314 | #* . |
| 315 | #* |
| 316 | #* 01 20 2017 tero.jarkko |
| 317 | #* [MOLY00226093] [Gen93/LR13][SystemService][Auto-Gen][Bianco Bring-up]Modify SPRAM size and address |
| 318 | #* |
| 319 | #* . |
| 320 | #* |
| 321 | #* 01 18 2017 tero.jarkko |
| 322 | #* [MOLY00225658] [Gen93/LR13][SystemService][Auto-Gen][Bianco Bring-up]Modify/Add IOCU section in bank 2/3 |
| 323 | #* |
| 324 | #* . |
| 325 | #* |
| 326 | #* 12 13 2016 tero.jarkko |
| 327 | #* [MOLY00218335] [Gen93/LR13][SystemService][Auto-Gen][MPU]Bank1 MPU protection |
| 328 | #* |
| 329 | #* . |
| 330 | #* |
| 331 | #* 11 29 2016 tero.jarkko |
| 332 | #* [MOLY00215759] [Gen93/LR13][SystemService][Auto-Gen][MPU] Null pointer protection |
| 333 | #* |
| 334 | #* . |
| 335 | #* |
| 336 | #* 11 17 2016 tero.jarkko |
| 337 | #* [MOLY00213928] [Gen93/LR13][SystemService][Auto-Gen] AutoGen generated lds file |
| 338 | #* |
| 339 | #* . |
| 340 | #* |
| 341 | #* 11 08 2016 tero.jarkko |
| 342 | #* [MOLY00205040] [Gen93/LR13][SystemService][Auto-Gen] AutoGen generated MPU settings |
| 343 | #* |
| 344 | #* . |
| 345 | #* |
| 346 | #* 10 20 2016 tero.jarkko |
| 347 | #* [MOLY00205040] [Gen93/LR13][SystemService][Auto-Gen] AutoGen generated MPU settings |
| 348 | #* |
| 349 | #* . |
| 350 | #* |
| 351 | #*------------------------------------------------------------------------------ |
| 352 | #* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 353 | #*============================================================================ |
| 354 | #****************************************************************************/ |
| 355 | #**************************************************************************** |
| 356 | # Included Modules |
| 357 | #**************************************************************************** |
| 358 | use strict; |
| 359 | BEGIN { push @INC, './tools/', './tools/MemoryUtility/' } |
| 360 | use LinkerOutputParser; |
| 361 | use FileInfoParser; |
| 362 | use scatInfo; |
| 363 | use CommonUtility; |
| 364 | use Switch; |
| 365 | use constant { |
| 366 | MPU_NA => 0x00000038, |
| 367 | MPU_RO => 0x00000018, |
| 368 | MPU_ROEX => 0x00000010, |
| 369 | MPU_WO => 0x00000028, |
| 370 | MPU_RW => 0x00000008, |
| 371 | MPU_RWEX => 0x00000000, |
| 372 | MPU_CCA_UC => 0x00000002, |
| 373 | MPU_CCA_WB => 0x00000003, |
| 374 | MPU_CCA_CWBE => 0x00000004, |
| 375 | MPU_CCA_CWB => 0x00000005, |
| 376 | MPU_CCA_UCA => 0x00000007, |
| 377 | MPU_DYNAMIC => 0, |
| 378 | MPU_FIXED => 1, |
| 379 | MPU_NULL => 2, |
| 380 | }; |
| 381 | #**************************************************************************** |
| 382 | # Variables |
| 383 | #**************************************************************************** |
| 384 | my @MPU_table_core0; |
| 385 | my @MPU_table_core1; |
| 386 | my @MPU_table_core2; |
| 387 | my @MPU_table_core3; |
| 388 | my $mpu_null_index = undef; |
| 389 | my $g_MakeFile_ref = undef; |
| 390 | my @dynamic_regions = undef; |
| 391 | my $g_bb = undef; |
| 392 | my $mpu_dynamic_max = 0; |
| 393 | #**************************************************************************** |
| 394 | # Input |
| 395 | #**************************************************************************** |
| 396 | my ($elf_file, $sym_file, $lds_file, $MakeFile) = @ARGV; |
| 397 | |
| 398 | print "Parse symbol file $sym_file\n"; |
| 399 | LinkerOutputParser::FileParse($sym_file); |
| 400 | my $dummy_end = hex(LinkerOutputParser::Get_DUMMY_END_Base()); |
| 401 | |
| 402 | print "Parse lds file $lds_file\n\n"; |
| 403 | my $LinkInfo = lds_new scatInfo($lds_file, "ROM"); |
| 404 | my %MemInfo; |
| 405 | map { $MemInfo{$_->[0]} = [hex($_->[1]),hex($_->[2])] } (@{$LinkInfo->{ldsInfo}->{MEMORYInfo}}); |
| 406 | |
| 407 | $g_MakeFile_ref = &FileInfo::GetMakeFileRef($MakeFile); |
| 408 | $g_bb = &sysUtil::SwitchToClonedChip(&FileInfo::get("BOARD_VER")); |
| 409 | print "Modem Arch: ".$g_MakeFile_ref->{MTK_MODEM_ARCH}."\n"; |
| 410 | print "Board ver: ".$g_bb."\n"; |
| 411 | if ($g_MakeFile_ref->{MTK_MODEM_ARCH} =~ /MT6295/) |
| 412 | { |
| 413 | $mpu_null_index =27; |
| 414 | $mpu_dynamic_max = 13; |
| 415 | @dynamic_regions = ( |
| 416 | [[0] ,["MCURO_HWRW", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,MPU_ROEX,MPU_CCA_UCA,0x111], |
| 417 | [["MCURO_HWRW",LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURO_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_UCA,0x111,0], |
| 418 | [["EXTSRAM", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["L2CACHE_LOCK", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_UCA,0x111,0], |
| 419 | [["EXTSRAM_FS_ZI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["EXTSRAM_FS_ZI", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_UCA,0x111,0], |
| 420 | [["MCURO_HWRW", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURO_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_CWB,0x111,2], |
| 421 | [["MCURO_HWRW", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURO_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_CWB,0x111,6], |
| 422 | [["EXTSRAM", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_IOCU2_MCURW_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x111,2], |
| 423 | [["EXTSRAM", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_IOCU3_READ_ALLOC_MCURW_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image],MPU_RW ,MPU_CCA_CWB,0x111,6], |
| 424 | [["DRDI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["DRDI", LinkerSymPostfix::Limit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_CWB,0x111,6], |
| 425 | [["DRDI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["DRDI", LinkerSymPostfix::Limit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_CWB,0x111,0], |
| 426 | [["L2CACHE_LOCK", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["L2CACHE_LOCK", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RWEX,MPU_CCA_CWB,0x111,9], |
| 427 | [["CACHED_EXTSRAM_IOCU3_READ_ALLOC_MCURW_HWRW", LinkerSymPostfix::Base,LinkerSymPrefix::Image],["CACHED_EXTSRAM_IOCU3_READ_ALLOC_MCURW_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image],MPU_RW ,MPU_CCA_CWB,0x111,3], |
| 428 | [["EXTSRAM_CORE0", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_CORE0", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_WB ,0x001,2], |
| 429 | [["EXTSRAM_CORE0", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_CORE0", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_NA ,MPU_CCA_UCA,0x110,0], |
| 430 | [["EXTSRAM_CORE1", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_CORE1", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_WB ,0x010,2], |
| 431 | [["EXTSRAM_CORE1", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_CORE1", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_NA ,MPU_CCA_UCA,0x101,0], |
| 432 | [[0x1f000000] ,[0x1f020000] ,MPU_RW ,MPU_CCA_UC ,0x111], |
| 433 | [[0x1fC00000] ,[0x1fC20000] ,MPU_RW ,MPU_CCA_UC ,0x111]); |
| 434 | } elsif ($g_MakeFile_ref->{MTK_MODEM_ARCH} =~ /MT6297/) { |
| 435 | $mpu_null_index =31; |
| 436 | $mpu_dynamic_max = 19; |
| 437 | if ((($g_bb =~ /MT6297_FPGA/) and (FileInfo::get("CUSTOM_FLAVOR") =~/_SAP/)) or ($g_bb =~ /MT6885_FPGA/)) { |
| 438 | @dynamic_regions = ( |
| 439 | [[0] ,["MCURO_HWRW", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,MPU_ROEX,MPU_CCA_UCA,0x1111], |
| 440 | [["MCURO_HWRW",LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURO_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_UCA,0x1111,0], |
| 441 | [["MCURO_HWRW", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURO_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_CWB,0x1111,6], |
| 442 | [["DRDI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["DRDI", LinkerSymPostfix::Limit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_CWB,0x1111,2], |
| 443 | #[["DRDI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["DRDI", LinkerSymPostfix::Limit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_CWB,0x111,0], |
| 444 | [["EXTSRAM", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURW_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_UCA,0x1111,0], |
| 445 | [["EXTSRAM", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURW_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x1111,6], |
| 446 | [["EXTSRAM", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_IOCU2_ULTRA_DATA", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x1111,2], |
| 447 | [["EXTSRAM_ULTRA_DATA", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_IOCU3_MCURW_HWRW_15", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x1111,3], |
| 448 | [["EXTSRAM_FS_ZI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["EXTSRAM_FS_ZI", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_UCA,0x1111,0], |
| 449 | [["L2SRAM_L2C_CODE", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["L2SRAM_L2C_DATA", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RWEX,MPU_CCA_CWB,0x1111,9], |
| 450 | [["USPRAM_CODE", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["USPRAM_DATA", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RWEX,MPU_CCA_CWB,0x1111,9], |
| 451 | [[0x1f000000] ,[0x1f020000] ,MPU_RW ,MPU_CCA_UC ,0x1111], |
| 452 | [[0x1fC00000] ,[0x1fC20000] ,MPU_RW ,MPU_CCA_UC ,0x1111]); |
| 453 | } elsif (FileInfo::is("PLATFORM", "MT6297")){ |
| 454 | @dynamic_regions = ( |
| 455 | [[0] ,["MCURO_HWRW", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,MPU_ROEX,MPU_CCA_UCA,0x1111], |
| 456 | [["MCURO_HWRW",LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURO_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_UCA,0x1111,0], |
| 457 | [["MCURO_HWRW", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURO_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_CWB,0x1111,6], |
| 458 | [["DRDI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["DRDI", LinkerSymPostfix::Limit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_CWB,0x1111,2], |
| 459 | #[["DRDI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["DRDI", LinkerSymPostfix::Limit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_CWB,0x111,0], |
| 460 | [["EXTSRAM", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["EXTSRAM_DSP_RX_ZI", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_UCA,0x1111,0], |
| 461 | [[0x10000000] ,["CACHED_EXTSRAM_MCURW_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_UCA,0x1111,1], |
| 462 | [["EXTSRAM", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["EXTSRAM_DSP_RX_ZI", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x1111,6], |
| 463 | [[0x70000000] ,["CACHED_EXTSRAM_MCURW_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x1111,7], |
| 464 | [["EXTSRAM", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_IOCU2_ULTRA_DATA", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x1111,2], |
| 465 | [["EXTSRAM_ULTRA_DATA", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_IOCU3_MCURW_HWRW_15", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x1111,3], |
| 466 | [["EXTSRAM_FS_ZI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["EXTSRAM_FS_ZI", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_UCA,0x1111,1], |
| 467 | [["L2SRAM_L2C_CODE", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["L2SRAM_L2C_CODE", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_ROEX,MPU_CCA_CWB,0x1111,9], |
| 468 | [["L2SRAM_L2C_DATA", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["L2SRAM_L2C_DATA", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x1111,9], |
| 469 | [[0x1f000000] ,[0x1f020000] ,MPU_RW ,MPU_CCA_UC ,0x1111], |
| 470 | [[0x1fC00000] ,[0x1fC20000] ,MPU_RW ,MPU_CCA_UC ,0x1111]) |
| 471 | |
| 472 | } elsif (FileInfo::is("PLATFORM", "MT6885") || FileInfo::is("PLATFORM", "MT6873")) { |
| 473 | @dynamic_regions = ( |
| 474 | [[0] ,["MCURO_HWRW", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,MPU_ROEX,MPU_CCA_UCA,0x1111], |
| 475 | [["MCURO_HWRW",LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURO_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_UCA,0x1111,0], |
| 476 | [["MCURO_HWRW", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURO_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_CWB,0x1111,6], |
| 477 | [["EXTSRAM", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURW_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_UCA,0x1111,0], |
| 478 | [["EXTSRAM", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURW_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x1111,6], |
| 479 | [["EXTSRAM", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_IOCU2_ULTRA_DATA", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x1111,2], |
| 480 | [["EXTSRAM_ULTRA_DATA", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_IOCU3_MCURW_HWRW_ZI_15", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x1111,3], |
| 481 | [["DRDI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["DRDI", LinkerSymPostfix::Limit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_UCA,0x1111,0], |
| 482 | [["DRDI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["DRDI", LinkerSymPostfix::Limit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_CWB,0x1111,6], |
| 483 | [["EXTSRAM_FS_ZI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["EXTSRAM_FS_ZI", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_UCA,0x1111,1], |
| 484 | [["L2SRAM_L2C_CODE", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["L2SRAM_L2C_CODE", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_ROEX,MPU_CCA_CWB,0x1111,9], |
| 485 | [["L2SRAM_L2C_DATA", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["L2SRAM_L2C_DATA", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x1111,9], |
| 486 | [["MCURW_HWRW_DNC_SS_EXT_CSIF", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["MCURW_HWRW_DNC_NL1_EXT_CSIF", LinkerSymPostfix::Limit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_UCA,0x1111,0], |
| 487 | [["MCURW_HWRW_DNC_SS_EXT_CSIF", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["MCURW_HWRW_DNC_NL1_EXT_CSIF", LinkerSymPostfix::Limit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x1111,6], |
| 488 | [[0x1f000000] ,[0x1f020000] ,MPU_RW ,MPU_CCA_UC ,0x1111], |
| 489 | [[0x1fC00000] ,[0x1fC20000] ,MPU_RW ,MPU_CCA_UC ,0x1111]) |
| 490 | } else { |
| 491 | @dynamic_regions = ( |
| 492 | [[0] ,["MCURO_HWRW", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,MPU_ROEX,MPU_CCA_UCA,0x1111], |
| 493 | [["MCURO_HWRW",LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURO_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_UCA,0x1111,0], |
| 494 | [["MCURO_HWRW", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURO_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_CWB,0x1111,6], |
| 495 | [["EXTSRAM", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURW_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_UCA,0x1111,0], |
| 496 | [["EXTSRAM", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURW_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x1111,6], |
| 497 | [["EXTSRAM", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_IOCU2_ULTRA_DATA", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x1111,2], |
| 498 | [["EXTSRAM_ULTRA_DATA", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_IOCU3_MCURW_HWRW_ZI_15", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x1111,3], |
| 499 | [["DRDI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["DRDI", LinkerSymPostfix::Limit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_UCA,0x1111,0], |
| 500 | [["DRDI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["DRDI", LinkerSymPostfix::Limit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_CWB,0x1111,6], |
| 501 | [["EXTSRAM_FS_ZI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["EXTSRAM_FS_ZI", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_UCA,0x1111,1], |
| 502 | [["L2SRAM_L2C_CODE", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["L2SRAM_L2C_CODE", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_ROEX,MPU_CCA_CWB,0x1111,9], |
| 503 | [["L2SRAM_L2C_DATA", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["L2SRAM_L2C_DATA", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x1111,9], |
| 504 | [[0x1f000000] ,[0x1f020000] ,MPU_RW ,MPU_CCA_UC ,0x1111], |
| 505 | [[0x1fC00000] ,[0x1fC20000] ,MPU_RW ,MPU_CCA_UC ,0x1111]) |
| 506 | } |
| 507 | unshift @dynamic_regions, [[0],["MCURO_HWRW", LinkerSymPostfix::Base,LinkerSymPrefix::Image],MPU_ROEX,MPU_CCA_CWB,0x1111,9] if(FileInfo::is("MTK_MODEM_ARCH", "MT6297") or FileInfo::is("MTK_MODEM_ARCH", "MT6297P")); |
| 508 | } else { |
| 509 | $mpu_null_index =21; |
| 510 | $mpu_dynamic_max = 13; |
| 511 | @dynamic_regions = ( |
| 512 | [[0] ,["MCURO_HWRW", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,MPU_ROEX,MPU_CCA_UCA,0x111], |
| 513 | [["MCURO_HWRW",LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURO_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_UCA,0x111,0], |
| 514 | [["EXTSRAM", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["L2CACHE_LOCK", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_UCA,0x111,0], |
| 515 | [["EXTSRAM_FS_ZI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["EXTSRAM_FS_ZI", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_UCA,0x111], |
| 516 | [["MCURO_HWRW", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_MCURO_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_CWB,0x111,6], |
| 517 | [["EXTSRAM", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_IOCU3_READ_ALLOC_MCURW_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image],MPU_RW ,MPU_CCA_CWB,0x111,6], |
| 518 | [["DRDI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["DRDI", LinkerSymPostfix::Limit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_CWB,0x111,6], |
| 519 | [["DRDI", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["DRDI", LinkerSymPostfix::Limit,LinkerSymPrefix::Image] ,MPU_RO ,MPU_CCA_CWB,0x111,0], |
| 520 | [["CACHED_EXTSRAM_L2CACHE_LOCK_DATA", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["DYNAMIC_SECTION_L2CACHE_LOCK_0", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RWEX,MPU_CCA_CWB,0x111,9], |
| 521 | [["DYNAMIC_SECTION_L2CACHE_LOCK_L_IDLE", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["DYNAMIC_SECTION_L2CACHE_LOCK_C_DO_DATALINK", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image],MPU_RWEX,MPU_CCA_CWB,0x111,9], |
| 522 | [["CACHED_EXTSRAM_IOCU2_MCURW_HWRW", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_IOCU2_MCURW_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_CWB,0x111,2], |
| 523 | [["CACHED_EXTSRAM_IOCU3_READ_ALLOC_MCURW_HWRW", LinkerSymPostfix::Base,LinkerSymPrefix::Image],["CACHED_EXTSRAM_IOCU3_READ_ALLOC_MCURW_HWRW", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image],MPU_RW ,MPU_CCA_CWB,0x111,3], |
| 524 | [["EXTSRAM_CORE0", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_CORE0", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_WB ,0x001,6], |
| 525 | [["EXTSRAM_CORE0", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_CORE0", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_NA ,MPU_CCA_UCA,0x110,0], |
| 526 | [["EXTSRAM_CORE1", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_CORE1", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_RW ,MPU_CCA_WB ,0x010,6], |
| 527 | [["EXTSRAM_CORE1", LinkerSymPostfix::Base,LinkerSymPrefix::Image] ,["CACHED_EXTSRAM_CORE1", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_NA ,MPU_CCA_UCA,0x101,0], |
| 528 | [[0x1f000000] ,[0x1f020000] ,MPU_RW ,MPU_CCA_UC ,0x111], |
| 529 | [[0x1fC00000] ,[0x1fC20000] ,MPU_RW ,MPU_CCA_UC ,0x111]); |
| 530 | } |
| 531 | |
| 532 | |
| 533 | |
| 534 | my @fixed_core0 = ([[0x9FB00000] ,[0x9FB3FFFF] ,MPU_ROEX ,MPU_CCA_CWB ,0x0001]);# bootslave |
| 535 | |
| 536 | my @fixed_core1 = ([[0x9FB40000] ,[0x9FB7FFFF] ,MPU_ROEX ,MPU_CCA_CWB ,0x0010]); |
| 537 | |
| 538 | my @fixed_core2 = ([[0x9FB80000] ,[0x9FBBFFFF] ,MPU_ROEX ,MPU_CCA_CWB ,0x0100]); |
| 539 | |
| 540 | my @fixed_core3 = ([[0x9FBC0000] ,[0x9FBFFFFF] ,MPU_ROEX ,MPU_CCA_CWB ,0x1000]); |
| 541 | |
| 542 | my @null_prot = ( [[0] ,["ROM", LinkerSymPostfix::ZILimit,LinkerSymPrefix::Image] ,MPU_NA ,MPU_CCA_UC ,0x1111,0]);#21 |
| 543 | #**************************************************************************** |
| 544 | # >>> Main Flow |
| 545 | #**************************************************************************** |
| 546 | # Parse regions table and create MPU region tables |
| 547 | print "\nCalculate dynamic MPU entries:\n"; |
| 548 | Parse_regions(\@dynamic_regions,MPU_DYNAMIC); |
| 549 | if(($#MPU_table_core0 >= $mpu_dynamic_max) or ($#MPU_table_core1 >= $mpu_dynamic_max) or ($#MPU_table_core2 >= $mpu_dynamic_max) or ($#MPU_table_core3 >= $mpu_dynamic_max)) { |
| 550 | print "\nERROR: Dynamic mpu entry count exceeded max count ".$mpu_dynamic_max."\n"; |
| 551 | print "\nCORE 0 MPU table:\n"; |
| 552 | PrintMPUTable(\@MPU_table_core0); |
| 553 | print "\nCORE 1 MPU table:\n"; |
| 554 | PrintMPUTable(\@MPU_table_core1); |
| 555 | print "\nCORE 2 MPU table:\n"; |
| 556 | PrintMPUTable(\@MPU_table_core2); |
| 557 | print "\nCORE 3 MPU table:\n"; |
| 558 | PrintMPUTable(\@MPU_table_core3); |
| 559 | exit 1; |
| 560 | } |
| 561 | if ($g_MakeFile_ref->{MTK_MODEM_ARCH} =~ /MT6297/) { |
| 562 | FillTable(\@MPU_table_core0,19); |
| 563 | FillTable(\@MPU_table_core1,19); |
| 564 | FillTable(\@MPU_table_core2,19); |
| 565 | FillTable(\@MPU_table_core3,19); |
| 566 | |
| 567 | print "\nCalculate CORE0 MPU entries:\n"; |
| 568 | Parse_regions(\@fixed_core0,MPU_FIXED); |
| 569 | print "\nCalculate CORE1 MPU entries:\n"; |
| 570 | Parse_regions(\@fixed_core1,MPU_FIXED); |
| 571 | print "\nCalculate CORE2 MPU entries:\n"; |
| 572 | Parse_regions(\@fixed_core2,MPU_FIXED); |
| 573 | print "\nCalculate CORE3 MPU entries:\n"; |
| 574 | Parse_regions(\@fixed_core3,MPU_FIXED); |
| 575 | } |
| 576 | FillTable(\@MPU_table_core0,$mpu_null_index); |
| 577 | FillTable(\@MPU_table_core1,$mpu_null_index); |
| 578 | FillTable(\@MPU_table_core2,$mpu_null_index); |
| 579 | FillTable(\@MPU_table_core3,$mpu_null_index); |
| 580 | |
| 581 | Parse_regions(\@null_prot,MPU_NULL); |
| 582 | FillTable(\@MPU_table_core0,32); |
| 583 | FillTable(\@MPU_table_core1,32); |
| 584 | FillTable(\@MPU_table_core2,32); |
| 585 | FillTable(\@MPU_table_core3,32); |
| 586 | |
| 587 | print "\nCORE 0 MPU table:\n"; |
| 588 | PrintMPUTable(\@MPU_table_core0); |
| 589 | print "\nCORE 1 MPU table:\n"; |
| 590 | PrintMPUTable(\@MPU_table_core1); |
| 591 | print "\nCORE 2 MPU table:\n"; |
| 592 | PrintMPUTable(\@MPU_table_core2); |
| 593 | print "\nCORE 3 MPU table:\n"; |
| 594 | PrintMPUTable(\@MPU_table_core3); |
| 595 | print "\nUpdate ELF file: $elf_file\n"; |
| 596 | print "\nUpdate Core 0 MPU info to ELF file: $elf_file\n"; |
| 597 | UpdateMPUtoELF($elf_file,\@MPU_table_core0,GetSymbolAddressFromElf("mpu_region_config_core0")); |
| 598 | print "\nUpdate Core 1 MPU info to ELF file: $elf_file\n"; |
| 599 | UpdateMPUtoELF($elf_file,\@MPU_table_core1,GetSymbolAddressFromElf("mpu_region_config_core1")); |
| 600 | print "\nUpdate Core 2 MPU info to ELF file: $elf_file\n"; |
| 601 | UpdateMPUtoELF($elf_file,\@MPU_table_core2,GetSymbolAddressFromElf("mpu_region_config_core2")); |
| 602 | print "\nUpdate Core 3 MPU info to ELF file: $elf_file\n"; |
| 603 | UpdateMPUtoELF($elf_file,\@MPU_table_core3,GetSymbolAddressFromElf("mpu_region_config_core3")); |
| 604 | print "End\n"; |
| 605 | exit 0; |
| 606 | |
| 607 | #**************************************************************************** |
| 608 | # Subroutines |
| 609 | #**************************************************************************** |
| 610 | sub Parse_regions |
| 611 | { |
| 612 | my ($table_ref,$mode) = @_; |
| 613 | foreach my $region_ref (@{$table_ref}) { |
| 614 | my $area_begin = 0; |
| 615 | my $area_end = 0; |
| 616 | my $area_length = 0; |
| 617 | if(($region_ref->[0][0]^$region_ref->[0][0])) { |
| 618 | $area_begin = hex(LinkerOutputParser::GetLinkerSymbolAddress($region_ref->[0][0],$region_ref->[0][1],$region_ref->[0][2])); |
| 619 | } else { |
| 620 | $area_begin = $region_ref->[0][0]; |
| 621 | } |
| 622 | if(($region_ref->[1][0]^$region_ref->[1][0])) { |
| 623 | $area_end = hex(LinkerOutputParser::GetLinkerSymbolAddress($region_ref->[1][0],$region_ref->[1][1],$region_ref->[1][2])); |
| 624 | } else { |
| 625 | $area_end = $region_ref->[1][0]; |
| 626 | } |
| 627 | if (defined $region_ref->[5]) { |
| 628 | $area_begin = get_physical_address($area_begin)| $region_ref->[5]<<28; |
| 629 | $area_end = get_physical_address($area_end) | $region_ref->[5]<<28; |
| 630 | } |
| 631 | $area_length = $area_end - $area_begin; |
| 632 | |
| 633 | print "Start: " .&CommonUtil::Dec2Hex($area_begin)." End: " .&CommonUtil::Dec2Hex($area_end)." Length: " .&CommonUtil::Dec2Hex($area_length). " ". get_mpu($region_ref->[2]|$region_ref->[3]) . "\n"; |
| 634 | if ($area_length > 0) { |
| 635 | my @mpu_info = @{GetMPUinfo($area_begin,$area_length,$mode)}; |
| 636 | foreach my $mpu (@mpu_info) { |
| 637 | my $control_reg = (0<<15)|($mpu->[1]<<10)|(($mpu->[2]-1)<<6)|$region_ref->[2]|$region_ref->[3]; |
| 638 | InsertMPURegion($mpu->[0],$control_reg,$region_ref->[4]); |
| 639 | } |
| 640 | } elsif (($mode == MPU_FIXED) || ($mode == MPU_NULL)) { |
| 641 | InsertMPURegion(0,0,$region_ref->[4]); |
| 642 | } |
| 643 | } |
| 644 | } |
| 645 | |
| 646 | sub FillTable |
| 647 | { |
| 648 | my ($table_ref, $elements) = @_; |
| 649 | my $index = $#{$table_ref}; |
| 650 | for ($index+=1;$index<$elements;$index+=1) { |
| 651 | push @{$table_ref}, [0,0]; |
| 652 | } |
| 653 | } |
| 654 | |
| 655 | sub UpdateMPUtoELF |
| 656 | { |
| 657 | my ($elf,$table_ref,$offset) = @_; |
| 658 | if ($offset == 0) { |
| 659 | print "MPU table address invalid. $elf not updated\n"; |
| 660 | return; |
| 661 | } |
| 662 | open (my $BIN_FILE, "+<$elf") or die "Open $elf file failed\n"; |
| 663 | binmode $BIN_FILE; |
| 664 | seek $BIN_FILE, $offset,0; |
| 665 | foreach my $region (@$table_ref) { |
| 666 | print $BIN_FILE pack('L<[2]',@{$region}); |
| 667 | } |
| 668 | close $BIN_FILE; |
| 669 | print "$elf file updated successfully\n"; |
| 670 | } |
| 671 | |
| 672 | sub InsertMPURegion |
| 673 | { |
| 674 | my ($base,$control,$core) = @_; |
| 675 | push @MPU_table_core0, [$base,$control] if ($core & 0x0001); |
| 676 | push @MPU_table_core1, [$base,$control] if ($core & 0x0010); |
| 677 | push @MPU_table_core2, [$base,$control] if ($core & 0x0100); |
| 678 | push @MPU_table_core3, [$base,$control] if ($core & 0x1000); |
| 679 | } |
| 680 | |
| 681 | sub msb |
| 682 | { |
| 683 | my ($n, $base) = (shift, 0); |
| 684 | $base++ while $n >>= 1; |
| 685 | return $base; |
| 686 | } |
| 687 | |
| 688 | sub lsb |
| 689 | { |
| 690 | my $n = shift; |
| 691 | return msb($n & -$n); |
| 692 | } |
| 693 | |
| 694 | sub get_mpu |
| 695 | { |
| 696 | my ($mpu) = @_; |
| 697 | my $rval =""; |
| 698 | switch ($mpu & 0x38) { |
| 699 | case MPU_NA { $rval .= "MPU_NA "; } |
| 700 | case MPU_RO { $rval .= "MPU_RO "; } |
| 701 | case MPU_ROEX { $rval .= "MPU_ROEX"; } |
| 702 | case MPU_WO { $rval .= "MPU_WO "; } |
| 703 | case MPU_RW { $rval .= "MPU_RW "; } |
| 704 | case MPU_RWEX { $rval .= "MPU_RWEX"; } |
| 705 | } |
| 706 | switch ($mpu & 0x7) { |
| 707 | case MPU_CCA_UC { $rval .= " MPU_CCA_UC "; } |
| 708 | case MPU_CCA_WB { $rval .= " MPU_CCA_WB "; } |
| 709 | case MPU_CCA_CWBE { $rval .= " MPU_CCA_CWBE"; } |
| 710 | case MPU_CCA_CWB { $rval .= " MPU_CCA_CWB "; } |
| 711 | case MPU_CCA_UCA { $rval .= " MPU_CCA_UCA ";} |
| 712 | } |
| 713 | return $rval; |
| 714 | } |
| 715 | |
| 716 | sub GetPageSize |
| 717 | { |
| 718 | my ($addr) = @_; |
| 719 | my $pagesize = 1<<$addr; |
| 720 | return sprintf("%4.dB ",$pagesize) if($pagesize <= 1024); |
| 721 | $pagesize /= 1024; |
| 722 | if ($pagesize <= 1024) { |
| 723 | return sprintf("%4.dKB",$pagesize); |
| 724 | } else { |
| 725 | return sprintf("%4.dMB",$pagesize/1024); |
| 726 | } |
| 727 | } |
| 728 | |
| 729 | sub GetGran |
| 730 | { |
| 731 | my ($val) = @_; |
| 732 | return 28 if ($val == 0); |
| 733 | return lsb($val); |
| 734 | } |
| 735 | |
| 736 | sub GetMPUinfo |
| 737 | { |
| 738 | my ($start, $length,$type) = @_; |
| 739 | my $addr_gran = GetGran($start); |
| 740 | my @mpu_pages; |
| 741 | if ($type == MPU_NULL) { |
| 742 | my $page_size = msb($length)-3; |
| 743 | $page_size = 5 if($page_size < 5); |
| 744 | if ($addr_gran >= $page_size) { |
| 745 | my $page_count = ($length>>$page_size); |
| 746 | $page_size += lsb($page_count); |
| 747 | $page_count >>= lsb($page_count); |
| 748 | push @mpu_pages,[$start, $page_size, $page_count]; |
| 749 | } |
| 750 | } else { |
| 751 | if ($length != 0) { |
| 752 | #set MPU area total resrvation size to 0 |
| 753 | my $reserved_size = 0; |
| 754 | #current length MPU area to be allocated |
| 755 | my $current_length = $length; |
| 756 | #initial allocated page count |
| 757 | my $page_count = 0; |
| 758 | #initial page size is determined from length |
| 759 | my $page_size = msb($current_length)-3; |
| 760 | #check that if we still need to make MPU allocation |
| 761 | while ($reserved_size < $length) { |
| 762 | #Page size cannot be less than 32 bytes |
| 763 | $page_size = 5 if($page_size < 5); |
| 764 | #Check if we are using address or length granularity to determine page size. |
| 765 | if ($addr_gran < $page_size) { |
| 766 | $page_size = $addr_gran; |
| 767 | } |
| 768 | $page_count = ($current_length>>$page_size); |
| 769 | #check do we need add one more page if we have tailing bytes in current allocation |
| 770 | $page_count += 1 if (((1<<$page_size)-1) & $current_length); |
| 771 | if (($page_count+(($start>>$page_size) &0xf)) > 16) { |
| 772 | #if we are allocating more than 16 pages we increase page_size but not exceed address granularity |
| 773 | if ($page_size<$addr_gran) { |
| 774 | $page_size +=1; |
| 775 | next; |
| 776 | } |
| 777 | #if we cannot increase page size we allocate as many pages as possible. |
| 778 | $page_count = 16-(($start>>$page_size) &0xf); |
| 779 | } |
| 780 | #check if we can use larger page granularity for allocation. Without exceeding address granularity |
| 781 | my $i = lsb($page_count); |
| 782 | if ($i!=0) { |
| 783 | if ($addr_gran < ($page_size+$i)) { |
| 784 | $i = $addr_gran-$page_size; |
| 785 | } |
| 786 | $page_count >>=$i; |
| 787 | $page_size +=$i; |
| 788 | } |
| 789 | push @mpu_pages,[$start, $page_size, $page_count]; |
| 790 | #calculate total reservation size |
| 791 | $reserved_size += $page_count<<$page_size; |
| 792 | #calculate remaining reservation start address |
| 793 | $start += $page_count<<$page_size; |
| 794 | #calculate new address page granularity |
| 795 | $addr_gran = GetGran($start); |
| 796 | #remaining area to be allocated |
| 797 | $current_length -= $page_count<<$page_size; |
| 798 | #new initial page size |
| 799 | $page_size = msb($current_length)-3; |
| 800 | } |
| 801 | } |
| 802 | } |
| 803 | if (($type == MPU_FIXED)|| ($type == MPU_NULL)) { |
| 804 | push @mpu_pages, [0,0,0] if (@mpu_pages == undef); |
| 805 | } |
| 806 | return \@mpu_pages; |
| 807 | } |
| 808 | |
| 809 | sub PrintMPUTable |
| 810 | { |
| 811 | my ($table_ref) = @_; |
| 812 | #Print table |
| 813 | my $index = 0; |
| 814 | print "Index Base Control Attr CCA Size Count\n"; |
| 815 | foreach my $region (@$table_ref) { |
| 816 | if ($region->[1]) { |
| 817 | print " $index " .&CommonUtil::Dec2Hex($region->[0]) . " " .&CommonUtil::Dec2Hex($region->[1]). " ".&get_mpu($region->[1]); |
| 818 | my $page_size = GetPageSize(($region->[1]>>10)&0x1f); |
| 819 | my $page_count= (($region->[1]>>6)&0xf)+1; |
| 820 | print " $page_size $page_count\n"; |
| 821 | } else { |
| 822 | print " $index " .&CommonUtil::Dec2Hex($region->[0]) . " " .&CommonUtil::Dec2Hex($region->[1])."\n"; |
| 823 | } |
| 824 | $index +=1; |
| 825 | } |
| 826 | } |
| 827 | |
| 828 | sub GetSymbolAddressFromElf |
| 829 | { |
| 830 | my ($symName) = @_; |
| 831 | my $refSymbols = LinkerOutputParser::GetSymbol(); |
| 832 | my $syminfo = $refSymbols->{$symName}; |
| 833 | my $nSectionOffset = hex(LinkerOutputParser::GetExeRegionInfo($syminfo->[Symbol::Region], Region::Offsets)); |
| 834 | my $nSectionStart = hex(LinkerOutputParser::GetExeRegionInfo($syminfo->[Symbol::Region], Region::VMA)) & 0x0fffffff; |
| 835 | return ($nSectionOffset - $nSectionStart) + (hex($syminfo->[Symbol::Addr]) & 0x0fffffff); |
| 836 | } |
| 837 | |
| 838 | sub get_physical_address |
| 839 | { |
| 840 | my ($address) = @_; |
| 841 | my $addr_mask = 0x0fffffff; |
| 842 | my $bank = $address>>28; |
| 843 | if (($bank == 1) || ($bank == 7)) { |
| 844 | $addr_mask = 0x1fffffff; |
| 845 | } |
| 846 | return ($address & $addr_mask); |
| 847 | } |