Return the allocated address and the length of the memory block in the
request structure if a memory allocation was actually done. Leave the
address untouched otherwise.

Signed-off-by: Stefan Berger <[email protected]>
Cc: Hari Bathini <[email protected]>
Cc: Pavithra Prakash <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Carolyn Scherrer <[email protected]>
Cc: Mahesh Salgaonkar <[email protected]>
Cc: Sourabh Jain <[email protected]>
---
 grub-core/kern/ieee1275/init.c        | 3 +++
 include/grub/powerpc/ieee1275/alloc.h | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
index 217f25fae..e09db4192 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -518,6 +518,9 @@ regions_claim (grub_uint64_t addr, grub_uint64_t len, 
grub_memory_type_t type,
       if (rcr->init_region)
           grub_mm_init_region ((void *) (grub_addr_t) addr, len);
       rcr->total -= len;
+
+      rcr->addr = addr;
+      rcr->len = len;
     }
 
   *(grub_uint32_t *) data = rcr->total;
diff --git a/include/grub/powerpc/ieee1275/alloc.h 
b/include/grub/powerpc/ieee1275/alloc.h
index 15a8fdd6d..136e1df0b 100644
--- a/include/grub/powerpc/ieee1275/alloc.h
+++ b/include/grub/powerpc/ieee1275/alloc.h
@@ -9,6 +9,8 @@ struct regions_claim_request {
   unsigned int flags;     /* GRUB_MM_ADD_REGION_(NONE|CONSECUTIVE) */
   grub_uint32_t total;    /* number of requested bytes */
   bool init_region;       /* whether to init the region */
+  grub_uint64_t addr;     /* result address */
+  grub_uint64_t len;      /* number of bytes allocated */
 };
 
 #endif /* GRUB_POWERPC_IEEE1275_ALLOC_HEADER */
-- 
2.25.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to