[U-Boot] [PATCH][for 1.3.5] Fix handling of mem reserves for ramdisk

When we call fdt_chosen in bootm we get a dummy mem reserve added for the ramdisk location before its relocated. We need to delete that mem reserve before we call fdt_initrd() for the final fixup.
Signed-off-by: Kumar Gala galak@kernel.crashing.org --- lib_ppc/bootm.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c index 348421f..c801021 100644 --- a/lib_ppc/bootm.c +++ b/lib_ppc/bootm.c @@ -180,8 +180,22 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
#if defined(CONFIG_OF_LIBFDT) /* fixup the initrd now that we know where it should be */ - if ((of_flat_tree) && (initrd_start && initrd_end)) + if ((of_flat_tree) && (initrd_start && initrd_end)) { + uint64_t addr, size; + int total = fdt_num_mem_rsv(of_flat_tree); + int j; + + /* The call to fdt_chosen created a dummy mem rsv, delete it */ + for (j = 0; j < total; j++) { + fdt_get_mem_rsv(of_flat_tree, j, &addr, &size); + if (addr == images->rd_start) { + fdt_del_mem_rsv(of_flat_tree, j); + break; + } + } + fdt_initrd(of_flat_tree, initrd_start, initrd_end, 1); + } #endif debug ("## Transferring control to Linux (at address %08lx) ...\n", (ulong)kernel);

Dear Kumar Gala,
In message 1220631234-1051-1-git-send-email-galak@kernel.crashing.org you wrote:
When we call fdt_chosen in bootm we get a dummy mem reserve added for the ramdisk location before its relocated. We need to delete that mem reserve before we call fdt_initrd() for the final fixup.
There will be no such thing as a release 1.3.5; it will be callsed 2008-10 or so.
And I would like to see a reply to Heiko's (IMHO perfectly valid) question: why do we add a memory reservation just so we have to bother later to remove it again?
Best regards,
Wolfgang Denk
participants (2)
-
Kumar Gala
-
Wolfgang Denk