efi: Provide a way to sync EFI reserved-memory to fdt
When booting Linux with EFI the devicetree memory-map is ignored and Linux calls through EFI to obtain the real memory map. When booting Linux from the EFI app, without EFI, we must pass the reserved memory onto Linux using the devicetree. Add a function to support this. It reads the EFI memory-map and adds any missing regions to the reserved-memory node. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -794,6 +794,23 @@ static inline bool efi_mem_is_boot_services(int type)
|
||||
*/
|
||||
const char *efi_mem_type_name(enum efi_memory_type type);
|
||||
|
||||
/**
|
||||
* efi_mem_reserved_sync() - Sync EFI memory map with DT reserved-memory nodes
|
||||
*
|
||||
* Compares the EFI memory map with the device tree's reserved-memory nodes and
|
||||
* adds regions to the devicetree that are reserved in EFI but not mentioned in
|
||||
* the devicetree's '/reserved-memory' node. This ensures that memory regions
|
||||
* which EFI considers reserved are not used by the OS, e.g. because a
|
||||
* hypervisor may be in use..
|
||||
*
|
||||
* Note: This only works with #address-cells and #size-cells of 2
|
||||
*
|
||||
* @fdt: Pointer to the devicetree blob
|
||||
* @verbose: If true, show detailed output; if false, only show errors
|
||||
* Return: Number of regions synced, or -ve on error
|
||||
*/
|
||||
int efi_mem_reserved_sync(void *fdt, bool verbose);
|
||||
|
||||
/**
|
||||
* efi_dump_mem_table() - Dump out the EFI memory map
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user