Lines Matching +full:co +full:- +full:located

1 // SPDX-License-Identifier: GPL-2.0
8 * Copyright (C) 1999-2002 Hewlett-Packard Co.
9 * David Mosberger-Tang <davidm@hpl.hp.com>
11 * Copyright (C) 2005-2008 Intel Co.
17 * Borislav Petkov <bp@suse.de> - runtime services VA mapping
20 * 32/64 support code. --ying 2007-10-26
24 * in a future version. --drummond 1999-07-20
26 * Implemented EFI runtime services and virtual mode calls. --davidm
29 * Skip non-WB memory and ignore empty memory ranges.
37 #include <linux/efi-bgrt.h>
129 unsigned long long start = md->phys_addr; in do_add_efi_memmap()
130 unsigned long long size = md->num_pages << EFI_PAGE_SHIFT; in do_add_efi_memmap()
133 switch (md->type) { in do_add_efi_memmap()
140 && (md->attribute & EFI_MEMORY_SP)) in do_add_efi_memmap()
142 else if (md->attribute & EFI_MEMORY_WB) in do_add_efi_memmap()
176 * e820 mechanism for soft-reserved memory, import the full EFI memory
192 if (md->type == EFI_CONVENTIONAL_MEMORY && in do_efi_soft_reserve()
193 (md->attribute & EFI_MEMORY_SP)) in do_efi_soft_reserve()
209 if (IS_ENABLED(CONFIG_X86_32) && e->efi_memmap_hi > 0) { in efi_memblock_x86_reserve_range()
211 return -EINVAL; in efi_memblock_x86_reserve_range()
213 pmap = (phys_addr_t)(e->efi_memmap | ((u64)e->efi_memmap_hi << 32)); in efi_memblock_x86_reserve_range()
216 data.size = e->efi_memmap_size; in efi_memblock_x86_reserve_range()
217 data.desc_size = e->efi_memdesc_size; in efi_memblock_x86_reserve_range()
218 data.desc_version = e->efi_memdesc_version; in efi_memblock_x86_reserve_range()
239 #define OVERFLOW_ADDR_SHIFT (64 - EFI_PAGE_SHIFT)
245 u64 end = (md->num_pages << EFI_PAGE_SHIFT) + md->phys_addr - 1; in efi_memmap_entry_valid()
249 if (md->num_pages == 0) { in efi_memmap_entry_valid()
251 } else if (md->num_pages > EFI_PAGES_MAX || in efi_memmap_entry_valid()
252 EFI_PAGES_MAX - md->num_pages < in efi_memmap_entry_valid()
253 (md->phys_addr >> EFI_PAGE_SHIFT)) { in efi_memmap_entry_valid()
254 end_hi = (md->num_pages & OVERFLOW_ADDR_MASK) in efi_memmap_entry_valid()
257 if ((md->phys_addr & U64_HIGH_BIT) && !(end & U64_HIGH_BIT)) in efi_memmap_entry_valid()
266 pr_warn("mem%02u: %s range=[0x%016llx-0x%llx%016llx] (invalid)\n", in efi_memmap_entry_valid()
268 md->phys_addr, end_hi, end); in efi_memmap_entry_valid()
270 pr_warn("mem%02u: %s range=[0x%016llx-0x%016llx] (invalid)\n", in efi_memmap_entry_valid()
272 md->phys_addr, end); in efi_memmap_entry_valid()
300 .size = efi.memmap.desc_size * (efi.memmap.nr_map - n_removal), in efi_clean_memmap()
319 * hot-added devices.
325 * describe non-window space that's included in host bridge _CRS. If we
335 if (md->type == EFI_MEMORY_MAPPED_IO) { in efi_remove_e820_mmio()
336 size = md->num_pages << EFI_PAGE_SHIFT; in efi_remove_e820_mmio()
337 start = md->phys_addr; in efi_remove_e820_mmio()
338 end = start + size - 1; in efi_remove_e820_mmio()
340 pr_info("Remove mem%02u: MMIO range=[0x%08llx-0x%08llx] (%lluMB) from e820 map\n", in efi_remove_e820_mmio()
345 pr_info("Not removing mem%02u: MMIO range=[0x%08llx-0x%08llx] (%lluKB) from e820 map\n", in efi_remove_e820_mmio()
361 pr_info("mem%02u: %s range=[0x%016llx-0x%016llx] (%lluMB)\n", in efi_print_memmap()
363 md->phys_addr, in efi_print_memmap()
364 md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) - 1, in efi_print_memmap()
365 (md->num_pages >> (20 - EFI_PAGE_SHIFT))); in efi_print_memmap()
381 return -ENOMEM; in efi_systab_init()
393 efi_runtime = systab64->runtime; in efi_systab_init()
394 over4g = systab64->runtime > U32_MAX; in efi_systab_init()
402 return -ENOMEM; in efi_systab_init()
405 efi_fw_vendor = (unsigned long)data->fw_vendor; in efi_systab_init()
406 efi_config_table = (unsigned long)data->tables; in efi_systab_init()
408 over4g |= data->fw_vendor > U32_MAX || in efi_systab_init()
409 data->tables > U32_MAX; in efi_systab_init()
413 efi_fw_vendor = systab64->fw_vendor; in efi_systab_init()
414 efi_config_table = systab64->tables; in efi_systab_init()
416 over4g |= systab64->fw_vendor > U32_MAX || in efi_systab_init()
417 systab64->tables > U32_MAX; in efi_systab_init()
419 efi_nr_tables = systab64->nr_tables; in efi_systab_init()
423 efi_fw_vendor = systab32->fw_vendor; in efi_systab_init()
424 efi_runtime = systab32->runtime; in efi_systab_init()
425 efi_config_table = systab32->tables; in efi_systab_init()
426 efi_nr_tables = systab32->nr_tables; in efi_systab_init()
429 efi.runtime_version = hdr->revision; in efi_systab_init()
435 pr_err("EFI data located above 4GB, disabling EFI.\n"); in efi_systab_init()
436 return -EINVAL; in efi_systab_init()
461 return -ENOMEM; in efi_config_init()
476 pr_info("Table located above 4GB, disabling EFI.\n"); in efi_init()
494 * that doesn't match the kernel 32/64-bit mode. in efi_init()
498 pr_err("No EFI runtime due to 32/64-bit mismatch with kernel\n"); in efi_init()
513 if (tbl->memory_protection_attribute & in efi_init()
543 if (prev_md->type != md->type || in efi_merge_regions()
544 prev_md->attribute != md->attribute) { in efi_merge_regions()
549 prev_size = prev_md->num_pages << EFI_PAGE_SHIFT; in efi_merge_regions()
551 if (md->phys_addr == (prev_md->phys_addr + prev_size)) { in efi_merge_regions()
552 prev_md->num_pages += md->num_pages; in efi_merge_regions()
553 md->type = EFI_RESERVED_TYPE; in efi_merge_regions()
554 md->attribute = 0; in efi_merge_regions()
570 * A first-time allocation doesn't have anything to copy. in realloc_pages()
584 * will be mapped top-down. The end result is the same as if we had
592 return efi.memmap.map_end - efi.memmap.desc_size; in efi_map_next_entry_reverse()
594 entry -= efi.memmap.desc_size; in efi_map_next_entry_reverse()
602 * efi_map_next_entry - Return the next EFI memory map descriptor
624 * out-of-order leads to the firmware accessing in efi_map_next_entry()
630 * scheme by default for 64-bit. in efi_map_next_entry()
651 if (md->attribute & EFI_MEMORY_RUNTIME) in should_map_region()
655 * 32-bit EFI doesn't suffer from the bug that requires us to in should_map_region()
657 * doesn't exist for 32-bit kernels. in should_map_region()
666 if (md->type == EFI_CONVENTIONAL_MEMORY && in should_map_region()
668 (md->attribute & EFI_MEMORY_SP)) in should_map_region()
676 if (md->type == EFI_CONVENTIONAL_MEMORY || in should_map_region()
677 md->type == EFI_LOADER_DATA || in should_map_region()
678 md->type == EFI_LOADER_CODE) in should_map_region()
688 if (md->type == EFI_BOOT_SERVICES_CODE || in should_map_region()
689 md->type == EFI_BOOT_SERVICES_DATA) in should_map_region()
728 left -= desc_size; in efi_map_regions()
743 * non-native EFI. in kexec_enter_virtual_mode()
796 * The new method does a pagetable switch in a preemption-safe manner
821 pr_err("Error reallocating memory, EFI runtime non-functional!\n"); in __efi_enter_virtual_mode()
949 return attr->mode; in efi_attr_is_visible()