[PATCH v3 19/28] efi_loader: Update efi_add_memory_map() to use address
Simon Glass
sjg at chromium.org
Thu Nov 28 20:12:35 CET 2024
Update this function and its friend to use an address rather than a
pointer cast to an integer.
The callers are updated in later patches, as marked, to reduce the diff,
but we may which to squash some patches.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
(no changes since v1)
include/efi_loader.h | 11 +++++------
lib/efi_loader/efi_memory.c | 2 +-
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 4c346addae3..f1ae29b04d7 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -834,9 +834,9 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
/**
* efi_add_memory_map() - add memory area to the memory map
*
- * @start: start address of the memory area. Note that this is
- * actually a pointer provided as an integer. To pass in
- * an address, pass in (ulong)map_to_sysmem(addr)
+ * @start: start address, must be a multiple of EFI_PAGE_SIZE. Note
+ * that this is an address, not a pointer. Use
+ * map_to_sysmem(ptr) if you need to pass in a pointer
* @size: length in bytes of the memory area
* @mem_type: EFI type of memory added
* Return: status code
@@ -851,9 +851,8 @@ efi_status_t efi_add_memory_map(u64 start, u64 size,
* efi_add_memory_map_pg() - add pages to the memory map
*
* @start: start address, must be a multiple of EFI_PAGE_SIZE. Note that this
- * is actually a pointer provided as an integer. To pass in an address, pass
- * in (ulong)map_to_sysmem(addr)
- *
+ * is an address, not a pointer. Use map_to_sysmem(ptr) if you need to pass
+ * in a pointer
* @pages: number of pages to add
* @mem_type: EFI type of memory added
* @overlap_conventional: region may only overlap free(conventional)
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 89f22388fc4..157ba5ec50c 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -298,7 +298,7 @@ efi_status_t efi_add_memory_map_pg(u64 start, u64 pages,
if (!newlist)
return EFI_OUT_OF_RESOURCES;
newlist->type = mem_type;
- newlist->base = start;
+ newlist->base = (uintptr_t)map_sysmem(start, pages * EFI_PAGE_SIZE);
newlist->num_pages = pages;
switch (mem_type) {
--
2.34.1
More information about the U-Boot
mailing list