[U-Boot] [PATCH v3 5/9] fdt: sandbox: correct use of ${fdtcontroladdr}

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Nov 18 16:58:50 UTC 2018


The sandbox uses a virtual address space that is neither the physical nor
the virtual address space of the operating system. All address used on the
command line live in this address space. So also the environment variable
${fdtcontroladdr} has to be in this address space.

Commands like bootefi and booti receive the fdt address as parameter.
Without the patch ${fdtcontroladdr} cannot be used as parameter value on
the sandbox.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
v3
	new patch
---
 common/board_r.c | 3 ++-
 lib/fdtdec.c     | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/common/board_r.c b/common/board_r.c
index c55e33eec27..745212be71a 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -453,7 +453,8 @@ static int initr_env(void)
 	else
 		set_default_env(NULL, 0);
 #ifdef CONFIG_OF_CONTROL
-	env_set_addr("fdtcontroladdr", gd->fdt_blob);
+	env_set_hex("fdtcontroladdr",
+		    (unsigned long)map_to_sysmem(gd->fdt_blob));
 #endif
 
 	/* Initialize from environment */
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index a420ba18854..e4c1f6af157 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -11,6 +11,7 @@
 #include <errno.h>
 #include <fdtdec.h>
 #include <fdt_support.h>
+#include <mapmem.h>
 #include <linux/libfdt.h>
 #include <serial.h>
 #include <asm/sections.h>
@@ -1252,8 +1253,9 @@ int fdtdec_setup(void)
 #  if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
 	gd->fdt_blob = (void *)prior_stage_fdt_address;
 #  else
-	gd->fdt_blob = (void *)env_get_ulong("fdtcontroladdr", 16,
-						(uintptr_t)gd->fdt_blob);
+	gd->fdt_blob = map_sysmem
+		(env_get_ulong("fdtcontroladdr", 16,
+			       (unsigned long)map_to_sysmem(gd->fdt_blob)), 0);
 #  endif
 # endif
 
-- 
2.19.1



More information about the U-Boot mailing list