Re: [PATCH v2 1/2] efi: Unify the memory map output of 'efi mem' and 'efidebug memmap'

Simon Glass <[email protected]>
Newsgroups gmane.comp.boot-loaders.u-boot
Message-ID <CAFLszTge=HbSCca1u0dUwjYEAurp-W=eHez15KT=mr+s9pQMFA@mail.gmail.com>
Hi Aristo,

On Fri, 24 Jul 2026 at 03:40, Aristo Chen <[email protected]> wrote:
>
> The efi and efidebug commands each carried their own code for printing
> the EFI memory map, with separate tables of memory type and attribute
> names. The copies had drifted: efidebug knew EFI_PERSISTENT_MEMORY_TYPE
> while 'efi mem' printed it as '<invalid>', neither table knew
> EFI_UNACCEPTED_MEMORY_TYPE, and the 'efi mem' printer had misaligned
> column headers, a broken '<gap>' line and a superfluous Virtual column:
> the map is identity mapped before SetVirtualAddressMap() is called, so
> the field carries no information at the time the command can run.
>
> Move the printing loop of 'efidebug memmap' into efi_common.c as
> efi_show_memmap(), which is linked into both commands, and use it from
> both. The second copy in 'efi mem' is deleted together with
> efi_print_mem_table() and the private sorting and merging code,
> including the 'all' argument.
>
> The memory type names follow the UEFI specification with the leading
> 'Efi' and the trailing 'Type' stripped, for example ConventionalMemory
> for EfiConventionalMemory, and the missing name for unaccepted memory
> is added. The type column is widened to fit the longest name,
> MemoryMappedIOPortSpace.
>
> The shared function iterates the map with the descriptor size reported
> by the firmware instead of assuming sizeof(struct efi_mem_desc). This
> matters for 'efi mem' under EDK II based firmware, which reports a
> descriptor size of 0x30. The memory map key, which was printed
> uninitialized on the payload path, is now initialized. The command
> documentation is updated with output captured from the app running
> under OVMF, and documents why virtual addresses are not shown.
>
> Suggested-by: Heinrich Schuchardt <[email protected]>
> Signed-off-by: Aristo Chen <[email protected]>
> ---
> Changes in v2:
> - Supersedes v1's table-only unification: the whole printer is now
>   shared, the type names follow the UEFI specification, the Virtual
>   column is dropped and the map is iterated with the firmware-reported
>   descriptor size
>
>  cmd/efi.c             | 221 +-----------------------------
>  cmd/efi_common.c      | 121 +++++++++++++++++
>  cmd/efidebug.c        |  96 +------------
>  doc/usage/cmd/efi.rst | 306 ++++++++++++++++++++----------------------
>  include/efi.h         |  18 +++
>  5 files changed, 292 insertions(+), 470 deletions(-)

I'm not seeing this one in patchwork - could you please check and send
a link if I am missing it?

Regards,
SImon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.