From patchwork Sat Apr 20 18:42:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 238171 X-Patchwork-Delegate: sjg@chromium.org 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 8139C2C0082 for ; Sun, 21 Apr 2013 04:47:16 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 166444A488; Sat, 20 Apr 2013 20:46:12 +0200 (CEST) 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 oTlQdE6qiE2e; Sat, 20 Apr 2013 20:46:11 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E182A4A489; Sat, 20 Apr 2013 20:44:28 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5E2754A3C9 for ; Sat, 20 Apr 2013 20:43:58 +0200 (CEST) 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 elctijhwk-vl for ; Sat, 20 Apr 2013 20:43:57 +0200 (CEST) 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-vb0-f73.google.com (mail-vb0-f73.google.com [209.85.212.73]) by theia.denx.de (Postfix) with ESMTPS id 9C2064A3F4 for ; Sat, 20 Apr 2013 20:43:19 +0200 (CEST) Received: by mail-vb0-f73.google.com with SMTP id q12so545557vbe.0 for ; Sat, 20 Apr 2013 11:43:15 -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=KoFoOv+pSgRWTiRRhhbbcWh8dbE0y+wadDVaBDY6REE=; b=bMbNdZaXPMDH2LaitP9WZW7s7wLJyllqKD3Jan2liOIzXbrySawWL/B6gGLkh3mYHP zxgVOKIDl54fUimwiagwDyXj64TIyjXsPSTNhldQ0nSGRkSbj5vEfGvE+mmq8yEkzpfE Tn9NFI4Oz61WsRfmurFvddneU+HEoCEH40M3Mc4dcP+Y8nwv4gj8Zg3nqcXq63EWjfM5 NHDC+I+yGPTV+juTEA6ikpXuZSPVV2LiPVxIWrkIvzKhqRYf/BZh+Fe2mqlGChSfMxi+ rrswo/19wQgqblHd5GdDqoU1OH1lCqX1Qc3GO2Uj+AwChoyIsOfGRvgcWoGOV04jKsWW SzeA== X-Received: by 10.236.223.194 with SMTP id v62mr6973428yhp.32.1366483395643; Sat, 20 Apr 2013 11:43:15 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id q58si4433775yhe.4.2013.04.20.11.43.15 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Sat, 20 Apr 2013 11:43:15 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.83.1]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 779DB5A40F3; Sat, 20 Apr 2013 11:43:15 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 58D96160982; Sat, 20 Apr 2013 11:43:15 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Sat, 20 Apr 2013 11:42:45 -0700 Message-Id: <1366483372-16523-11-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1366483372-16523-1-git-send-email-sjg@chromium.org> References: <1366483372-16523-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQmvo2rzmVEotWTzAUZimDZLQMXkRtrX4izFSYCafE1iGXtnoPoGGMcs7JsrDxuCTClWZlCTaEz5GKHQVHOyPGw61w7QLSnlbj+a84WK0IZaZ+wpYIVEGxwDzoA7dLT4urXl904ZM2ytA5uKYlOFrkNnkCbLcuDORVNLO0m7tgw2LCEDUWbTtW7ahZHV3M4iMpn7FDyv Cc: Tom Rini , u-boot-review@google.com, Jerry Van Baren Subject: [U-Boot] [PATCH v3 10/17] 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 Acked-by: Gerald Van Baren --- Changes in v3: None 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;