diff options
author | Saurabh Gorecha <sgorecha@codeaurora.org> | 2020-10-15 00:05:36 +0530 |
---|---|---|
committer | Saurabh Gorecha <sgorecha@codeaurora.org> | 2020-10-16 02:23:35 +0530 |
commit | e0caf8f57ce4c7e16f1b72b19265748647f9744e (patch) | |
tree | 6b51ad4faba1a2d193a663941538f212e95591bb | |
parent | 7ad39818b184850d263008e7d36ba16adf72a669 (diff) | |
download | trusted-firmware-a-e0caf8f57ce4c7e16f1b72b19265748647f9744e.tar.gz |
Update in coreboot_get_memory_type API to include size as well
Change-Id: I3f563cffd58b0591b433c85c0ff6b71e486eb2c8
Signed-off-by: Saurabh Gorecha <sgorecha@codeaurora.org>
-rw-r--r-- | include/lib/coreboot.h | 2 | ||||
-rw-r--r-- | lib/coreboot/coreboot_table.c | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/include/lib/coreboot.h b/include/lib/coreboot.h index dda3173a26..0aa65791dd 100644 --- a/include/lib/coreboot.h +++ b/include/lib/coreboot.h @@ -39,7 +39,7 @@ typedef enum { CB_MEM_TABLE = 16, } coreboot_memory_t; -coreboot_memory_t coreboot_get_memory_type(uintptr_t address); +coreboot_memory_t coreboot_get_memory_type(uintptr_t start, size_t size); void coreboot_table_setup(void *base); #endif /* COREBOOT_H */ diff --git a/lib/coreboot/coreboot_table.c b/lib/coreboot/coreboot_table.c index c4cd1d752e..fb31ef1e07 100644 --- a/lib/coreboot/coreboot_table.c +++ b/lib/coreboot/coreboot_table.c @@ -89,7 +89,7 @@ static void setup_cbmem_console(uintptr_t baseaddr) CONSOLE_FLAG_CRASH); } -coreboot_memory_t coreboot_get_memory_type(uintptr_t address) +coreboot_memory_t coreboot_get_memory_type(uintptr_t start, size_t size) { int i; @@ -98,9 +98,11 @@ coreboot_memory_t coreboot_get_memory_type(uintptr_t address) if (range->type == CB_MEM_NONE) break; /* end of table reached */ - if (address >= range->start && - address - range->start < range->size) + if ((start >= range->start) && + (start - range->start < range->size) && + (size <= range->size - (start - range->start))) { return range->type; + } } return CB_MEM_NONE; |