]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
kern/ieee1275/init/ppc64: Return allocated address using context
authorStefan Berger <stefanb@linux.ibm.com>
Thu, 30 Nov 2023 14:17:17 +0000 (09:17 -0500)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 5 Dec 2023 13:22:54 +0000 (14:22 +0100)
Return the allocated address of the memory block in the request structure
if a memory allocation was actually done. Leave the address untouched
otherwise. This enables a caller who wants to use the allocated memory
directly, rather than adding the memory to the heap, to see where memory
was allocated. None of the current callers need this but the converted
ieee1275 loader will make use of it.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Cc: Hari Bathini <hbathini@linux.ibm.com>
Cc: Pavithra Prakash <pavrampu@in.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Carolyn Scherrer <cpscherr@us.ibm.com>
Cc: Mahesh Salgaonkar <mahesh@linux.ibm.com>
Cc: Sourabh Jain <sourabhjain@linux.ibm.com>
grub-core/kern/ieee1275/init.c
include/grub/ieee1275/alloc.h

index 8e69da297617da7205f4b2dba95af6aef35bf122..4b9face59a95afee1c56407ad82b625d5b6d6f7f 100644 (file)
@@ -518,6 +518,8 @@ 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;
     }
 
   *(grub_uint32_t *) data = rcr->total;
index 523f51fc6b76023e6bfef1d530766b6ea47ef18f..f3065ff31fb3c6857634397966f2767c5d44ee3f 100644 (file)
@@ -29,6 +29,7 @@ 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 add memory to the heap using grub_mm_init_region() */
+  grub_uint64_t addr;     /* result address */
 };
 
 #endif /* GRUB_IEEE1275_ALLOC_HEADER */