ANDROID: GKI: memblock: Add memblock_overlaps_memory() to fix ABI diff

This is needed to reduce the ABI diff for vendors.
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.

Signed-off-by: Swathi Sridhar <swatsrid@codeaurora.org>
(cherry picked from commit bbbc80b6d8b75ffea6a0eb1f53ab503ccf0011f1)
[surenb: cherry-picked parts from:
bbbc80b6d8b75 "ion : Merge ion changes..."
to fix ABI diff caused by memblock_overlaps_memory function]
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Bug: 150875716
Test: build
Change-Id: I6ee723c99ef171f23a621d130eded843222ba4f7
This commit is contained in:
Stephen Boyd
2012-05-14 18:55:50 -07:00
committed by Suren Baghdasaryan
parent f32f289c4f
commit fe48ed944b
2 changed files with 9 additions and 0 deletions

View File

@@ -352,6 +352,7 @@ bool memblock_is_map_memory(phys_addr_t addr);
bool 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);
bool memblock_overlaps_memory(phys_addr_t base, phys_addr_t size);
extern void __memblock_dump_all(void);

View File

@@ -1773,6 +1773,14 @@ bool __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t siz
memblock.memory.regions[idx].size) >= end;
}
bool __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);
}
/**
* memblock_is_region_reserved - check if a region intersects reserved memory
* @base: base of region to check