xen/arm: Avoid code duplication in check_reserved_regions_overlap

The function check_reserved_regions_overlap is calling
'meminfo_overlap_check' on the same type of structure, this code
can be written in a way to avoid code duplication, so rework the
function to do that.

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
This commit is contained in:
Luca Fancellu authored and Julien Grall committed 2024-04-24 19:13:35 +01:00
1 parent b3e66aa1c2
commit 9f657d8832
1 file changed
+13 -11
+13 -11
View File
@@ -340,25 +340,27 @@ void __init fw_unreserved_regions(paddr_t s, paddr_t e,
bool __init check_reserved_regions_overlap(paddr_t region_start,
paddr_t region_size)
{
const struct membanks *mem_banks[] = {
bootinfo_get_reserved_mem(),
#ifdef CONFIG_ACPI
bootinfo_get_acpi(),
#endif
};
unsigned int i;
/*
* Check if input region is overlapping with bootinfo_get_reserved_mem()
* banks
* Check if input region is overlapping with reserved memory banks or
* ACPI EfiACPIReclaimMemory (when ACPI feature is enabled)
*/
if ( meminfo_overlap_check(bootinfo_get_reserved_mem(),
region_start, region_size) )
return true;
for ( i = 0; i < ARRAY_SIZE(mem_banks); i++ )
if ( meminfo_overlap_check(mem_banks[i], region_start, region_size) )
return true;
/* Check if input region is overlapping with bootmodules */
if ( bootmodules_overlap_check(&bootinfo.modules,
region_start, region_size) )
return true;
#ifdef CONFIG_ACPI
/* Check if input region is overlapping with ACPI EfiACPIReclaimMemory */
if ( meminfo_overlap_check(bootinfo_get_acpi(), region_start, region_size) )
return true;
#endif
return false;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.