From patchwork Sat Jan 5 01:51:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [U-Boot,RFC,21/44] sandbox: fdt: Support fdt command for sandbox X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 209631 Message-Id: <1357350734-13737-22-git-send-email-sjg@chromium.org> To: U-Boot Mailing List Cc: Joel A Fernandes , Jerry Van Baren , Tom Rini , Vadim Bendebury , =?UTF-8?q?Andreas=20B=C3=A4ck?= Date: Fri, 4 Jan 2013 17:51:50 -0800 From: Simon Glass List-Id: U-Boot discussion By using map_sysmem() we can get the fdt command to work correctly with sandbox. Signed-off-by: Simon Glass --- common/cmd_fdt.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c index a193cc3..3d5ff0f 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -56,7 +57,10 @@ struct fdt_header *working_fdt; void set_working_fdt_addr(void *addr) { - working_fdt = addr; + void *buf; + + buf = map_sysmem((ulong)addr, 0); + working_fdt = buf; setenv_addr("fdtaddr", addr); } @@ -132,14 +136,16 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } addr = simple_strtoul(argv[0], NULL, 16); - blob = (void *)addr; if (control) { #ifdef CONFIG_OF_CONTROL + blob = map_sysmem(addr, 0); if (!fdt_valid(gd->fdt_blob)) return 1; gd->fdt_blob = blob; #endif } else { + blob = map_sysmem(addr, 0); + if (!fdt_valid(blob)) return 1; set_working_fdt_addr((void *)addr);