[Concept,19/24] lmb: Provide a static inline for lmb_alloc()

Message ID 20250922180116.3088502-20-sjg@u-boot.org
State New
Headers
Series boot: efi: Various improvements to booting with the EFI app |

Commit Message

Simon Glass Sept. 22, 2025, 6:01 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

When building xilinx_zynqmp_kria we cannot access lmb_alloc() since it
it is not present in the image. The linker garbage-collection does not
seem to handle this either.

Follow the normal procedure in this case and declare a static inline.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 include/lmb.h | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Patch

diff --git a/include/lmb.h b/include/lmb.h
index f221f0cce8f..3b52ee33abe 100644
--- a/include/lmb.h
+++ b/include/lmb.h
@@ -93,7 +93,16 @@  long lmb_reserve(phys_addr_t base, phys_size_t size);
  */
 long lmb_reserve_flags(phys_addr_t base, phys_size_t size,
 		       enum lmb_flags flags);
+
+#if CONFIG_IS_ENABLED(LMB)
 phys_addr_t lmb_alloc(phys_size_t size, ulong align);
+#else
+static inline phys_addr_t lmb_alloc(phys_size_t size, ulong align)
+{
+	return 0;
+}
+#endif
+
 phys_addr_t lmb_alloc_base(phys_size_t size, ulong align, phys_addr_t max_addr);
 phys_addr_t lmb_alloc_addr(phys_addr_t base, phys_size_t size);
 phys_size_t lmb_get_free_size(phys_addr_t addr);