[PATCH 00/13] efi: Tidy up confusion between pointers and addresses

Simon Glass sjg at chromium.org
Mon Nov 25 21:44:39 CET 2024


The EFI-loader implementation converts things back and forth between
addresses and pointers, with not much consistency in how this is done.

Within most of U-Boot a pointer is a void * and an address is a ulong

This convention is very helpful, since it is obvious in common code as
to whether you need to call map_sysmem() and friends, or not.

As part of cleaning up the EFI memory-management, I found it almost
impossible to know in some cases whether something is an address or a
pointer. I decided to give up on that and come back to it when this is
resolved.

This series starts applying the normal ulong/void * convention to the
EFI_loader code, so making things easier to follow.

Link: https://lore.kernel.org/u-boot/20240725135629.3505072-1-sjg@chromium.org/


Simon Glass (13):
  efi: Define fields in struct efi_mem_desc
  efi_loader: Convert efi_get_memory_map() to return pointers
  efi_loader: Show the resulting memory address from an alloc
  efi_loader: Update startimage_exit self-test to check error
  efi_loader: Move some memory-function comments to header
  efi_loader: Use the enum for memory type
  efi_loader: Make more use of ulong
  efi_loader: Tidy up use of addresses
  lmb: Reduce mapmem contortions in lmb_map_update_notify()
  efi_loader: Simplify efi_dp_from_mem()
  efi_loader: Tidy up efi_reserve_memory()
  efi_loader: Drop extra brackets in efi_mem_carve_out()
  efi_loader: Don't try to add sandbox runtime code

 include/efi.h                                 |  15 ++
 include/efi_api.h                             |   6 +-
 include/efi_loader.h                          | 100 +++++--
 lib/efi_loader/efi_bootbin.c                  |   3 +-
 lib/efi_loader/efi_bootmgr.c                  |  11 +-
 lib/efi_loader/efi_boottime.c                 |  51 ++--
 lib/efi_loader/efi_device_path.c              |  18 +-
 lib/efi_loader/efi_dt_fixup.c                 |   8 +-
 lib/efi_loader/efi_helper.c                   |   7 +-
 lib/efi_loader/efi_image_loader.c             |   2 +-
 lib/efi_loader/efi_memory.c                   | 246 +++++++-----------
 lib/efi_loader/efi_var_mem.c                  |   6 +-
 .../efi_selftest_startimage_exit.c            |   6 +-
 lib/lmb.c                                     |  10 +-
 14 files changed, 251 insertions(+), 238 deletions(-)

-- 
2.43.0



More information about the U-Boot mailing list