Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39ea1a3a authored by Stephen Boyd's avatar Stephen Boyd Committed by Patrick Daly
Browse files

memblock: Add memblock_overlaps_memory()



Add a new function, memblock_overlaps_memory(), to check if a
region overlaps with a memory bank. This will be used by
peripheral loader code to detect when kernel memory would be
overwritten.

Change-Id: I851f8f416a0f36e85c0e19536b5209f7d4bd431c
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent 59498fa0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -338,6 +338,7 @@ int memblock_is_map_memory(phys_addr_t addr);
int memblock_is_region_memory(phys_addr_t base, phys_addr_t size);
bool memblock_is_reserved(phys_addr_t addr);
bool memblock_is_region_reserved(phys_addr_t base, phys_addr_t size);
int memblock_overlaps_memory(phys_addr_t base, phys_addr_t size);

extern void __memblock_dump_all(void);

+7 −0
Original line number Diff line number Diff line
@@ -1615,6 +1615,13 @@ int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size
		 memblock.memory.regions[idx].size) >= end;
}

int __init_memblock memblock_overlaps_memory(phys_addr_t base, phys_addr_t size)
{
	memblock_cap_size(base, &size);

	return memblock_overlaps_region(&memblock.memory, base, size) >= 0;
}

/**
 * memblock_is_region_reserved - check if a region intersects reserved memory
 * @base: base of region to check