Commit e0caf8f5 authored by Saurabh Gorecha's avatar Saurabh Gorecha
Browse files

Update in coreboot_get_memory_type API to include size as well



Change-Id: I3f563cffd58b0591b433c85c0ff6b71e486eb2c8
Signed-off-by: default avatarSaurabh Gorecha <sgorecha@codeaurora.org>
parent 7ad39818
...@@ -39,7 +39,7 @@ typedef enum { ...@@ -39,7 +39,7 @@ typedef enum {
CB_MEM_TABLE = 16, CB_MEM_TABLE = 16,
} coreboot_memory_t; } 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); void coreboot_table_setup(void *base);
#endif /* COREBOOT_H */ #endif /* COREBOOT_H */
...@@ -89,7 +89,7 @@ static void setup_cbmem_console(uintptr_t baseaddr) ...@@ -89,7 +89,7 @@ static void setup_cbmem_console(uintptr_t baseaddr)
CONSOLE_FLAG_CRASH); 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; int i;
...@@ -98,10 +98,12 @@ coreboot_memory_t coreboot_get_memory_type(uintptr_t address) ...@@ -98,10 +98,12 @@ coreboot_memory_t coreboot_get_memory_type(uintptr_t address)
if (range->type == CB_MEM_NONE) if (range->type == CB_MEM_NONE)
break; /* end of table reached */ break; /* end of table reached */
if (address >= range->start && if ((start >= range->start) &&
address - range->start < range->size) (start - range->start < range->size) &&
(size <= range->size - (start - range->start))) {
return range->type; return range->type;
} }
}
return CB_MEM_NONE; return CB_MEM_NONE;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment