Patchwork [03/14] Use prom_claim_chunk to allocate malloc area

login
register
mail settings
Submitter Anton Blanchard
Date July 9, 2010, 5:03 a.m.
Message ID <20100709050341.629845195@samba.org>
Download mbox | patch
Permalink /patch/58326/
State Changes Requested
Headers show

Comments

Anton Blanchard - July 9, 2010, 5:03 a.m.
prom_claim_chunk does the same thing as this loop, so we can
use it instead.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Patch

Index: yaboot/second/yaboot.c
===================================================================
--- yaboot.orig/second/yaboot.c	2010-07-08 14:05:55.000000000 +1000
+++ yaboot/second/yaboot.c	2010-07-08 14:12:48.000000000 +1000
@@ -177,7 +177,6 @@  yaboot_start (unsigned long r3, unsigned
 {
      int result;
      void* malloc_base = NULL;
-     unsigned long addr;
      prom_handle root;
 
      /* OF seems to do it, but I'm not very confident */
@@ -194,10 +193,7 @@  yaboot_start (unsigned long r3, unsigned
      prom_claim_chunk(0, 128 * 1024 * 1024, 0);
 
      /* Allocate some memory for malloc'ator */
-     for (addr = MALLOCADDR; addr <= MALLOCADDR * 16 ;addr+=0x100000) {
-	  malloc_base = prom_claim((void *)addr, MALLOCSIZE, 0);
-	  if (malloc_base != (void *)-1) break;
-     }
+     malloc_base = prom_claim_chunk((void *)MALLOCADDR, MALLOCSIZE, 0);
      if (malloc_base == (void *)-1) {
 	  prom_printf("Can't claim malloc buffer (%d bytes at 0x%08x)\n",
 		      MALLOCSIZE, MALLOCADDR);