Similarly as the static regions and boot modules, memory regions with
EfiACPIReclaimMemory type (defined in bootinfo.acpi if CONFIG_ACPI is
enabled) should also not be overlapping with memory regions in
bootinfo.reserved_mem and bootinfo.modules.
Therefore, this commit reuses the `meminfo_overlap_check()` to further
extends the check in function `check_reserved_regions_overlap()` so that
memory regions in bootinfo.acpi are included. If any error occurs in the
extended `check_reserved_regions_overlap()`, the `meminfo_add_bank()`
defined in `efi-boot.h` will return early.
Signed-off-by: Henry Wang <Henry.Wang@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
EFI_MEMORY_DESCRIPTOR *desc)
{
struct membank *bank;
+ paddr_t start = desc->PhysicalStart;
+ paddr_t size = desc->NumberOfPages * EFI_PAGE_SIZE;
if ( mem->nr_banks >= NR_MEM_BANKS )
return false;
+#ifdef CONFIG_ACPI
+ if ( check_reserved_regions_overlap(start, size) )
+ return false;
+#endif
bank = &mem->bank[mem->nr_banks];
- bank->start = desc->PhysicalStart;
- bank->size = desc->NumberOfPages * EFI_PAGE_SIZE;
+ bank->start = start;
+ bank->size = size;
mem->nr_banks++;
region_start, region_size) )
return true;
+#ifdef CONFIG_ACPI
+ /* Check if input region is overlapping with ACPI EfiACPIReclaimMemory */
+ if ( meminfo_overlap_check(&bootinfo.acpi, region_start, region_size) )
+ return true;
+#endif
+
return false;
}