[U-Boot] [PATCH] board_f: Do not mark pre-relocated fdt space as reserved

Lokesh Vutla lokeshvutla at ti.com
Tue Apr 16 08:43:47 UTC 2019


SPL while copying u-boot and dtb it does the following:
- Copy u-boot
- Copy right dtb.
- mark dtb location as reserved in dtb.

U-Boot when copying images at U-Boot prompt, is not able to copy to the
above dtb location as it sees the region as reserved. But at this stage
dtb is re located to end of DDR. And the above dtb region is not reserved
anymore. So delete this reserved region when re locating dtb.

Reported-by: Keerthy <j-keerthy at ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla at ti.com>
---
 common/board_f.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/common/board_f.c b/common/board_f.c
index 149a7229e8..e4383ae3fa 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -651,10 +651,23 @@ static int init_post(void)
 static int reloc_fdt(void)
 {
 #ifndef CONFIG_OF_EMBED
+	uint64_t addr, size;
+	int i, cnt, err;
+
 	if (gd->flags & GD_FLG_SKIP_RELOC)
 		return 0;
 	if (gd->new_fdt) {
 		memcpy(gd->new_fdt, gd->fdt_blob, gd->fdt_size);
+
+		/* Deleting the previously marked FDT reserved region */
+		cnt = fdt_num_mem_rsv(gd->new_fdt);
+		for (i = 0; i < cnt ; i++) {
+			err = fdt_get_mem_rsv(gd->new_fdt, i, &addr, &size);
+			if (!err && addr == (uintptr_t)gd->fdt_blob) {
+				fdt_del_mem_rsv(gd->new_fdt, i);
+				break;
+			}
+		}
 		gd->fdt_blob = gd->new_fdt;
 	}
 #endif
-- 
2.21.0



More information about the U-Boot mailing list