The lmb_map_update_notify() function is used to update the EFI memory
map based on corresponding changes in the LMB map. This is causing
build failure with a certain old architecture(armv5) toolchain, when
building with CONFIG_CC_OPTIMIZE_FOR_DEBUG symbol on platforms which
do not enable the EFI_LOADER code. Build the code in
lmb_map_update_notify() only when the EFI_LOADER config is enabled to
get around this issue.

Signed-off-by: Sughosh Ganu <sughosh.g...@linaro.org>
Suggested-by: Tom Rini <tr...@konsulko.com>
---
 lib/lmb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/lmb.c b/lib/lmb.c
index a55bfe289db..7f4b2315b15 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -428,7 +428,7 @@ long io_lmb_free(struct lmb *io_lmb, phys_addr_t base, 
phys_size_t size)
 
 static struct lmb lmb;
 
-static bool lmb_should_notify(u32 flags)
+static bool __maybe_unused lmb_should_notify(u32 flags)
 {
        return !lmb.test && !(flags & LMB_NONOTIFY) &&
                CONFIG_IS_ENABLED(EFI_LOADER);
@@ -437,6 +437,7 @@ static bool lmb_should_notify(u32 flags)
 static int lmb_map_update_notify(phys_addr_t addr, phys_size_t size, u8 op,
                                 u32 flags)
 {
+#if CONFIG_IS_ENABLED(EFI_LOADER)
        u64 efi_addr;
        u64 pages;
        efi_status_t status;
@@ -464,7 +465,7 @@ static int lmb_map_update_notify(phys_addr_t addr, 
phys_size_t size, u8 op,
                return -1;
        }
        unmap_sysmem((void *)(uintptr_t)efi_addr);
-
+#endif
        return 0;
 }
 
-- 
2.34.1

Reply via email to