commit b3ce8542e18e63cc9e3433009c95eeaada00447c
Author: Nikhil Dasan <n-dasan@ti.com>
Date:   Fri Dec 13 17:26:48 2024 +0530

    2G
    
    Signed-off-by: Nikhil Dasan <n-dasan@ti.com>

diff --git a/platform/j721e/rtos/c7x_1/main.c b/platform/j721e/rtos/c7x_1/main.c
index 06763c4..269c35c 100755
--- a/platform/j721e/rtos/c7x_1/main.c
+++ b/platform/j721e/rtos/c7x_1/main.c
@@ -327,13 +327,13 @@ void appMmuMap(Bool is_secure)
         goto mmu_exit;
     }
 
-    retVal = Mmu_map(DDR_C7X_1_LOCAL_HEAP_VADDR, DDR_C7X_1_LOCAL_HEAP_PADDR, DDR_C7X_1_LOCAL_HEAP_SIZE, &attrs, is_secure); /* ddr            */
+    retVal = Mmu_map(DDR_C7X_1_LOCAL_HEAP_VADDR, DDR_C7X_1_LOCAL_HEAP_VADDR, DDR_C7X_1_LOCAL_HEAP_SIZE, &attrs, is_secure); /* ddr            */
     if(retVal == UFALSE)
     {
         goto mmu_exit;
     }
 
-    retVal = Mmu_map(DDR_C7X_1_SCRATCH_VADDR, DDR_C7X_1_SCRATCH_PADDR, DDR_C7X_1_SCRATCH_SIZE, &attrs, is_secure); /* ddr            */
+    retVal = Mmu_map(DDR_C7X_1_SCRATCH_VADDR, DDR_C7X_1_SCRATCH_VADDR, DDR_C7X_1_SCRATCH_SIZE, &attrs, is_secure); /* ddr            */
     if(retVal == UFALSE)
     {
         goto mmu_exit;
diff --git a/platform/j721e/rtos/gen_linker_mem_map.py b/platform/j721e/rtos/gen_linker_mem_map.py
index bd957d6..2fcc95c 100755
--- a/platform/j721e/rtos/gen_linker_mem_map.py
+++ b/platform/j721e/rtos/gen_linker_mem_map.py
@@ -113,7 +113,7 @@ GB = KB*MB;
 # virtual lower DDR address range 0x0001_0000_0000
 #
 
-ddr_mem_addr  = 0xa0000000;
+ddr_mem_addr  = 0x90000000;
 ddr_mem_size  = 1*GB + 432*MB; # Last 64MB is used by Linux
 
 ddr_mem_addr_hi_phy = 0x880000000;
@@ -123,6 +123,9 @@ ddr_mem_size_hi = 624*MB;
 msmc_mem_addr = 0x70000000;
 main_ocram_mem_addr = 0x03600000;
 
+uboot_reloc_mem_addr = 0xFC000000;
+uboot_reloc_mem_size = 64*MB;
+
 #
 # Other constant sizes
 #
@@ -249,7 +252,7 @@ c7x_1_ddr_size = 96*MB - (c7x_1_ddr_addr-c7x_1_ddr_ipc_addr);
 
 # Shared memory for DMA Buf FD carveout
 ddr_shared_mem_addr     = c7x_1_ddr_addr  + c7x_1_ddr_size;
-ddr_shared_mem_size     = 512*MB;
+ddr_shared_mem_size     = 480*MB;
 
 mcu1_0_ddr_local_heap_addr  = ddr_shared_mem_addr + ddr_shared_mem_size;
 mcu1_0_ddr_local_heap_size  = 8*MB;
@@ -276,18 +279,18 @@ c66x_2_ddr_local_heap_size = 16*MB;
 c66x_2_ddr_scratch_addr    = c66x_2_ddr_local_heap_addr + c66x_2_ddr_local_heap_size;
 c66x_2_ddr_scratch_size    = 48*MB;
 
-ddr_intercore_eth_desc_addr = c66x_2_ddr_scratch_addr + c66x_2_ddr_scratch_size;
+c7x_1_ddr_scratch_addr     = c66x_2_ddr_scratch_addr + c66x_2_ddr_scratch_size;
+c7x_1_ddr_scratch_size     = 184*MB;
+
+c7x_1_ddr_local_heap_addr  = c7x_1_ddr_scratch_addr + c7x_1_ddr_scratch_size;
+c7x_1_ddr_local_heap_size  = 200*MB;
+
+ddr_intercore_eth_desc_addr = c7x_1_ddr_local_heap_addr + c7x_1_ddr_local_heap_size;
 ddr_intercore_eth_desc_size = 8*MB;
 
 ddr_intercore_eth_data_addr = ddr_intercore_eth_desc_addr + ddr_intercore_eth_desc_size;
 ddr_intercore_eth_data_size = 24*MB;
 
-c7x_1_ddr_scratch_addr     = ddr_mem_addr_hi;
-c7x_1_ddr_scratch_size     = 368*MB;
-
-c7x_1_ddr_local_heap_addr  = c7x_1_ddr_scratch_addr + c7x_1_ddr_scratch_size;
-c7x_1_ddr_local_heap_size  = 256*MB;
-
 #
 # Create memory section based on addr and size defined above, including
 # any CPU specific internal memories
@@ -307,6 +310,8 @@ mpu1_msmc   = MemSection("MSMC_MPU1", "RWIX", mpu1_msmc_addr  , mpu1_msmc_size
 c7x_1_msmc  = MemSection("MSMC_C7x_1", "RWIX", c7x_1_msmc_addr  , c7x_1_msmc_size  , "MSMC for C7x_1");
 dmsc_msmc  = MemSection("MSMC_DMSC", "RWIX", dmsc_msmc_addr  , dmsc_msmc_size  , "MSMC reserved for DMSC IPC");
 
+uboot_reloc_mem = MemSection("UBOOT_RELOC_MEM", "", uboot_reloc_mem_addr  , uboot_reloc_mem_size  , "Uboot DDR relocation memory");
+
 # C66x L2 memory sections
 c66x_1_l2   = MemSection("L2RAM_C66x_1", "RWIX", c66x_1_l2_addr  , c66x_1_l2_size  , "L2 for C66x_1");
 c66x_2_l2   = MemSection("L2RAM_C66x_2", "RWIX", c66x_2_l2_addr  , c66x_2_l2_size  , "L2 for C66x_2");
@@ -462,16 +467,10 @@ vision_apps_core_heaps_lo.concat(c66x_1_ddr_local_heap);
 vision_apps_core_heaps_lo.concat(c66x_2_ddr_local_heap);
 vision_apps_core_heaps_lo.concat(c66x_1_ddr_scratch);
 vision_apps_core_heaps_lo.concat(c66x_2_ddr_scratch);
+c7x_1_ddr_local_heap_phy  = MemSection("DDR_C7X_1_LOCAL_HEAP", "RWIX", c7x_1_ddr_scratch_addr, (c7x_1_ddr_scratch_size + c7x_1_ddr_local_heap_size), "DDR for c7x_1 for scratch & local heap");
+vision_apps_core_heaps_lo.concat(c7x_1_ddr_local_heap_phy);
 vision_apps_core_heaps_lo.setDtsName("vision_apps_core_heaps_lo", "vision-apps-core-heap-memory-lo");
 
-# This falls in upper 2GB region in J721E
-c7x_1_ddr_local_heap_phy  = MemSection("DDR_C7X_1_LOCAL_HEAP", "RWIX", ddr_mem_addr_hi_phy, (c7x_1_ddr_scratch_size + c7x_1_ddr_local_heap_size), "DDR for c7x_1 for scratch & local heap");
-
-vision_apps_core_heaps_hi = MemSection("DDR_VISION_APPS_CORE_HEAPS_HI_DTS", "", 0, 0, "Vision Apps Core Heaps in 40bit address range of DDR");
-vision_apps_core_heaps_hi.concat(c7x_1_ddr_local_heap_phy);
-vision_apps_core_heaps_hi.setDtsName("vision_apps_core_heaps_hi", "vision-apps-core-heap-memory-hi");
-vision_apps_core_heaps_hi.splitOrigin(True)
-
 # This region is for ethernet firmware, multi-core, multi-cast feature
 intercore_eth_desc_mem = MemSection("INTERCORE_ETH_DESC_MEM", "", ddr_intercore_eth_desc_addr, ddr_intercore_eth_desc_size, "Inter-core ethernet shared desc queues. MUST be non-cached or cache-coherent");
 intercore_eth_desc_mem.setDtsName("vision_apps_main_r5fss0_core0_shared_memory_queue_region", "vision-apps-r5f-virtual-eth-queues");
@@ -703,6 +702,7 @@ html_mmap.addMemSection( mcu2_0_main_ocram );
 html_mmap.addMemSection( mcu2_1_main_ocram );
 html_mmap.addMemSection( intercore_eth_desc_mem );
 html_mmap.addMemSection( intercore_eth_data_mem );
+html_mmap.addMemSection( uboot_reloc_mem    );
 html_mmap.checkOverlap();
 
 c_header_mmap = MemoryMap("Memory Map for C header file");
@@ -754,6 +754,7 @@ c_header_mmap.addMemSection( mcu2_0_main_ocram  );
 c_header_mmap.addMemSection( mcu2_1_main_ocram  );
 c_header_mmap.addMemSection( intercore_eth_desc_mem  );
 c_header_mmap.addMemSection( intercore_eth_data_mem  );
+c_header_mmap.addMemSection( uboot_reloc_mem     );
 c_header_mmap.checkOverlap();
 
 dts_mmap = MemoryMap("Memory Map for Linux kernel dts/dtsi file");
@@ -779,7 +780,6 @@ dts_mmap.addMemSection( vision_apps_ddr_total );
 dts_mmap.addMemSection( ipc_vring_mem      );
 dts_mmap.addMemSection( ddr_shared_mem     );
 dts_mmap.addMemSection( vision_apps_core_heaps_lo );
-dts_mmap.addMemSection( vision_apps_core_heaps_hi );
 dts_mmap.addMemSection( intercore_eth_desc_mem );
 dts_mmap.addMemSection( intercore_eth_data_mem );
 dts_mmap.checkOverlap();
