]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
Update in coreboot_get_memory_type API to include size as well
authorSaurabh Gorecha <sgorecha@codeaurora.org>
Wed, 14 Oct 2020 18:35:36 +0000 (00:05 +0530)
committerSaurabh Gorecha <sgorecha@codeaurora.org>
Thu, 15 Oct 2020 20:53:35 +0000 (02:23 +0530)
Change-Id: I3f563cffd58b0591b433c85c0ff6b71e486eb2c8
Signed-off-by: Saurabh Gorecha <sgorecha@codeaurora.org>
include/lib/coreboot.h
lib/coreboot/coreboot_table.c

index dda3173a26c49b4ceded5e261a0015ada791d47c..0aa65791dd2150c958b386778b3fd3aa590f32f3 100644 (file)
@@ -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 */
index c4cd1d752e681947f708725ee73f30deb0fa5586..fb31ef1e078db7710fcdb7b3eeaadf210ab7bd1c 100644 (file)
@@ -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;