Commit fa34f6b25b3c92f27b245c52378a0d2af24aaa19

Authored by Shawn Guo
Committed by Albert ARIBAUD
1 parent ba901df41b

common/image.c: align usage of fdt_high with initrd_high

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>

Showing 2 changed files with 13 additions and 7 deletions Side-by-side Diff

... ... @@ -3665,6 +3665,14 @@
3665 3665  
3666 3666 fdt_high - if set this restricts the maximum address that the
3667 3667 flattened device tree will be copied into upon boot.
  3668 + For example, if you have a system with 1 GB memory
  3669 + at physical address 0x10000000, while Linux kernel
  3670 + only recognizes the first 704 MB as low memory, you
  3671 + may need to set fdt_high as 0x3C000000 to have the
  3672 + device tree blob be copied to the maximum address
  3673 + of the 704 MB low memory, so that Linux kernel can
  3674 + access it during the boot procedure.
  3675 +
3668 3676 If this is set to the special value 0xFFFFFFFF then
3669 3677 the fdt will not be copied at all on boot. For this
3670 3678 to work it must reside in writable memory, have
... ... @@ -1289,16 +1289,14 @@
1289 1289  
1290 1290 if (((ulong) desired_addr) == ~0UL) {
1291 1291 /* All ones means use fdt in place */
1292   - desired_addr = fdt_blob;
  1292 + of_start = fdt_blob;
  1293 + lmb_reserve(lmb, (ulong)of_start, of_len);
1293 1294 disable_relocation = 1;
1294   - }
1295   - if (desired_addr) {
  1295 + } else if (desired_addr) {
1296 1296 of_start =
1297 1297 (void *)(ulong) lmb_alloc_base(lmb, of_len, 0x1000,
1298   - ((ulong)
1299   - desired_addr)
1300   - + of_len);
1301   - if (desired_addr && of_start != desired_addr) {
  1298 + (ulong)desired_addr);
  1299 + if (of_start == 0) {
1302 1300 puts("Failed using fdt_high value for Device Tree");
1303 1301 goto error;
1304 1302 }