We have a nice framework around image fils to prepare a device tree
for OS execution. That one patches in missing device tree nodes and
fixes up the memory range bits.
We need to call that one from the EFI boot path too to get all those
nice fixups. This patch adds the call.
Signed-off-by: Alexander Graf <agraf@suse.de>
{
ulong (*entry)(void *image_handle, struct efi_system_table *st);
ulong fdt_pages, fdt_size, fdt_start, fdt_end;
{
ulong (*entry)(void *image_handle, struct efi_system_table *st);
ulong fdt_pages, fdt_size, fdt_start, fdt_end;
+ bootm_headers_t img = { 0 };
/*
* gd lives in a fixed register which may get clobbered while we execute
/*
* gd lives in a fixed register which may get clobbered while we execute
/* Update system table to point to our currently loaded FDT */
if (working_fdt) {
/* Update system table to point to our currently loaded FDT */
if (working_fdt) {
+ /* Prepare fdt for payload */
+ if (image_setup_libfdt(&img, working_fdt, 0, NULL)) {
+ printf("ERROR: Failed to process device tree\n");
+ return -EINVAL;
+ }
+
+ /* Link to it in the efi tables */
systab.tables[0].guid = EFI_FDT_GUID;
systab.tables[0].table = working_fdt;
systab.nr_tables = 1;
systab.tables[0].guid = EFI_FDT_GUID;
systab.tables[0].table = working_fdt;
systab.nr_tables = 1;
fdt_fixup_ethernet(blob);
/* Delete the old LMB reservation */
fdt_fixup_ethernet(blob);
/* Delete the old LMB reservation */
- lmb_free(lmb, (phys_addr_t)(u32)(uintptr_t)blob,
- (phys_size_t)fdt_totalsize(blob));
+ if (lmb)
+ lmb_free(lmb, (phys_addr_t)(u32)(uintptr_t)blob,
+ (phys_size_t)fdt_totalsize(blob));
ret = fdt_shrink_to_minimum(blob);
if (ret < 0)
ret = fdt_shrink_to_minimum(blob);
if (ret < 0)
fdt_set_totalsize(blob, of_size);
}
/* Create a new LMB reservation */
fdt_set_totalsize(blob, of_size);
}
/* Create a new LMB reservation */
- lmb_reserve(lmb, (ulong)blob, of_size);
+ if (lmb)
+ lmb_reserve(lmb, (ulong)blob, of_size);
fdt_initrd(blob, *initrd_start, *initrd_end);
if (!ft_verify_fdt(blob))
fdt_initrd(blob, *initrd_start, *initrd_end);
if (!ft_verify_fdt(blob))