From patchwork Tue Jan 10 07:54:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 135162 X-Patchwork-Delegate: sbabic@denx.de 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 18585B6FAA for ; Tue, 10 Jan 2012 18:43:52 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6297A285A6; Tue, 10 Jan 2012 08:43:47 +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 WJiVRE8tc4Wx; Tue, 10 Jan 2012 08:43:46 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1E20728594; Tue, 10 Jan 2012 08:43:46 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4170528586 for ; Tue, 10 Jan 2012 08:43:44 +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 nwXsHHnZFJLG for ; Tue, 10 Jan 2012 08:43:43 +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-iy0-f172.google.com (mail-iy0-f172.google.com [209.85.210.172]) by theia.denx.de (Postfix) with ESMTPS id 1E3F128595 for ; Tue, 10 Jan 2012 08:43:39 +0100 (CET) Received: by iagj37 with SMTP id j37so528898iag.3 for ; Mon, 09 Jan 2012 23:43:38 -0800 (PST) Received: by 10.42.155.136 with SMTP id u8mr21203379icw.12.1326181418230; Mon, 09 Jan 2012 23:43:38 -0800 (PST) Received: from localhost.localdomain ([114.216.232.184]) by mx.google.com with ESMTPS id pb6sm118272336igc.5.2012.01.09.23.43.33 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 Jan 2012 23:43:37 -0800 (PST) From: Shawn Guo To: u-boot@lists.denx.de Date: Tue, 10 Jan 2012 15:54:08 +0800 Message-Id: <1326182048-26418-1-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.4.1 Cc: "David A. Long" Subject: [U-Boot] [PATCH v3] common/image.c: align usage of fdt_high with initrd_high 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 The commit message of a28afca (Add uboot "fdt_high" enviroment variable) states that fdt_high behaves similarly to the existing initrd_high. But fdt_high actually has an outstanding difference from initrd_high. The former specifies the start address, while the later specifies the end address. As fdt_high and initrd_high will likely be used together, it'd be nice to have them behave same. The patch changes the behavior of fdt_high to have it aligned with initrd_high. The document of fdt_high in README is updated with an example to demonstrate the usage of this environment variable. Signed-off-by: Shawn Guo Acked-by: Simon Glass --- Changes since v3: * Fix the bug in case fdt_high=0xffffffff introduced by v1/v2. README | 8 ++++++++ common/image.c | 12 +++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/README b/README index ff72e47..1c3713c 100644 --- a/README +++ b/README @@ -3619,6 +3619,14 @@ List of environment variables (most likely not complete): fdt_high - if set this restricts the maximum address that the flattened device tree will be copied into upon boot. + For example, if you have a system with 1 GB memory + at physical address 0x10000000, while Linux kernel + only recognizes the first 704 MB as low memory, you + may need to set fdt_high as 0x3C000000 to have the + device tree blob be copied to the maximum address + of the 704 MB low memory, so that Linux kernel can + access it during the boot procedure. + If this is set to the special value 0xFFFFFFFF then the fdt will not be copied at all on boot. For this to work it must reside in writable memory, have diff --git a/common/image.c b/common/image.c index 77ca6e4..8c4137c 100644 --- a/common/image.c +++ b/common/image.c @@ -1288,16 +1288,14 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size) if (((ulong) desired_addr) == ~0UL) { /* All ones means use fdt in place */ - desired_addr = fdt_blob; + of_start = fdt_blob; + lmb_reserve(lmb, (ulong)of_start, of_len); disable_relocation = 1; - } - if (desired_addr) { + } else if (desired_addr) { of_start = (void *)(ulong) lmb_alloc_base(lmb, of_len, 0x1000, - ((ulong) - desired_addr) - + of_len); - if (desired_addr && of_start != desired_addr) { + (ulong)desired_addr); + if (of_start == 0) { puts("Failed using fdt_high value for Device Tree"); goto error; }