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) 2006 |
| 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 | #* Filename: |
| 38 | #* --------- |
| 39 | #* ldsGenLib.pl |
| 40 | #* |
| 41 | #* Project: |
| 42 | #* -------- |
| 43 | #* |
| 44 | #* |
| 45 | #* Description: |
| 46 | #* ------------ |
| 47 | #* This script is to generate memory layout |
| 48 | #* |
| 49 | #* Author: |
| 50 | #* ------- |
| 51 | #* Carl Kao (mtk08237) |
| 52 | #* |
| 53 | #****************************************************************************/ |
| 54 | #**************************************************************************** |
| 55 | # Included Modules |
| 56 | #**************************************************************************** |
| 57 | use strict; |
| 58 | BEGIN { push @INC, "pcore/" , './pcore/tools/' } # add additional library path |
| 59 | use sysGenUtility; |
| 60 | use ldsFrame; |
| 61 | use FileInfoParser; |
| 62 | use config_MemSegment; |
| 63 | use tools::pack_dep_gen; |
| 64 | use POSIX qw(floor ceil); |
| 65 | PrintDependModule(); |
| 66 | |
| 67 | #**************************************************************************** |
| 68 | # 0 >>> exit; |
| 69 | #**************************************************************************** |
| 70 | return 1; |
| 71 | #**************************************************************************** |
| 72 | # Constant |
| 73 | #**************************************************************************** |
| 74 | |
| 75 | |
| 76 | #**************************************************************************** |
| 77 | # ldsGen Version |
| 78 | #**************************************************************************** |
| 79 | sub ldsGen_verno |
| 80 | { |
| 81 | return " v0.03_VMOLY + ldsFrame.pm ".&ldsFrame::ldsFrame_verno; |
| 82 | # v0.03_VMOLY, 2018/11/29, Tero, MT6297 FPGA builds uses 512MB memory map |
| 83 | # v0.02_VMOLY, 2018/11/19, Tero, MT6297 Ramdisk size increased to 32MB |
| 84 | # v0.01_VMOLY, 2018/10/17, Tero, MT6297 512MB memory config added |
| 85 | # a0.23_UMOLY, 2018/01/15, Tero, MT6295M/MT3967 increased L2C area size |
| 86 | # a0.22_UMOLY, 2018/01/17, Tero, MT6295M/MT3967 memory map updated |
| 87 | # a0.21_UMOLY, 2017/11/22, Tero, MT6739 memory map updated |
| 88 | # a0.20_UMOLY, 2017/02/11, Tero, MT6295M DSP size increased to 32M |
| 89 | # a0.19_UMOLY, 2017/09/27, Tero, MT6771 memory map updated |
| 90 | # a0.18_UMOLY, 2017/09/06, Tero, Adjusted MT6295M modem memoryy layout to 160MB |
| 91 | # a0.17_UMOLY, 2017/06/28, Carl, Reduced MT6763 modem size to 126MB |
| 92 | # a0.16_UMOLY, 2017/06/09, Tero, Reduced modem size to 248MB |
| 93 | # a0.15_UMOLY, 2017/04/21, Tero, Added support for MT6739 |
| 94 | # a0.14_UMOLY, 2017/04/20, Tero, MT6295M support added |
| 95 | # a0.13_UMOLY, 2017/01/18, Tero, IOCU3 section added |
| 96 | # a0.12_UMOLY, 2017/01/04, Tero, UROM Size increased |
| 97 | # a0.11_UMOLY, 2016/12/12, Tero, UROM Size increased |
| 98 | # a0.10_UMOLY, 2016/11/21, Tero, GENTX/RX_SIZE uses custom_flavor as mode parameter |
| 99 | # a0.09_UMOLY, 2016/10/27, Tero, Autogen generated LDS support for MT6763 |
| 100 | # a0.08_UMOLY, 2016/10/27, Tero, Remove unsued sections |
| 101 | # a0.08_UMOLY, 2016/08/01, Tero, l1core support removed |
| 102 | # a0.07_UMOLY, 2016/06/07, Carl, add GetRamdiskSize() for configruating ramdisk size |
| 103 | # a0.06_UMOLY, 2016/06/07, Carl, Change MD total size for 16MB ramdisk |
| 104 | # a0.05_UMOLY, 2016/04/15, Carl, Reduce UROM size, UROM and ROM share total 32 MB now |
| 105 | # a0.03_UMOLY, 2016/04/15, Carl, Do not use ISPRAM2, DSPRAM2 and L2SRAM in 93 |
| 106 | # a0.03_UMOLY, 2016/04/01, JI, Support M17 new chip |
| 107 | # a0.02_UMOLY, 2016/03/31, JI, Support M17 new chip |
| 108 | # a0.01_UMOLY, 2016/03/21, BM, Branch from UMOLY trunk |
| 109 | # |
| 110 | # u0.38_UMOLY, 2016/03/03, Tero, Added GenEXTSRAM_END function |
| 111 | # u0.37_UMOLY, 2016/02/17, Tero, Default memory configuration for ELBRUS |
| 112 | # u0.36_UMOLY, 2016/01/31, Tero, GENTX/RX_SIZE uses original_flavor as mode parameter |
| 113 | # u0.35_UMOLY, 2016/01/26, Carl, Avoid dump sections with name "PHYSICAL_BOUNDARY" (for SPRAM physical name) |
| 114 | # u0.34_UMOLY, 2016/01/18, Tero, Elbrus total memory size get support added |
| 115 | # u0.23_UMOLY, 2015/07/20, Carl, Support ldsGen for MT6797 |
| 116 | # u0.32_UMOLY, 2015/07/03, Carl, Change MT6755 MD only load size |
| 117 | # u0.31_UMOLY, 2015/06/23, Carl, Refine the way to use GetSharedMemorySize. It includes dsp tx/rx section now |
| 118 | # u0.30_UMOLY, 2015/06/05, Carl, Add MD size setting with ramdisk |
| 119 | # u0.29_UMOLY, 2015/06/04, Carl, Support ldsGen for MT6755 |
| 120 | # u0.28_UMOLY, 2015/05/11, Carl, Support Ramdisk for TK6291 |
| 121 | # u0.27_UMOLY, 2015/04/09, Carl, Align the shared DNC base to 64KB for input section MCU-RO, HW-RW (EMI RMPU) |
| 122 | # u0.26_UMOLY, 2015/01/26, Carl, Refine GetMPUAligned for adding debug log |
| 123 | # u0.25_UMOLY, 2015/01/06, Carl, lds refinement: 1) auto adjust shared region size, 2) reserve pcore, l1core SWLA space |
| 124 | # u0.24_UMOLY, 2014/12/22, Carl, Support L2SRAM section (in L1CORE) |
| 125 | # u0.23_UMOLY, 2014/11/25, Carl, Merge ATCM and BTCM as a single TCM |
| 126 | # u0.22_UMOLY, 2014/10/05, Carl, Align start address of shared memory section to 1MB |
| 127 | # u0.21_UMOLY, 2014/09/26, Carl, support GFH + SIG, move sig size to sysGenUtility.pm |
| 128 | # u0.21_UMOLY, 2014/09/26, Carl, support GFH + SIG |
| 129 | # u0.20_UMOLY, 2014/09/22, Carl, rename MT6291 to TK6291 |
| 130 | # u0.19_UMOLY, 2014/09/11, mei, support l1core memory dump |
| 131 | # u0.18_UMOLY, 2014/09/05, Carl, reduce default shared memory size for PCORE ONLY project |
| 132 | # u0.17_UMOLY, 2014/08/20, Carl, refine l1core dump region |
| 133 | # u0.16_UMOLY, 2014/08/19, Carl, update L1core reset vector load view |
| 134 | # u0.15_UMOLY, 2014/07/31, Carl, dump l1core region |
| 135 | # u0.14_UMOLY, 2014/06/27, Carl, provide linker symbol rather than hardcode |
| 136 | # ... |
| 137 | # u0.01_UMOLY, 2014/02/20, BM, porting to MT6291_DEV |
| 138 | |
| 139 | } |
| 140 | |
| 141 | #**************************************************************************** |
| 142 | # Constants |
| 143 | #**************************************************************************** |
| 144 | |
| 145 | |
| 146 | #**************************************************************************** |
| 147 | # Global Variables |
| 148 | #**************************************************************************** |
| 149 | my $g_bb = undef; |
| 150 | my $g_nRamSize = undef; |
| 151 | my $g_bNeedBL = undef; |
| 152 | my $g_BBFolder = undef; |
| 153 | my $g_MakeFilePath = undef; |
| 154 | my $g_MakeFile_ref = undef; |
| 155 | my $g_nRAM_BASE = 0; |
| 156 | |
| 157 | my $g_l1core_offset = 0; |
| 158 | #**************************************************************************** |
| 159 | # Input Parameters |
| 160 | #**************************************************************************** |
| 161 | |
| 162 | #**************************************************************************** |
| 163 | # subroutines |
| 164 | #**************************************************************************** |
| 165 | |
| 166 | #**************************************************************************** |
| 167 | # Unsupport: $flash_href, $flash_blk_href |
| 168 | # $nor_device, $fota_cfg, |
| 169 | # $mem_dev_h_cfg |
| 170 | # $IsFlashtoolLayoutInput, $use_dummy_scatter, $feature_config, $nFactoryBinSize |
| 171 | #**************************************************************************** |
| 172 | sub ldsGen_main |
| 173 | { |
| 174 | ($g_bb, $g_nRamSize, $g_bNeedBL, $g_BBFolder, $g_MakeFilePath) = @_; |
| 175 | $g_MakeFile_ref = &FileInfo::GetMakeFileRef($g_MakeFilePath); |
| 176 | if ((FileInfo::is("BOARD_VER", "MT6297_FPGA") or FileInfo::is("BOARD_VER", "MT6885_FPGA")) and (FileInfo::get("CUSTOM_FLAVOR") =~/_SAP/)) { |
| 177 | $g_bb = &sysUtil::SwitchToClonedChip("MT6297_FPGA"); |
| 178 | } else { |
| 179 | $g_bb = &sysUtil::SwitchToClonedChip($g_bb); |
| 180 | } |
| 181 | my $strLayout = &GenLDSProcess(); |
| 182 | return $strLayout; |
| 183 | } |
| 184 | sub GenLDSProcess |
| 185 | { |
| 186 | &ldsFrame::CleanCallBackFunc(); |
| 187 | &ldsFrame::SetCallBackFunc("GetChip", \&GetChip); |
| 188 | &ldsFrame::SetCallBackFunc("CollectMemorySetting", \&CollectMemorySetting); |
| 189 | &ldsFrame::SetCallBackFunc("SetMemorySegment", \&SetMemorySegment) if(&FileInfo::is_NOR()); |
| 190 | &ldsFrame::SetCallBackFunc("SetRegionList", \&SetRegionList); |
| 191 | &ldsFrame::SetCallBackFunc("GetCustomFolder", \&GetCustomFolder); |
| 192 | |
| 193 | return &ldsFrame::GenLDS(ldsFrame::MAIN); |
| 194 | } |
| 195 | sub GetChip #CallBack func |
| 196 | { |
| 197 | return $g_bb; |
| 198 | } |
| 199 | sub GetCustomFolder #CallBack func |
| 200 | { |
| 201 | return $g_BBFolder; |
| 202 | } |
| 203 | |
| 204 | sub CollectMemorySetting #CallBack func |
| 205 | { |
| 206 | my ($MEMORYPath, $RegionList_ref, $Index_ref) = @_; |
| 207 | my $func = "$g_bb\_MemorySetting"; |
| 208 | #&sysUtil::sysgen_die("Unsupported Memory Setting on $g_bb! $func must exist.", __FILE__, __LINE__) if not defined &{$func}; |
| 209 | no strict 'refs'; |
| 210 | my %Setting; |
| 211 | RefineMEMORYWithInput($MEMORYPath, \%Setting); |
| 212 | if (defined &{$func}) { |
| 213 | &{$func}(\%Setting); |
| 214 | }else { |
| 215 | Default_MemorySetting(\%Setting); |
| 216 | } |
| 217 | # my $nReservedSize = &GetReservedSize_FromBottomToTop_OnRAM(undef, $RegionList_ref, $Index_ref, "DSP_RX", "DUMMY_END"); |
| 218 | # $Setting{"RESERVED_FOR_DUMMY_END"} = &CommonUtil::Dec2Hex($nReservedSize); |
| 219 | $Setting{"CACHEABLE_PREFIX"} = &CommonUtil::Dec2Hex(sysUtil::GetCacheablePrefix($g_bb)); |
| 220 | $Setting{"NONCACHEABLE_PREFIX"} = &CommonUtil::Dec2Hex(sysUtil::GetNonCacheablePrefix($g_bb)); |
| 221 | |
| 222 | return \%Setting; |
| 223 | } |
| 224 | |
| 225 | sub SetMemorySegment #CallBack func |
| 226 | { |
| 227 | my ($MEMORY_SEGMENT_aref) = @_; |
| 228 | #nor |
| 229 | } |
| 230 | |
| 231 | sub RefineMEMORYWithInput |
| 232 | { |
| 233 | my ($MEMORYPath, $Setting_href) = @_; |
| 234 | my $Memory_aref = &ldsInfo::ParseMEMORY(&CommonUtil::GetFileContent($MEMORYPath)); |
| 235 | foreach my $info (@$Memory_aref) |
| 236 | { |
| 237 | if($info->[0] eq "ROM") |
| 238 | { |
| 239 | my $strBase = GetUsefulInfo($info->[1]); |
| 240 | my $strLen = GetUsefulInfo($info->[2]); |
| 241 | $Setting_href->{ROM_BASE} = $strBase if(defined $strBase); |
| 242 | $Setting_href->{ROM_LEN} = $strLen if(defined $strLen); |
| 243 | } |
| 244 | elsif($info->[0] eq "RAM") |
| 245 | { |
| 246 | my $strBase = GetUsefulInfo($info->[1]); |
| 247 | my $strLen = GetUsefulInfo($info->[2]); |
| 248 | # $Setting_href->{RAM_BASE} = $strBase if(defined $strBase); |
| 249 | # $Setting_href->{RAM_LEN} = $strLen if(defined $strLen); |
| 250 | } |
| 251 | elsif($info->[0] eq "VRAM") |
| 252 | { |
| 253 | my $strBase = GetUsefulInfo($info->[1]); |
| 254 | my $strLen = GetUsefulInfo($info->[2]); |
| 255 | # $Setting_href->{VRAM_BASE} = $strBase if(defined $strBase); |
| 256 | # $Setting_href->{VRAM_LEN} = $strLen if(defined $strLen); |
| 257 | } |
| 258 | } |
| 259 | } |
| 260 | sub GetUsefulInfo |
| 261 | { |
| 262 | my ($strInput) = @_; |
| 263 | $strInput =~ s/\[(.+)\]|\s//g; |
| 264 | $strInput = undef if($strInput !~ /^0x(\w+)$|(\w+)$/); |
| 265 | return $strInput; |
| 266 | } |
| 267 | |
| 268 | sub SetRegionList #CallBack func |
| 269 | { |
| 270 | my ($BasicRegionList_ref, $Index_ref, $MEMORYSetting_href) = @_; |
| 271 | my @RegionList; |
| 272 | foreach my $item (@$BasicRegionList_ref) |
| 273 | { |
| 274 | my $strCondition = $item->[$Index_ref->{Condition}]; |
| 275 | next if($strCondition ne "" and 0 == &FileInfo::EvaluateFeatureOptionCondition($strCondition, $g_MakeFile_ref)); |
| 276 | my $strCompileOption = $item->[$Index_ref->{CompileOption}]; |
| 277 | next if($strCompileOption ne "" and (0 == BuildInfo::EvaluateCompileOption($strCompileOption))); |
| 278 | push @RegionList, $item; |
| 279 | } |
| 280 | for(my $i=0; $i<= $#RegionList; $i++) |
| 281 | { |
| 282 | my $nColumnCount = scalar(@{$RegionList[$i]}); |
| 283 | for(my $j=0; $j <= $nColumnCount; $j++) |
| 284 | { |
| 285 | if($RegionList[$i]->[$j] =~/\[(\w+)\]/) |
| 286 | { |
| 287 | my $strToReplace = $1; |
| 288 | no strict 'refs'; |
| 289 | if ($strToReplace =~ /[ID]SPRAM\d+_(BASE|SIZE)/) |
| 290 | { |
| 291 | my $template = &GetSPRAM_Info($MEMORYSetting_href, \@RegionList, $Index_ref, $strToReplace); |
| 292 | $RegionList[$i]->[$j] =~ s/\[$strToReplace\]/$template/g; |
| 293 | } |
| 294 | else |
| 295 | { |
| 296 | my $func = "Gen".$strToReplace; |
| 297 | my $template = &{$func}($MEMORYSetting_href, \@RegionList, $Index_ref) if (exists &{$func}) |
| 298 | or &sysUtil::sysgen_die("$func() doesn't exists!", __FILE__, __LINE__); |
| 299 | $RegionList[$i]->[$j] =~ s/\[$strToReplace\]/$template/g; |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | } |
| 304 | return \@RegionList; |
| 305 | } |
| 306 | |
| 307 | |
| 308 | sub GetSPRAM_Info # Fill in RegionList.csv, design for get physical address of SPRAM |
| 309 | { |
| 310 | my ($MEMORYSetting_href, $RegionList_aref, $Index_ref, $strSPRAMName) = @_; |
| 311 | my ($strkeyword, $strBaseOrSize); |
| 312 | |
| 313 | if ($strSPRAMName =~ /(\w+)_(BASE|SIZE)/) |
| 314 | { |
| 315 | ($strkeyword, $strBaseOrSize) = ($1,$2); |
| 316 | } |
| 317 | else |
| 318 | { |
| 319 | sysUtil::sysgen_die("unexcept SPRAM name: $strSPRAMName!", __FILE__, __LINE__) |
| 320 | } |
| 321 | |
| 322 | if ($strBaseOrSize eq "BASE") |
| 323 | { |
| 324 | return $MEMORYSetting_href->{$strkeyword}->[0]; |
| 325 | } |
| 326 | else |
| 327 | { |
| 328 | return &CommonUtil::Dec2Hex( hex($MEMORYSetting_href->{$strkeyword}->[1]) ); |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | sub GenTX_BASE # Fill in RegionList.csv |
| 333 | { |
| 334 | my ($MEMORYSetting_href, $RegionList_aref, $Index_ref) = @_; |
| 335 | |
| 336 | return &CommonUtil::Dec2Hex(hex(GenRX_BASE($MEMORYSetting_href, $RegionList_aref, $Index_ref)) - |
| 337 | hex(GenTX_SIZE($MEMORYSetting_href, $RegionList_aref, $Index_ref))); |
| 338 | } |
| 339 | |
| 340 | ################################## |
| 341 | # RX is base line for above/below output sections |
| 342 | ################################## |
| 343 | sub GenRX_BASE # Fill in RegionList.csv |
| 344 | { |
| 345 | my ($MEMORYSetting_href, $RegionList_aref, $Index_ref) = @_; |
| 346 | return &CommonUtil::Dec2Hex( hex(&GenEXTSRAM_FS_ZI_BASE($g_bb)) - hex(GenRX_SIZE($MEMORYSetting_href, $RegionList_aref, $Index_ref)) ); |
| 347 | } |
| 348 | sub GenTX_SIZE # Fill in RegionList.csv |
| 349 | { |
| 350 | my ($MEMORYSetting_href, $RegionList_aref, $Index_ref) = @_; |
| 351 | my ($nTXLength,$nRXLength) = &sysUtil::DSPTXRX_query_length($g_bb, $g_MakeFile_ref->{custom_flavor}); |
| 352 | return &CommonUtil::Dec2Hex($nTXLength); |
| 353 | } |
| 354 | sub GenRX_SIZE # Fill in RegionList.csv |
| 355 | { |
| 356 | my ($MEMORYSetting_href, $RegionList_aref, $Index_ref) = @_; |
| 357 | my ($nTXLength,$nRXLength) = &sysUtil::DSPTXRX_query_length($g_bb, $g_MakeFile_ref->{custom_flavor}); |
| 358 | return &CommonUtil::Dec2Hex($nRXLength); |
| 359 | } |
| 360 | |
| 361 | sub GenEXTSRAM_END # Fill in RegionList.csv |
| 362 | { |
| 363 | my ($MEMORYSetting_href, $RegionList_aref, $Index_ref) = @_; |
| 364 | return &CommonUtil::Dec2Hex( &GetMDTotalSize($g_bb)); |
| 365 | } |
| 366 | |
| 367 | sub GenCACHED_EXTSRAM_BASE # Fill in RegionList.csv |
| 368 | { |
| 369 | my ($MEMORYSetting_href, $RegionList_aref, $Index_ref) = @_; |
| 370 | return &CommonUtil::Dec2Hex(sysUtil::GetCacheablePrefix($g_bb) | |
| 371 | ( hex(GenRX_BASE($MEMORYSetting_href, $RegionList_aref, $Index_ref)) + |
| 372 | hex(GenRX_SIZE($MEMORYSetting_href, $RegionList_aref, $Index_ref)))); |
| 373 | } |
| 374 | |
| 375 | sub GenEXTSRAM_FS_ZI_BASE # Fill in RegionList.csv |
| 376 | { |
| 377 | my ($MEMORYSetting_href, $RegionList_aref, $Index_ref) = @_; |
| 378 | if ($g_bb =~/MT6297$/ && FileInfo::is("PLATFORM", "MT6297")) { |
| 379 | return &CommonUtil::Dec2Hex( &GetMDTotalSize($g_bb) - &GenEXTSRAM_FS_ZI_SIZE()); |
| 380 | } elsif (FileInfo::is("PLATFORM", "MT6880") or FileInfo::is("PLATFORM", "MT6890") or FileInfo::is("PLATFORM", "MT2735")) { |
| 381 | return &CommonUtil::Dec2Hex( (0x12F80000 - &GenEXTSRAM_FS_ZI_SIZE()) & 0xFFF00000); #0x12F80000 is the base address of DSP section on EMI view. |
| 382 | } else { |
| 383 | return &CommonUtil::Dec2Hex( (hex(&GenL1DSP_ZI_BASE()) - &GenEXTSRAM_FS_ZI_SIZE()) & ~0xFFFFF); |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | sub GenEXTSRAM_FS_ZI_SIZE |
| 388 | { |
| 389 | my $hexRamdiskSize = 0x1000000; |
| 390 | if ( FileInfo::is("FS_RAMDISK", "TRUE")) |
| 391 | { |
| 392 | if ($g_bb =~ /MT6297$/) { |
| 393 | $hexRamdiskSize = 0x2000000; #32MB |
| 394 | } else { |
| 395 | $hexRamdiskSize = 0x1000000; #16MB |
| 396 | } |
| 397 | } |
| 398 | return $hexRamdiskSize; |
| 399 | } |
| 400 | |
| 401 | sub GenL1DSP_ZI_BASE |
| 402 | { |
| 403 | if ($g_bb =~ /MT6297$/ && FileInfo::is("PLATFORM", "MT6297")) { |
| 404 | return &CommonUtil::Dec2Hex( 0x10000000 - hex(&GenL1DSP_ZI_SIZE())); |
| 405 | } elsif (FileInfo::is("PLATFORM", "MT6880") or FileInfo::is("PLATFORM", "MT6890") or FileInfo::is("PLATFORM", "MT2735")) { |
| 406 | return &CommonUtil::Dec2Hex( 0x1E000000 - hex(&GenL1DSP_ZI_SIZE())); #Move the base of DSP back by 13M |
| 407 | } else { |
| 408 | return &CommonUtil::Dec2Hex( &GetMDTotalSize($g_bb) - hex(&GenL1DSP_ZI_SIZE())); |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | sub GenL1DSP_ZI_SIZE |
| 413 | { |
| 414 | my %BBtbl_DSP_ZI_size; |
| 415 | if ($g_bb =~ /MT6297$/ && FileInfo::is("PLATFORM", "MT6297")){ |
| 416 | %BBtbl_DSP_ZI_size = |
| 417 | ( |
| 418 | 'MT6297' => 0x03D80000, # 61.5 MB |
| 419 | 'MT6297_FPGA' => 0x03500000, # 53 MB |
| 420 | ); |
| 421 | } elsif ($g_bb =~ /MT6297$/ && FileInfo::is("PLATFORM", "MT6885")) { |
| 422 | %BBtbl_DSP_ZI_size = |
| 423 | ( |
| 424 | 'MT6297' => 0x03E24000, # 62.14MB |
| 425 | ); |
| 426 | } elsif ($g_bb =~ /MT6297$/ && FileInfo::is("PLATFORM", "MT6873")) { |
| 427 | %BBtbl_DSP_ZI_size = |
| 428 | ( |
| 429 | 'MT6297' => 0x03BC0000, # 59.75MB |
| 430 | ); |
| 431 | } elsif (FileInfo::is("PLATFORM", "MT6893")) { |
| 432 | %BBtbl_DSP_ZI_size = |
| 433 | ( |
| 434 | 'MT6297' => 0x037A4000, # 55.64MB |
| 435 | ); |
| 436 | } elsif (FileInfo::is("PLATFORM", "MT6853") || FileInfo::is("PLATFORM", "MT6833")) { |
| 437 | %BBtbl_DSP_ZI_size = |
| 438 | ( |
| 439 | 'MT6297' => 0x02840000, # 40.25MB |
| 440 | ); |
| 441 | } elsif (FileInfo::is("PLATFORM", "MT6880") or FileInfo::is("PLATFORM", "MT6890") or FileInfo::is("PLATFORM", "MT2735")) { |
| 442 | %BBtbl_DSP_ZI_size = |
| 443 | ( |
| 444 | 'MT6297' => 0x02AA4000, # 42.6 MB |
| 445 | ); |
| 446 | } else { |
| 447 | %BBtbl_DSP_ZI_size = |
| 448 | ( |
| 449 | 'MT6763' => 0x01000000, # 16 MB |
| 450 | 'MT6771' => 0x01000000, # 16 MB |
| 451 | 'MT6739' => 0x00E00000, # 14 MB |
| 452 | 'MT6295M' => 0x02000000, # 32 MB |
| 453 | 'MT6297' => 0x02840000, # 40.25MB |
| 454 | 'MT6297_FPGA' => 0x03500000, # 53 MB |
| 455 | ); |
| 456 | } |
| 457 | |
| 458 | &sysUtil::sysgen_die("No default DSP ZI total size for this chip $g_bb !", __FILE__, __LINE__) |
| 459 | if (!exists $BBtbl_DSP_ZI_size{$g_bb}); |
| 460 | return &CommonUtil::Dec2Hex($BBtbl_DSP_ZI_size{$g_bb}); |
| 461 | } |
| 462 | |
| 463 | sub GenL2SRAM_SIZE |
| 464 | { |
| 465 | my $L2SRAM_Size; |
| 466 | if (FileInfo::is("BOARD_VER", "MERCURY_FPGA") or FileInfo::is("BOARD_VER", "MT6885_FPGA")){ |
| 467 | $L2SRAM_Size = 0x200000; # 2MB |
| 468 | } elsif (FileInfo::is("BOARD_VER", "MT6885_EVB")){ |
| 469 | $L2SRAM_Size = 0x70000; # 448KB |
| 470 | } elsif (FileInfo::is("PLATFORM", "MT6833") or FileInfo::is("PLATFORM", "MT6877")){ |
| 471 | $L2SRAM_Size = 0x8000; # 32KB |
| 472 | } else { |
| 473 | $L2SRAM_Size = 0x30000; # 192KB |
| 474 | } |
| 475 | return &CommonUtil::Dec2Hex($L2SRAM_Size); |
| 476 | } |
| 477 | |
| 478 | # what is this for? |
| 479 | sub GenUSIP_BASE # Fill in RegionList.csv |
| 480 | { |
| 481 | my ($MEMORYSetting_href, $RegionList_aref, $Index_ref) = @_; |
| 482 | return &CommonUtil::Dec2Hex( &GetMDTotalSize($g_bb) - &sysUtil::VoLTE_core_query_length($g_bb)); |
| 483 | } |
| 484 | |
| 485 | sub GenUSIP_SIZE # Fill in RegionList.csv |
| 486 | { |
| 487 | |
| 488 | return 0x01000000; #16M, please sync this value with EXTSRAM_FS_ZI in RegionList.cvs |
| 489 | } |
| 490 | |
| 491 | sub GenUROM_SIZE |
| 492 | { |
| 493 | my ($bb) = @_; |
| 494 | |
| 495 | my %UROM_Size; |
| 496 | if (FileInfo::is("PLATFORM", "MT6880") or FileInfo::is("PLATFORM", "MT6890") or FileInfo::is("PLATFORM", "MT2735") or FileInfo::is("PLATFORM", "MT2735")){ |
| 497 | if (FileInfo::isnot("C2K_MODE_SUPPORT", "NONE")){ |
| 498 | %UROM_Size = |
| 499 | ( |
| 500 | 'MT6297' => 0x02800000, # 40 MB |
| 501 | ); |
| 502 | } else{ |
| 503 | %UROM_Size = |
| 504 | ( |
| 505 | 'MT6297' => 0x02300000, # 35 MB |
| 506 | ); |
| 507 | } |
| 508 | } elsif (FileInfo::is("MTK_MODEM_ARCH", "MT6297")){ |
| 509 | %UROM_Size = |
| 510 | ( |
| 511 | 'MT6297' => 0x03000000, # 48 MB |
| 512 | ); |
| 513 | } else{ |
| 514 | &sysUtil::sysgen_die("Current project cannot call GenUROM_SIZE function!", __FILE__, __LINE__); |
| 515 | } |
| 516 | &sysUtil::sysgen_die("No default UROM size for this chip $bb !", __FILE__, __LINE__) if (!exists $UROM_Size{$bb}); |
| 517 | |
| 518 | return $UROM_Size{$bb}; |
| 519 | } |
| 520 | |
| 521 | ################################################################################################### |
| 522 | # |
| 523 | # MemorySetting By chip |
| 524 | # |
| 525 | ################################################################################################### |
| 526 | sub GetMDTotalSize |
| 527 | { #remember to check shared memory size in GetDefaultSharedMemorySize ( sysGenUtility.pm) |
| 528 | |
| 529 | my ($bb) = @_; |
| 530 | |
| 531 | my %BBtbl_MD_size; |
| 532 | if (FileInfo::is("PLATFORM", "MT6880") or FileInfo::is("PLATFORM", "MT6890") or FileInfo::is("PLATFORM", "MT2735")){ |
| 533 | if (FileInfo::isnot("C2K_MODE_SUPPORT", "NONE")){ |
| 534 | %BBtbl_MD_size = |
| 535 | ( |
| 536 | 'MT6297' => 0x14000000, # 320 MB |
| 537 | ); |
| 538 | } else { |
| 539 | %BBtbl_MD_size = |
| 540 | ( |
| 541 | 'MT6297' => 0x10000000, # 256 MB |
| 542 | ); |
| 543 | } |
| 544 | } elsif (FileInfo::isnot("PLATFORM", "MT6297") and FileInfo::isnot("PLATFORM", "MT6885") and FileInfo::isnot("PLATFORM", "MT6893") |
| 545 | and FileInfo::isnot("PLATFORM", "MT6873") and FileInfo::is("MTK_MODEM_ARCH", "MT6297")) { |
| 546 | %BBtbl_MD_size = |
| 547 | ( |
| 548 | 'MT6297_FPGA' => 0x10000000, # 256 MB |
| 549 | 'MT6297' => 0x1D300000, # 467 MB |
| 550 | ); |
| 551 | } else { |
| 552 | %BBtbl_MD_size = |
| 553 | ( |
| 554 | 'MT6763' => 0x0F800000, # 248 MB |
| 555 | 'MT6739' => 0x07E00000, # 126 MB |
| 556 | 'MT6771' => 0x08000000, # 128 MB |
| 557 | 'MT6295M' => 0x0F800000, # 248 MB |
| 558 | 'MT6297_FPGA' => 0x10000000, # 256 MB |
| 559 | 'MT6297' => 0x1E000000, # 480 MB |
| 560 | ); |
| 561 | } |
| 562 | |
| 563 | my $MD_with_ramdisk_default_size = 0x0F800000; # 248 MB |
| 564 | my %BBtbl_MD_with_ramdisk_size; |
| 565 | if (FileInfo::is("PLATFORM", "MT6880") or FileInfo::is("PLATFORM", "MT6890") or FileInfo::is("PLATFORM", "MT2735")) { |
| 566 | %BBtbl_MD_with_ramdisk_size = |
| 567 | ( # format: '"chip"' -> 'size' |
| 568 | 'MT6297' => 0x16000000, # 352 MB |
| 569 | ); |
| 570 | } elsif (FileInfo::isnot("PLATFORM", "MT6297") and FileInfo::isnot("PLATFORM", "MT6885") and FileInfo::isnot("PLATFORM", "MT6893") |
| 571 | and FileInfo::isnot("PLATFORM", "MT6873") and FileInfo::is("MTK_MODEM_ARCH", "MT6297")) { |
| 572 | %BBtbl_MD_with_ramdisk_size = |
| 573 | ( # format: '"chip"' -> 'size' |
| 574 | 'MT6297_FPGA' => 0x10000000, # 256 MB |
| 575 | 'MT6297' => 0x1D300000, # 467 MB |
| 576 | ); |
| 577 | } else { |
| 578 | %BBtbl_MD_with_ramdisk_size = |
| 579 | ( # format: '"chip"' -> 'size' |
| 580 | 'MT6763' => 0x0F800000, # 248 MB |
| 581 | 'MT6739' => 0x07E00000, # 126 MB |
| 582 | 'MT6771' => 0x08000000, # 128 MB |
| 583 | 'MT6295M' => 0x0F800000, # 248 MB |
| 584 | 'MT6297_FPGA' => 0x10000000, # 256 MB |
| 585 | 'MT6297' => 0x1E000000, # 480 MB |
| 586 | ); |
| 587 | } |
| 588 | |
| 589 | &sysUtil::sysgen_die("No default MD total size for this chip $bb !", __FILE__, __LINE__) |
| 590 | if (!exists $BBtbl_MD_size{$bb}); |
| 591 | |
| 592 | # for ramdisk, MD only load |
| 593 | if ( FileInfo::is("FS_RAMDISK", "TRUE") |
| 594 | or FileInfo::is("SMART_PHONE_CORE", "MODEM_ONLY")) |
| 595 | { |
| 596 | return $BBtbl_MD_with_ramdisk_size{$bb} if (exists $BBtbl_MD_with_ramdisk_size{$bb}); |
| 597 | return $MD_with_ramdisk_default_size; |
| 598 | } |
| 599 | |
| 600 | # return default size |
| 601 | return $BBtbl_MD_size{$bb}; |
| 602 | } |
| 603 | |
| 604 | sub Default_MemorySetting # Called by CollectMemorySetting($Setting_href), fill in MEMORY |
| 605 | { |
| 606 | my ($Setting_href) = @_; |
| 607 | my $nTotalSize = GetMDTotalSize($g_bb); |
| 608 | |
| 609 | # ROM, the values could be got by 2-phase linking |
| 610 | my $nROMSize = 0x03000000; # 48MB |
| 611 | my $nROMBase = 0x90000000; |
| 612 | my $nUROMBase = 0x00000000; |
| 613 | my $nRAM_BASE = 0x00000000; |
| 614 | my $nRAM_SIZE = 0x05400000; |
| 615 | |
| 616 | |
| 617 | SetExistentValueByDefault($Setting_href, "ROM_BASE", $nROMBase); |
| 618 | SetExistentValueByDefault($Setting_href, "ROM_LEN", $nROMSize); |
| 619 | SetExistentValueByDefault($Setting_href, "UROM_BASE", $nUROMBase); |
| 620 | SetExistentValueByDefault($Setting_href, "UROM_LEN", $nROMSize); |
| 621 | |
| 622 | #MCURO_HWRW |
| 623 | SetExistentValueByDefault($Setting_href, "MCURO_HWRW_BASE",$nUROMBase +$nROMSize); |
| 624 | SetExistentValueByDefault($Setting_href, "MCURO_HWRW_LEN",0x01c00000); |
| 625 | |
| 626 | # RAM, the values could be got by 2-phase linking |
| 627 | SetExistentValueByDefault($Setting_href, "RAM_BASE", hex($Setting_href->{MCURO_HWRW_BASE}) + hex($Setting_href->{MCURO_HWRW_LEN})); |
| 628 | SetExistentValueByDefault($Setting_href, "RAM_LEN", $nRAM_SIZE); |
| 629 | SetExistentValueByDefault($Setting_href, "VRAM_BASE", $nRAM_BASE| sysUtil::GetCacheablePrefix($g_bb)); |
| 630 | SetExistentValueByDefault($Setting_href, "VRAM_LEN", &GetMDTotalSize($g_bb)); |
| 631 | #MCURW_HWRW |
| 632 | SetExistentValueByDefault($Setting_href, "MCURW_HWRW_BASE",hex($Setting_href->{RAM_BASE})+hex($Setting_href->{RAM_LEN})); |
| 633 | SetExistentValueByDefault($Setting_href, "MCURW_HWRW_LEN",0x02b00000); |
| 634 | SetExistentValueByDefault($Setting_href, "DSP_TXRX_BASE",hex($Setting_href->{MCURW_HWRW_BASE})+hex($Setting_href->{MCURW_HWRW_LEN})); |
| 635 | SetExistentValueByDefault($Setting_href, "DSP_TXRX_LEN",0x40000); |
| 636 | SetExistentValueByDefault($Setting_href, "IOCU2_BASE",0x6CC00000); |
| 637 | SetExistentValueByDefault($Setting_href, "IOCU2_LEN",0x00200000); |
| 638 | SetExistentValueByDefault($Setting_href, "IOCU3_BASE",0x3CE00000); |
| 639 | SetExistentValueByDefault($Setting_href, "IOCU3_LEN",0x00100000); |
| 640 | SetExistentValueByDefault($Setting_href, "L2C_LOCK_BASE",0x0cf00000|0x90000000); |
| 641 | SetExistentValueByDefault($Setting_href, "L2C_LOCK_LEN",0x00100000); |
| 642 | |
| 643 | $g_nRAM_BASE = $nRAM_BASE ; |
| 644 | #Core spesific regions |
| 645 | SetExistentValueByDefault($Setting_href, "CORE0_BASE",0x0d000000); |
| 646 | SetExistentValueByDefault($Setting_href, "CORE0_LEN", 0x00200000); |
| 647 | SetExistentValueByDefault($Setting_href, "CORE1_BASE",0x0d200000); |
| 648 | SetExistentValueByDefault($Setting_href, "CORE1_LEN", 0x00200000); |
| 649 | SetExistentValueByDefault($Setting_href, "EXTSRAM_FS_BASE",hex(&GenEXTSRAM_FS_ZI_BASE())); |
| 650 | SetExistentValueByDefault($Setting_href, "EXTSRAM_FS_LEN", &GenEXTSRAM_FS_ZI_SIZE()); |
| 651 | SetExistentValueByDefault($Setting_href, "L1DSP_BASE",hex(&GenL1DSP_ZI_BASE())); |
| 652 | SetExistentValueByDefault($Setting_href, "L1DSP_LEN",hex(&GenL1DSP_ZI_SIZE())); |
| 653 | } |
| 654 | |
| 655 | sub MT6297_MemorySetting # Called by CollectMemorySetting($Setting_href), fill in MEMORY |
| 656 | { |
| 657 | my ($Setting_href) = @_; |
| 658 | my $nTotalSize = GetMDTotalSize($g_bb); |
| 659 | |
| 660 | # ROM, the values could be got by 2-phase linking |
| 661 | my $nUROMSize = GenUROM_SIZE($g_bb); |
| 662 | my $nUROMBase = 0x00000000; |
| 663 | |
| 664 | my $nROMBase = 0x90000000; |
| 665 | |
| 666 | my $nRAM_BASE = $nUROMBase + $nUROMSize; |
| 667 | |
| 668 | SetExistentValueByDefault($Setting_href, "ROM_BASE", $nROMBase); |
| 669 | SetExistentValueByDefault($Setting_href, "ROM_LEN", 0x10000000); |
| 670 | SetExistentValueByDefault($Setting_href, "UROM_BASE", $nUROMBase); |
| 671 | SetExistentValueByDefault($Setting_href, "UROM_LEN", $nUROMSize); |
| 672 | |
| 673 | # RAM, the values could be got by 2-phase linking |
| 674 | SetExistentValueByDefault($Setting_href, "RAM_BASE", hex($Setting_href->{UROM_BASE}) + hex($Setting_href->{UROM_LEN})); |
| 675 | SetExistentValueByDefault($Setting_href, "RAM_LEN", &GetMDTotalSize($g_bb)); |
| 676 | SetExistentValueByDefault($Setting_href, "VRAM_BASE", sysUtil::GetCacheablePrefix($g_bb)); |
| 677 | SetExistentValueByDefault($Setting_href, "VRAM_LEN", &GetMDTotalSize($g_bb)); |
| 678 | |
| 679 | SetExistentValueByDefault($Setting_href, "IOCU2_BASE",0x20000000); |
| 680 | SetExistentValueByDefault($Setting_href, "IOCU2_LEN",0x10000000); |
| 681 | SetExistentValueByDefault($Setting_href, "IOCU3_BASE",0x30000000); |
| 682 | SetExistentValueByDefault($Setting_href, "IOCU3_LEN",0x10000000); |
| 683 | |
| 684 | $g_nRAM_BASE = $nRAM_BASE ; |
| 685 | SetExistentValueByDefault($Setting_href, "EXTSRAM_FS_BASE",hex(&GenEXTSRAM_FS_ZI_BASE())); |
| 686 | SetExistentValueByDefault($Setting_href, "EXTSRAM_FS_LEN", &GenEXTSRAM_FS_ZI_SIZE()); |
| 687 | SetExistentValueByDefault($Setting_href, "L1DSP_BASE",hex(&GenL1DSP_ZI_BASE())); |
| 688 | SetExistentValueByDefault($Setting_href, "L1DSP_LEN",hex(&GenL1DSP_ZI_SIZE())); |
| 689 | SetExistentValueByDefault($Setting_href, "L2SRAM_LEN",hex(&GenL2SRAM_SIZE())); |
| 690 | } |
| 691 | |
| 692 | sub MT6297_FPGA_MemorySetting # Called by CollectMemorySetting($Setting_href), fill in MEMORY |
| 693 | { |
| 694 | my ($Setting_href) = @_; |
| 695 | my $nTotalSize = GetMDTotalSize($g_bb); |
| 696 | |
| 697 | # ROM, the values could be got by 2-phase linking |
| 698 | my $nUROMSize; |
| 699 | if(FileInfo::is("CUSTOM_FLAVOR", "NLWCTG_MODEM") and FileInfo::is("BOARD_VER", "MT6297_FPGA")) { |
| 700 | $nUROMSize = 0x01800000; # 24MB |
| 701 | } |
| 702 | else { |
| 703 | $nUROMSize = 0x01B00000; # 27MB |
| 704 | } |
| 705 | my $nUROMBase = 0x00000000; |
| 706 | |
| 707 | my $nROMBase = 0x90000000; |
| 708 | my $nRAM_BASE = 0x00000000; |
| 709 | |
| 710 | SetExistentValueByDefault($Setting_href, "ROM_BASE", $nROMBase); |
| 711 | SetExistentValueByDefault($Setting_href, "ROM_LEN", &GetMDTotalSize($g_bb)); |
| 712 | SetExistentValueByDefault($Setting_href, "UROM_BASE", $nUROMBase); |
| 713 | SetExistentValueByDefault($Setting_href, "UROM_LEN", $nUROMSize); |
| 714 | |
| 715 | # RAM, the values could be got by 2-phase linking |
| 716 | SetExistentValueByDefault($Setting_href, "RAM_BASE", hex($Setting_href->{UROM_BASE}) + hex($Setting_href->{UROM_LEN})); |
| 717 | SetExistentValueByDefault($Setting_href, "RAM_LEN", &GetMDTotalSize($g_bb)); |
| 718 | SetExistentValueByDefault($Setting_href, "VRAM_BASE", sysUtil::GetCacheablePrefix($g_bb)); |
| 719 | SetExistentValueByDefault($Setting_href, "VRAM_LEN", &GetMDTotalSize($g_bb)); |
| 720 | |
| 721 | SetExistentValueByDefault($Setting_href, "IOCU2_BASE",0x20000000); |
| 722 | SetExistentValueByDefault($Setting_href, "IOCU2_LEN",&GetMDTotalSize($g_bb)); |
| 723 | SetExistentValueByDefault($Setting_href, "IOCU3_BASE",0x30000000); |
| 724 | SetExistentValueByDefault($Setting_href, "IOCU3_LEN",&GetMDTotalSize($g_bb)); |
| 725 | |
| 726 | $g_nRAM_BASE = $nRAM_BASE ; |
| 727 | SetExistentValueByDefault($Setting_href, "EXTSRAM_FS_BASE",hex(&GenEXTSRAM_FS_ZI_BASE())); |
| 728 | SetExistentValueByDefault($Setting_href, "EXTSRAM_FS_LEN", &GenEXTSRAM_FS_ZI_SIZE()); |
| 729 | SetExistentValueByDefault($Setting_href, "L1DSP_BASE",hex(&GenL1DSP_ZI_BASE())); |
| 730 | SetExistentValueByDefault($Setting_href, "L1DSP_LEN",hex(&GenL1DSP_ZI_SIZE())); |
| 731 | } |
| 732 | |
| 733 | sub MT6295M_MemorySetting # Called by CollectMemorySetting($Setting_href), fill in MEMORY |
| 734 | { |
| 735 | my ($Setting_href) = @_; |
| 736 | my $nTotalSize = GetMDTotalSize($g_bb); |
| 737 | |
| 738 | # ROM, the values could be got by 2-phase linking |
| 739 | my $nUROMSize = 0x03000000; # 48MB |
| 740 | my $nUROMBase = 0x00000000; |
| 741 | |
| 742 | my $nROMBase = 0x90000000; |
| 743 | |
| 744 | my $nRAM_BASE = $nUROMBase + $nUROMSize; |
| 745 | |
| 746 | SetExistentValueByDefault($Setting_href, "UROM_BASE", $nUROMBase); |
| 747 | SetExistentValueByDefault($Setting_href, "UROM_LEN", $nUROMSize); |
| 748 | SetExistentValueByDefault($Setting_href, "ROM_BASE", $nROMBase); |
| 749 | SetExistentValueByDefault($Setting_href, "ROM_LEN", &GetMDTotalSize($g_bb)); |
| 750 | |
| 751 | # RAM, the values could be got by 2-phase linking |
| 752 | SetExistentValueByDefault($Setting_href, "RAM_BASE", $nUROMBase + $nUROMSize); |
| 753 | SetExistentValueByDefault($Setting_href, "RAM_LEN", &GetMDTotalSize($g_bb)); |
| 754 | SetExistentValueByDefault($Setting_href, "VRAM_BASE", sysUtil::GetCacheablePrefix($g_bb)); |
| 755 | SetExistentValueByDefault($Setting_href, "VRAM_LEN", &GetMDTotalSize($g_bb)); |
| 756 | |
| 757 | SetExistentValueByDefault($Setting_href, "IOCU2_BASE", 0x20000000); |
| 758 | SetExistentValueByDefault($Setting_href, "IOCU2_LEN",&GetMDTotalSize($g_bb)); |
| 759 | SetExistentValueByDefault($Setting_href, "IOCU3_BASE",0x00000000); |
| 760 | SetExistentValueByDefault($Setting_href, "IOCU3_LEN",&GetMDTotalSize($g_bb)); |
| 761 | |
| 762 | $g_nRAM_BASE = $nRAM_BASE ; |
| 763 | |
| 764 | SetExistentValueByDefault($Setting_href, "EXTSRAM_FS_BASE",hex(&GenEXTSRAM_FS_ZI_BASE())); |
| 765 | SetExistentValueByDefault($Setting_href, "EXTSRAM_FS_LEN", &GenEXTSRAM_FS_ZI_SIZE()); |
| 766 | SetExistentValueByDefault($Setting_href, "L1DSP_BASE",hex(&GenL1DSP_ZI_BASE())); |
| 767 | SetExistentValueByDefault($Setting_href, "L1DSP_LEN",hex(&GenL1DSP_ZI_SIZE())); |
| 768 | } |
| 769 | |
| 770 | sub MT6739_MemorySetting # Called by CollectMemorySetting($Setting_href), fill in MEMORY |
| 771 | { |
| 772 | my ($Setting_href) = @_; |
| 773 | my $nTotalSize = GetMDTotalSize($g_bb); |
| 774 | |
| 775 | # ROM, the values could be got by 2-phase linking |
| 776 | my $nROMSize = 0x01C00000; # 48MB |
| 777 | my $nROMBase = 0x90000000; |
| 778 | my $nUROMBase = 0x00000000; |
| 779 | my $nRAM_BASE = 0x00000000; |
| 780 | my $nRAM_SIZE = 0x02000000; |
| 781 | |
| 782 | |
| 783 | SetExistentValueByDefault($Setting_href, "ROM_BASE", $nROMBase); |
| 784 | SetExistentValueByDefault($Setting_href, "ROM_LEN", $nROMSize); |
| 785 | SetExistentValueByDefault($Setting_href, "UROM_BASE", $nUROMBase); |
| 786 | SetExistentValueByDefault($Setting_href, "UROM_LEN", $nROMSize); |
| 787 | |
| 788 | |
| 789 | #MCURO_HWRW |
| 790 | SetExistentValueByDefault($Setting_href, "MCURO_HWRW_BASE",$nUROMBase +$nROMSize); |
| 791 | SetExistentValueByDefault($Setting_href, "MCURO_HWRW_LEN",0x00E00000); |
| 792 | |
| 793 | # RAM, the values could be got by 2-phase linking |
| 794 | SetExistentValueByDefault($Setting_href, "RAM_BASE", hex($Setting_href->{MCURO_HWRW_BASE}) + hex($Setting_href->{MCURO_HWRW_LEN})); |
| 795 | SetExistentValueByDefault($Setting_href, "RAM_LEN", $nRAM_SIZE); |
| 796 | SetExistentValueByDefault($Setting_href, "VRAM_BASE", $nRAM_BASE| sysUtil::GetCacheablePrefix($g_bb)); |
| 797 | SetExistentValueByDefault($Setting_href, "VRAM_LEN", &GetMDTotalSize($g_bb)); |
| 798 | #MCURW_HWRW |
| 799 | SetExistentValueByDefault($Setting_href, "MCURW_HWRW_BASE",hex($Setting_href->{RAM_BASE})+hex($Setting_href->{RAM_LEN})); |
| 800 | SetExistentValueByDefault($Setting_href, "MCURW_HWRW_LEN",0x00E00000); |
| 801 | SetExistentValueByDefault($Setting_href, "DSP_TXRX_BASE",hex($Setting_href->{MCURW_HWRW_BASE})+hex($Setting_href->{MCURW_HWRW_LEN})); |
| 802 | SetExistentValueByDefault($Setting_href, "DSP_TXRX_LEN",0x40000); |
| 803 | SetExistentValueByDefault($Setting_href, "IOCU2_BASE", $nRAM_BASE|0x60000000); |
| 804 | SetExistentValueByDefault($Setting_href, "IOCU2_LEN",&GetMDTotalSize($g_bb)); |
| 805 | # SetExistentValueByDefault($Setting_href, "IOCU2_BASE",((hex($Setting_href->{DSP_TXRX_BASE})+hex($Setting_href->{DSP_TXRX_LEN})+0xfffff)&0x0ff00000)|0x60000000); |
| 806 | # SetExistentValueByDefault($Setting_href, "IOCU2_LEN",0x00100000); |
| 807 | SetExistentValueByDefault($Setting_href, "IOCU3_BASE",(hex($Setting_href->{IOCU2_BASE})+hex($Setting_href->{IOCU2_LEN}))&0x0fffffff|0x30000000); |
| 808 | SetExistentValueByDefault($Setting_href, "IOCU3_LEN",0x00100000); |
| 809 | SetExistentValueByDefault($Setting_href, "L2C_LOCK_BASE",(hex($Setting_href->{IOCU3_BASE})+hex($Setting_href->{IOCU3_LEN}))&0x0fffffff|0x90000000); |
| 810 | SetExistentValueByDefault($Setting_href, "L2C_LOCK_LEN",0x00100000); |
| 811 | |
| 812 | $g_nRAM_BASE = $nRAM_BASE ; |
| 813 | #Core spesific regions |
| 814 | SetExistentValueByDefault($Setting_href, "CORE0_BASE",(hex($Setting_href->{L2C_LOCK_BASE})+hex($Setting_href->{L2C_LOCK_LEN}))&0x0fffffff); |
| 815 | SetExistentValueByDefault($Setting_href, "CORE0_LEN", 0x00100000); |
| 816 | SetExistentValueByDefault($Setting_href, "CORE1_BASE",hex($Setting_href->{CORE0_BASE})+hex($Setting_href->{CORE0_LEN})); |
| 817 | SetExistentValueByDefault($Setting_href, "CORE1_LEN", 0x00100000); |
| 818 | SetExistentValueByDefault($Setting_href, "DRDI_BASE",(hex($Setting_href->{CORE1_BASE})+hex($Setting_href->{CORE1_LEN}))| sysUtil::GetCacheablePrefix($g_bb)); |
| 819 | SetExistentValueByDefault($Setting_href, "DRDI_LEN", 0x00200000); |
| 820 | SetExistentValueByDefault($Setting_href, "EXTSRAM_FS_BASE",hex(&GenEXTSRAM_FS_ZI_BASE())); |
| 821 | SetExistentValueByDefault($Setting_href, "EXTSRAM_FS_LEN", &GenEXTSRAM_FS_ZI_SIZE()); |
| 822 | SetExistentValueByDefault($Setting_href, "L1DSP_BASE",hex(&GenL1DSP_ZI_BASE())); |
| 823 | SetExistentValueByDefault($Setting_href, "L1DSP_LEN",hex(&GenL1DSP_ZI_SIZE())); |
| 824 | } |
| 825 | |
| 826 | sub SetExistentValueByDefault |
| 827 | { |
| 828 | my ($Setting_href, $strKey, $nValue) = @_; |
| 829 | $Setting_href->{$strKey} = (defined $Setting_href->{$strKey}) ? |
| 830 | $Setting_href->{$strKey} : CommonUtil::Dec2Hex($nValue); |
| 831 | } |
| 832 | sub GetPredefinedValue |
| 833 | { # to collocate with AAPMC |
| 834 | my ($Setting_href, $strFirst, $strSecond, $nDefaultValue) = @_; |
| 835 | my $nValue = $nDefaultValue; |
| 836 | if(defined $Setting_href->{$strFirst}) #1st Priority |
| 837 | { |
| 838 | $nValue = hex($Setting_href->{$strFirst}); |
| 839 | } |
| 840 | elsif(defined $Setting_href->{$strSecond}) #2nd Priority |
| 841 | { |
| 842 | $nValue = hex($Setting_href->{$strSecond}); |
| 843 | } |
| 844 | return $nValue; |
| 845 | |
| 846 | } |
| 847 | |
| 848 | |
| 849 | |
| 850 | |
| 851 | ############################################## |
| 852 | # work around for 90 build pass |
| 853 | ############################################## |
| 854 | |
| 855 | sub GenDUMMY_END # Fill in RegionList.csv |
| 856 | { |
| 857 | return 0; |
| 858 | } |
| 859 | |
| 860 | |
| 861 | |