Re: [PATCH v2 1/5] efi_loader: bootmgr: preserve a passed devicetree
Ilias Apalodimas <[email protected]> Tue, 4 Aug 2026 11:51:32 +0300
| Newsgroups | gmane.comp.boot-loaders.u-boot |
|---|---|
| Message-ID | <CAC_iWjLBoAJfkBspBKiyiGQkXB0=7evZ1k2AtEo58Yf8WrR8JA@mail.gmail.com> |
On Tue, 28 Jul 2026 at 16:20, Carlo Caione <[email protected]> wrote: > > An FDT explicitly passed to efi_bootmgr_run() is currently replaced by > the FDT referenced by the selected Boot#### load option. This makes an > operator-supplied devicetree ineffective whenever the boot option carries > one. > > Only consult the load-option FDT when no FDT was passed. Document the > resulting precedence so the explicit call argument remains the > highest-priority source. > > Signed-off-by: Carlo Caione <[email protected]> > --- Reviewed-by: Ilias Apalodimas <[email protected]> > lib/efi_loader/efi_bootmgr.c | 20 +++++++++++--------- > 1 file changed, 11 insertions(+), 9 deletions(-) > > diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c > index 8c9a9b5eb56..785484abf23 100644 > --- a/lib/efi_loader/efi_bootmgr.c > +++ b/lib/efi_loader/efi_bootmgr.c > @@ -1294,9 +1294,9 @@ out: > * efi_bootmgr_run() - execute EFI boot manager > * @fdt: Flat device tree > * > - * Invoke EFI boot manager and execute a binary depending on > - * boot options. If @fdt is not NULL, it will be passed to > - * the executed binary. > + * Invoke the EFI boot manager and execute a binary according to its boot > + * options. The devicetree precedence, from highest to lowest, is an FDT > + * passed in @fdt, the Boot#### load-option FDT, then the distro/ESP FDT. > * > * Return: status code > */ > @@ -1305,7 +1305,7 @@ efi_status_t efi_bootmgr_run(void *fdt) > efi_handle_t handle; > void *load_options; > efi_status_t ret; > - void *fdt_lo, *fdt_distro = NULL; > + void *fdt_lo = NULL, *fdt_distro = NULL; > efi_uintn_t fdt_size; > > /* Initialize EFI drivers */ > @@ -1320,11 +1320,13 @@ efi_status_t efi_bootmgr_run(void *fdt) > } > > if (!IS_ENABLED(CONFIG_GENERATE_ACPI_TABLE)) { > - ret = load_fdt_from_load_option(&fdt_lo); > - if (ret != EFI_SUCCESS) > - return ret; > - if (fdt_lo) > - fdt = fdt_lo; > + if (!fdt) { > + ret = load_fdt_from_load_option(&fdt_lo); > + if (ret != EFI_SUCCESS) > + return ret; > + if (fdt_lo) > + fdt = fdt_lo; > + } > if (!fdt) { > efi_load_distro_fdt(handle, &fdt_distro, &fdt_size); > fdt = fdt_distro; > > -- > 2.55.0 >