/* * Translate a EFI virtual address into a physical address: this is necessary, * as some data members of the EFI system table are virtually remapped after * SetVirtualAddressMap() has been called.
*/ static phys_addr_t __init efi_to_phys(unsignedlong addr)
{
efi_memory_desc_t *md;
for_each_efi_memory_desc(md) { if (!(md->attribute & EFI_MEMORY_RUNTIME)) continue; if (md->virt_addr == 0) /* no virtual mapping has been installed by the stub */ break; if (md->virt_addr <= addr &&
(addr - md->virt_addr) < (md->num_pages << EFI_PAGE_SHIFT)) return md->phys_addr + addr - md->virt_addr;
} return addr;
}
/* * x86 defines its own screen_info and uses it even without EFI, * everything else can get it from here.
*/ #if !defined(CONFIG_X86) && (defined(CONFIG_SYSFB) || defined(CONFIG_EFI_EARLYCON)) struct screen_info screen_info __section(".data");
EXPORT_SYMBOL_GPL(screen_info); #endif
/* * Return true for regions that can be used as System RAM.
*/ static __init int is_usable_memory(efi_memory_desc_t *md)
{ switch (md->type) { case EFI_LOADER_CODE: case EFI_LOADER_DATA: case EFI_ACPI_RECLAIM_MEMORY: case EFI_BOOT_SERVICES_CODE: case EFI_BOOT_SERVICES_DATA: case EFI_CONVENTIONAL_MEMORY: case EFI_PERSISTENT_MEMORY: /* * According to the spec, these regions are no longer reserved * after calling ExitBootServices(). However, we can only use * them as System RAM if they can be mapped writeback cacheable.
*/ return (md->attribute & EFI_MEMORY_WB); default: break;
} returnfalse;
}
if (efi_enabled(EFI_DBG))
pr_info("Processing EFI memory map:\n");
/* * Discard memblocks discovered so far: if there are any at this * point, they originate from memory nodes in the DT, and UEFI * uses its own memory map instead.
*/
memblock_dump_all();
memblock_remove(0, PHYS_ADDR_MAX);
if (is_memory(md)) { /* * Special purpose memory is 'soft reserved', which * means it is set aside initially. Don't add a memblock * for it now so that it can be hotplugged back in or * be assigned to the dax driver after boot.
*/ if (efi_soft_reserve_enabled() &&
(md->attribute & EFI_MEMORY_SP)) continue;
early_init_dt_add_memory_arch(paddr, size);
if (!is_usable_memory(md))
memblock_mark_nomap(paddr, size);
/* keep ACPI reclaim memory intact for kexec etc. */ if (md->type == EFI_ACPI_RECLAIM_MEMORY)
memblock_reserve(paddr, size);
}
}
}
/* Grab UEFI information placed in FDT by stub */
efi_system_table = efi_get_fdt_params(&data); if (!efi_system_table) return;
if (efi_memmap_init_early(&data) < 0) { /* * If we are booting via UEFI, the UEFI memory map is the only * description of memory we have, so there is little point in * proceeding if we cannot access it.
*/
panic("Unable to map EFI memory map.\n");
}
WARN(efi.memmap.desc_version != 1, "Unexpected EFI_MEMORY_DESCRIPTOR version %ld",
efi.memmap.desc_version);
if (uefi_init(efi_system_table) < 0) {
efi_memmap_unmap(); return;
}
reserve_regions(); /* * For memblock manipulation, the cap should come after the memblock_add(). * And now, memblock is fully populated, it is time to do capping.
*/
early_init_dt_check_for_usable_mem_range();
efi_find_mirror();
efi_esrt_init();
efi_mokvar_table_init();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.