From patchwork Mon Mar 18 23:51:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 228848 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 82BE22C00A7 for ; Tue, 19 Mar 2013 10:56:29 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B92CC4A0C1; Tue, 19 Mar 2013 00:55:40 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yLETUY9lV52v; Tue, 19 Mar 2013 00:55:40 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3F9294A0C3; Tue, 19 Mar 2013 00:54:01 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 026174A040 for ; Tue, 19 Mar 2013 00:53:32 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dqVi0oxbmRlr for ; Tue, 19 Mar 2013 00:53:29 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-qa0-f74.google.com (mail-qa0-f74.google.com [209.85.216.74]) by theia.denx.de (Postfix) with ESMTPS id 614DC4A044 for ; Tue, 19 Mar 2013 00:53:21 +0100 (CET) Received: by mail-qa0-f74.google.com with SMTP id o13so355625qaj.1 for ; Mon, 18 Mar 2013 16:53:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=hzzHpGtmM6EzvFtmRQH7oiMk9F/szWiiYRBqxNpQJT4=; b=dzp+uHAUdJbXkdI62SsA8BFrklNyM+NOdwOqR1yVT25IjxWNcnR1Q5loDY0cY5Szuo A7ozKUs4iLlInyIGbbl+kykgvhqXC9iWQ0ceZexi+5zm5IYowKC3xp8njJ2MLooWYPbw 7niev0JNK3MqDxUFSGf+31WzRBnzHrCOnVf+xhU675kweusmhbrbS9bK8CSYtcXqub5y 9FJUrbiAkTczf3iPUsDulos8TJxyI+RRHFHb/5ZIsJTDNTuSA6UnYSPMWL0RJf7151MY fRsuNkFktRdqJrsV/+Ak+67cWkRUseQl/956AMnzm9RHzSe96HxUxSzV+iwJ8kFGwdOc t+/w== X-Received: by 10.58.75.65 with SMTP id a1mr15459754vew.35.1363650800440; Mon, 18 Mar 2013 16:53:20 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id u21si2189956yhj.0.2013.03.18.16.53.20 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Mon, 18 Mar 2013 16:53:20 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 3E4E631C00F; Mon, 18 Mar 2013 16:53:20 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 1D41A160341; Mon, 18 Mar 2013 16:53:20 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Mon, 18 Mar 2013 16:51:41 -0700 Message-Id: <1363650725-30459-22-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.1.3 In-Reply-To: <1363650725-30459-1-git-send-email-sjg@chromium.org> References: <1363650725-30459-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQl+RTIoEJthu1ykEy2lH1LMgObcJwmEml+RdxQ2awUKwnNcNAQ5TCX0Afvixz7nyBxuqDyRiA2PTl1DRJgdqEVWgdg2QY9FVtipEOhoC2wv5nkaqOEfa2OOkAvd8s0GuDuPuzhwZWvOM18OHZG50GSxQNPyxyKzWorh1iHliwCqpqsADbzXTv06HEq7lzlnXJsimPFV Cc: Joel A Fernandes , Will Drewry , u-boot-review@google.com, Bill Richardson , Randall Spangler , Jerry Van Baren , Tom Rini , Vadim Bendebury , =?UTF-8?q?Andreas=20B=C3=A4ck?= , Kees Cook Subject: [U-Boot] [PATCH v2 21/45] sandbox: fdt: Support fdt command for sandbox X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de By using map_sysmem() we can get the fdt command to work correctly with sandbox. Signed-off-by: Simon Glass --- Changes in v2: - Rebase to use updated fdt_valid() function common/cmd_fdt.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c index e582961..edefd77 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -31,6 +31,7 @@ #include #include #include +#include #define MAX_LEVEL 32 /* how deeply nested we will go */ #define SCRATCHPAD 1024 /* bytes of scratchpad memory */ @@ -55,7 +56,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); } @@ -129,13 +133,13 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } addr = simple_strtoul(argv[0], NULL, 16); - blob = (struct fdt_header *)addr; + blob = map_sysmem(addr, 0); if (!fdt_valid(&blob)) return 1; if (control) gd->fdt_blob = blob; else - set_working_fdt_addr((void *)addr); + set_working_fdt_addr(blob); if (argc >= 2) { int len;