efi: Move memory-map dumping into a common file

The 'efi mem' command dumps out the memory map. This is useful within
the app, even if commands are not enabled, so move it to a common file.
Rename it from 'print' to 'dump' since most things that dump information
use that word.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-08-11 14:21:09 -06:00
parent 7fb1c0760e
commit 02e141912b
4 changed files with 156 additions and 117 deletions

View File

@@ -733,6 +733,29 @@ static inline bool efi_use_host_arch(void)
*/
int efi_get_pxe_arch(void);
/**
* efi_mem_is_boot_services() - checks if the memory type relates to boot-time
*
* Return: true if loader code/data or boot-services code/data
*/
static inline bool efi_mem_is_boot_services(int type)
{
return type == EFI_LOADER_CODE || type == EFI_LOADER_DATA ||
type == EFI_BOOT_SERVICES_CODE ||
type == EFI_BOOT_SERVICES_DATA;
}
/**
* efi_dump_mem_table() - Dump out the EFI memory map
*
* @desc: List of descriptors to dump
* @size: Size of desc array in bytes
* @desc_size: Size of each description in @desc
* @skip_bs: true to skip boot-services allocations
*/
void efi_dump_mem_table(struct efi_mem_desc *desc, int size, int desc_size,
bool skip_bs);
/**
* calculate_paths() - Calculate the device and image patch from strings
*