Lines Matching refs:md
102 efi_memory_desc_t *md; in efi_find_mirror() local
105 for_each_efi_memory_desc(md) { in efi_find_mirror()
106 unsigned long long start = md->phys_addr; in efi_find_mirror()
107 unsigned long long size = md->num_pages << EFI_PAGE_SHIFT; in efi_find_mirror()
110 if (md->attribute & EFI_MEMORY_MORE_RELIABLE) { in efi_find_mirror()
128 efi_memory_desc_t *md; in do_add_efi_memmap() local
130 for_each_efi_memory_desc(md) { in do_add_efi_memmap()
131 unsigned long long start = md->phys_addr; in do_add_efi_memmap()
132 unsigned long long size = md->num_pages << EFI_PAGE_SHIFT; in do_add_efi_memmap()
135 switch (md->type) { in do_add_efi_memmap()
141 if (md->attribute & EFI_MEMORY_WB) in do_add_efi_memmap()
217 static bool __init efi_memmap_entry_valid(const efi_memory_desc_t *md, int i) in efi_memmap_entry_valid() argument
219 u64 end = (md->num_pages << EFI_PAGE_SHIFT) + md->phys_addr - 1; in efi_memmap_entry_valid()
223 if (md->num_pages == 0) { in efi_memmap_entry_valid()
225 } else if (md->num_pages > EFI_PAGES_MAX || in efi_memmap_entry_valid()
226 EFI_PAGES_MAX - md->num_pages < in efi_memmap_entry_valid()
227 (md->phys_addr >> EFI_PAGE_SHIFT)) { in efi_memmap_entry_valid()
228 end_hi = (md->num_pages & OVERFLOW_ADDR_MASK) in efi_memmap_entry_valid()
231 if ((md->phys_addr & U64_HIGH_BIT) && !(end & U64_HIGH_BIT)) in efi_memmap_entry_valid()
241 i, efi_md_typeattr_format(buf, sizeof(buf), md), in efi_memmap_entry_valid()
242 md->phys_addr, end_hi, end); in efi_memmap_entry_valid()
245 i, efi_md_typeattr_format(buf, sizeof(buf), md), in efi_memmap_entry_valid()
246 md->phys_addr, end); in efi_memmap_entry_valid()
279 efi_memory_desc_t *md; in efi_print_memmap() local
282 for_each_efi_memory_desc(md) { in efi_print_memmap()
286 i++, efi_md_typeattr_format(buf, sizeof(buf), md), in efi_print_memmap()
287 md->phys_addr, in efi_print_memmap()
288 md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) - 1, in efi_print_memmap()
289 (md->num_pages >> (20 - EFI_PAGE_SHIFT))); in efi_print_memmap()
550 void __init efi_set_executable(efi_memory_desc_t *md, bool executable) in efi_set_executable() argument
554 addr = md->virt_addr; in efi_set_executable()
555 npages = md->num_pages; in efi_set_executable()
567 efi_memory_desc_t *md; in runtime_code_page_mkexec() local
570 for_each_efi_memory_desc(md) { in runtime_code_page_mkexec()
571 if (md->type != EFI_RUNTIME_SERVICES_CODE) in runtime_code_page_mkexec()
574 efi_set_executable(md, true); in runtime_code_page_mkexec()
588 void __init old_map_region(efi_memory_desc_t *md) in old_map_region() argument
594 start_pfn = PFN_DOWN(md->phys_addr); in old_map_region()
595 size = md->num_pages << PAGE_SHIFT; in old_map_region()
596 end = md->phys_addr + size; in old_map_region()
600 va = __va(md->phys_addr); in old_map_region()
602 if (!(md->attribute & EFI_MEMORY_WB)) in old_map_region()
605 va = efi_ioremap(md->phys_addr, size, in old_map_region()
606 md->type, md->attribute); in old_map_region()
608 md->virt_addr = (u64) (unsigned long) va; in old_map_region()
611 (unsigned long long)md->phys_addr); in old_map_region()
617 efi_memory_desc_t *md, *prev_md = NULL; in efi_merge_regions() local
619 for_each_efi_memory_desc(md) { in efi_merge_regions()
623 prev_md = md; in efi_merge_regions()
627 if (prev_md->type != md->type || in efi_merge_regions()
628 prev_md->attribute != md->attribute) { in efi_merge_regions()
629 prev_md = md; in efi_merge_regions()
635 if (md->phys_addr == (prev_md->phys_addr + prev_size)) { in efi_merge_regions()
636 prev_md->num_pages += md->num_pages; in efi_merge_regions()
637 md->type = EFI_RESERVED_TYPE; in efi_merge_regions()
638 md->attribute = 0; in efi_merge_regions()
641 prev_md = md; in efi_merge_regions()
645 static void __init get_systab_virt_addr(efi_memory_desc_t *md) in get_systab_virt_addr() argument
650 size = md->num_pages << EFI_PAGE_SHIFT; in get_systab_virt_addr()
651 end = md->phys_addr + size; in get_systab_virt_addr()
653 if (md->phys_addr <= systab && systab < end) { in get_systab_virt_addr()
654 systab += md->virt_addr - md->phys_addr; in get_systab_virt_addr()
744 static bool should_map_region(efi_memory_desc_t *md) in should_map_region() argument
749 if (md->attribute & EFI_MEMORY_RUNTIME) in should_map_region()
765 if (md->type == EFI_CONVENTIONAL_MEMORY || in should_map_region()
766 md->type == EFI_LOADER_DATA || in should_map_region()
767 md->type == EFI_LOADER_CODE) in should_map_region()
777 if (md->type == EFI_BOOT_SERVICES_CODE || in should_map_region()
778 md->type == EFI_BOOT_SERVICES_DATA) in should_map_region()
793 efi_memory_desc_t *md; in efi_map_regions() local
799 md = p; in efi_map_regions()
801 if (!should_map_region(md)) in efi_map_regions()
804 efi_map_region(md); in efi_map_regions()
805 get_systab_virt_addr(md); in efi_map_regions()
816 memcpy(new_memmap + (*count * desc_size), md, desc_size); in efi_map_regions()
828 efi_memory_desc_t *md; in kexec_enter_virtual_mode() local
855 for_each_efi_memory_desc(md) { in kexec_enter_virtual_mode()
856 efi_map_region_fixed(md); /* FIXME: add error handling */ in kexec_enter_virtual_mode()
857 get_systab_virt_addr(md); in kexec_enter_virtual_mode()
1038 efi_memory_desc_t *md; in efi_mem_type() local
1043 for_each_efi_memory_desc(md) { in efi_mem_type()
1044 if ((md->phys_addr <= phys_addr) && in efi_mem_type()
1045 (phys_addr < (md->phys_addr + in efi_mem_type()
1046 (md->num_pages << EFI_PAGE_SHIFT)))) in efi_mem_type()
1047 return md->type; in efi_mem_type()