]> git.baikalelectronics.ru Git - uboot.git/commitdiff
arm64: mvebu: handle non-zero base address for RAM
authorChris Packham <judge.packham@gmail.com>
Fri, 20 May 2022 04:39:22 +0000 (16:39 +1200)
committerStefan Roese <sr@denx.de>
Thu, 21 Jul 2022 05:46:10 +0000 (07:46 +0200)
board_get_usable_ram_top() conflated the RAM size with the top address
of RAM. On systems where RAM starts at address 0 these numbers are the
same so it went unnoticed. Update board_get_usable_ram_top() to take
CONFIG_SYS_SDRAM_BASE into account when determining the top address.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
arch/arm/mach-mvebu/arm64-common.c

index 5357aa554db40c99897459d210bc4f8c448dbe90..238edbe6ba56ef1f4022ef589e3d7e300f16aa4e 100644 (file)
@@ -28,14 +28,13 @@ DECLARE_GLOBAL_DATA_PTR;
  * Currently only 2GiB are mapped for system memory. This is what
  * we pass to the U-Boot subsystem here.
  */
-#define USABLE_RAM_SIZE                0x80000000
+#define USABLE_RAM_SIZE                0x80000000ULL
 
 ulong board_get_usable_ram_top(ulong total_size)
 {
-       if (gd->ram_size > USABLE_RAM_SIZE)
-               return USABLE_RAM_SIZE;
+       unsigned long top = CONFIG_SYS_SDRAM_BASE + min(gd->ram_size, USABLE_RAM_SIZE);
 
-       return gd->ram_size;
+       return (gd->ram_top > top) ? top : gd->ram_top;
 }
 
 /*