public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] common: board: support systems with where RAM ends beyond 4GB
@ 2014-12-23 17:34 Stephen Warren
  2014-12-23 17:34 ` [U-Boot] [PATCH 2/3] ARM: tegra: fix variable naming in query_sdram_size() Stephen Warren
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Stephen Warren @ 2014-12-23 17:34 UTC (permalink / raw)
  To: u-boot

From: Stephen Warren <swarren@nvidia.com>

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>
---
 common/board_f.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/common/board_f.c b/common/board_f.c
index 98c9c728ce73..c1ada8d62009 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -360,6 +360,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;
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-01-22 18:06 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-23 17:34 [U-Boot] [PATCH 1/3] common: board: support systems with where RAM ends beyond 4GB Stephen Warren
2014-12-23 17:34 ` [U-Boot] [PATCH 2/3] ARM: tegra: fix variable naming in query_sdram_size() Stephen Warren
2014-12-23 20:02   ` Simon Glass
2014-12-23 17:34 ` [U-Boot] [PATCH 3/3] ARM: tegra: support large RAM sizes Stephen Warren
2014-12-23 20:05   ` Simon Glass
2014-12-23 20:34     ` Stephen Warren
2014-12-23 22:18       ` Simon Glass
2014-12-23 20:01 ` [U-Boot] [PATCH 1/3] common: board: support systems with where RAM ends beyond 4GB Simon Glass
2014-12-23 20:22   ` Stephen Warren
2014-12-23 20:26     ` Simon Glass
2015-01-19 22:57 ` Stephen Warren
2015-01-20 15:28   ` Tom Warren
2015-01-20 15:56   ` Tom Warren
2015-01-22 18:06     ` Stephen Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox