]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
common/image.c: align usage of fdt_high with initrd_high
authorShawn Guo <shawn.guo@linaro.org>
Mon, 9 Jan 2012 21:54:08 +0000 (21:54 +0000)
committerJohn Linn <john.linn@xilinx.com>
Thu, 2 Aug 2012 16:36:21 +0000 (09:36 -0700)
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 <shawn.guo@linaro.org>
Acked-by: Simon Glass <sjg@chromium.org>
README
common/image.c

diff --git a/README b/README
index 70c50b0e63e15097f645bd8e610eeb50e5927a71..7d23d0320172dc09ddc35582b135287526dfd440 100644 (file)
--- a/README
+++ b/README
@@ -3189,6 +3189,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
index 96f461f5791ca9d39b40b0371d245787f9dcf0f5..01a34d8326691180a8a01107d5ec83b1f85cef6b 100644 (file)
@@ -1259,16 +1259,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;
                        }