If we are trying to map address zero, as is the case on raspberrypi, then we have no way of telling the difference between a valid efi_add_memory_map() at zero and an overlapping error at zero.
Instead of returning zero, return EFI_NO_MAPPING on carve-out errors. In include/efi.h we can see that EFI_SUCCESS is defined as 0, so it seems we ought to return one of the available EFI error codes. EFI_NO_MAPPING seems to make sense. Fixes: 5d00995c361c ("efi_loader: Implement memory allocation and map") Fixes: 74c16acce30b ("efi_loader: Don't allocate from memory holes") Cc: Heinrich Schuchardt <xypron.g...@gmx.de> Cc: Alexander Graf <ag...@csgraf.de> Signed-off-by: Bryan O'Donoghue <pure.lo...@nexus-software.ie> --- lib/efi_loader/efi_memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 27379381e8..7d6aab255c 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -277,7 +277,7 @@ uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type, * The user requested to only have RAM overlaps, * but we hit a non-RAM region. Error out. */ - return 0; + return EFI_NO_MAPPING; case EFI_CARVE_NO_OVERLAP: /* Just ignore this list entry */ break; @@ -307,7 +307,7 @@ uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type, * The payload wanted to have RAM overlaps, but we overlapped * with an unallocated region. Error out. */ - return 0; + return EFI_NO_MAPPING; } /* Add our new map */ -- 2.22.0 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot