]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
common: board: support systems with where RAM ends beyond 4GB
authorStephen Warren <swarren@nvidia.com>
Tue, 23 Dec 2014 17:34:49 +0000 (10:34 -0700)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 1 Sep 2015 12:10:26 +0000 (14:10 +0200)
Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
common/board_f.c

index b54ff2320ee97926ad7cc3ac650260014e7ed2b7..762e97cb9e5734493224401f38cd30b2a23d240e 100644 (file)
@@ -365,6 +365,18 @@ static int setup_fdt(void)
 /* Get the top of usable RAM */
 __weak ulong board_get_usable_ram_top(ulong total_size)
 {
+#ifdef CONFIG_SYS_SDRAM_BASE
+       /*
+        * Detect whether we have so much RAM it goes past the end of our
+        * 32-bit address space. If so, clip the usable RAM so it doesn't.
+        */
+       if (gd->ram_top < CONFIG_SYS_SDRAM_BASE)
+               /*
+                * Will wrap back to top of 32-bit space when reservations
+                * are made.
+                */
+               return 0;
+#endif
        return gd->ram_top;
 }