[U-Boot] [PATCH] cmd_mem: Decode the mtest start and end values from fdt

Jagannadha Sutradharudu Teki jagannadha.sutradharudu-teki at xilinx.com
Fri Mar 1 15:32:24 CET 2013


This patch provides a support to decode the mtest start
and end values from fdt config node.

Signed-off-by: Jagannadha Sutradharudu Teki <jaganna at xilinx.com>
Tested-by: Jagannadha Sutradharudu Teki <jaganna at xilinx.com>
---
 common/cmd_mem.c |    6 ++++--
 common/main.c    |   18 ++++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index d44aa1d..b41e182 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -642,12 +642,14 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
 	if (argc > 1)
 		start = (ulong *)simple_strtoul(argv[1], NULL, 16);
 	else
-		start = (ulong *)CONFIG_SYS_MEMTEST_START;
+		start = (ulong *)getenv_ulong("mteststart", 16,
+				CONFIG_SYS_MEMTEST_START);
 
 	if (argc > 2)
 		end = (ulong *)simple_strtoul(argv[2], NULL, 16);
 	else
-		end = (ulong *)(CONFIG_SYS_MEMTEST_END);
+		end = (ulong *)getenv_ulong("mtestend", 16,
+				CONFIG_SYS_MEMTEST_END);
 
 	if (argc > 3)
 		pattern = (ulong)simple_strtoul(argv[3], NULL, 16);
diff --git a/common/main.c b/common/main.c
index e2d2e09..d6613aa 100644
--- a/common/main.c
+++ b/common/main.c
@@ -345,6 +345,21 @@ static void process_fdt_options(const void *blob)
 	if (addr)
 		setenv_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
 }
+
+static void process_fdt_mem_options(const void *blob)
+{
+	ulong addr;
+
+	/* Add an env variable to point to a mtest start, if available */
+	addr = fdtdec_get_config_int(gd->fdt_blob, "mtest-start", 0);
+	if (addr)
+		setenv_addr("mteststart", (void *)addr);
+
+	/* Add an env variable to point to a mtest end, if available */
+	addr = fdtdec_get_config_int(gd->fdt_blob, "mtest-end", 0);
+	if (addr)
+		setenv_addr("mtestend", (void *)addr);
+}
 #endif /* CONFIG_OF_CONTROL */
 
 
@@ -475,6 +490,9 @@ void main_loop (void)
 	if (fdtdec_get_config_int(gd->fdt_blob, "bootsecure", 0))
 		secure_boot_cmd(env);
 
+	/* Get the mtest start and end from fdt */
+	process_fdt_mem_options(gd->fdt_blob);
+
 #endif /* CONFIG_OF_CONTROL */
 
 	debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
-- 
1.7.4




More information about the U-Boot mailing list