From: Jan Kiszka <
jan.k...@siemens.com>
EFI_DT_INSTALL_TABLE is not an official flag according to [1]. It just
still exists in U-Boot for historic reasons. Avoid it by using
InstallConfigurationTable instead - a code path that can easily be
shared with the no-fixup-available case.
[1]
https://github.com/U-Boot-EFI/EFI_DT_FIXUP_PROTOCOL
Reported-by: Heinrich Schuchardt <
xypro...@gmx.de>
Signed-off-by: Jan Kiszka <
jan.k...@siemens.com>
---
kernel-stub/fdt.c | 44 +++++++++++++++++++++-----------------------
1 file changed, 21 insertions(+), 23 deletions(-)
diff --git a/kernel-stub/fdt.c b/kernel-stub/fdt.c
index a832660..e6fe410 100644
--- a/kernel-stub/fdt.c
+++ b/kernel-stub/fdt.c
@@ -185,37 +185,35 @@ EFI_STATUS replace_fdt(const VOID *fdt)
if (!fdt_buffer) {
return EFI_OUT_OF_RESOURCES;
}
+ } else {
+ /* Find out which size we need */
+ size = 0;
+ status = protocol->Fixup(protocol, (VOID *) fdt, &size,
+ EFI_DT_APPLY_FIXUPS);
+ if (status != EFI_BUFFER_TOO_SMALL) {
+ error(L"Device tree fixup: unexpected error", status);
+ return status;
+ }
+
+ fdt_buffer = clone_fdt(fdt, size);
+ if (!fdt_buffer) {
+ return EFI_OUT_OF_RESOURCES;
+ }
- status = BS->InstallConfigurationTable(&EfiDtbTableGuid,
- fdt_buffer);
+ status = protocol->Fixup(protocol, fdt_buffer, &size,
+ EFI_DT_APPLY_FIXUPS |
+ EFI_DT_RESERVE_MEMORY);
if (EFI_ERROR(status)) {
FreePool(fdt_buffer);
- error(L"Failed to install alternative device tree",
- status);
+ error(L"Device tree fixup failed", status);
+ return status;
}
- return status;
- }
-
- /* Find out which size we need */
- size = 0;
- status = protocol->Fixup(protocol, (VOID *) fdt, &size,
- EFI_DT_APPLY_FIXUPS);
- if (status != EFI_BUFFER_TOO_SMALL) {
- error(L"Device tree fixup: unexpected error", status);
- return status;
- }
-
- fdt_buffer = clone_fdt(fdt, size);
- if (!fdt_buffer) {
- return EFI_OUT_OF_RESOURCES;
}
- status = protocol->Fixup(protocol, fdt_buffer, &size,
- EFI_DT_APPLY_FIXUPS | EFI_DT_RESERVE_MEMORY |
- EFI_DT_INSTALL_TABLE);
+ status = BS->InstallConfigurationTable(&EfiDtbTableGuid, fdt_buffer);
if (EFI_ERROR(status)) {
FreePool(fdt_buffer);
- error(L"Device tree fixup failed", status);
+ error(L"Failed to install alternative device tree", status);
}
return status;
--
2.35.3