]> git.ozlabs.org Git - yaboot.git/blobdiff - second/prom.c
The patch from Scott Moser moves the "search-for-prom_claim'able" routine that
[yaboot.git] / second / prom.c
index e9c5843e1efec04b25baa7185e16a9025b8e0905..4ad727761b47a58f2a6b47869df912dd3de04df4 100644 (file)
@@ -568,6 +568,25 @@ prom_sleep (int seconds)
      while (prom_getms() <= end);
 }
 
+/* if address given is claimed look for other addresses to get the needed
+ * space before giving up
+ */
+void *
+prom_claim_chunk(void *virt, unsigned int size, unsigned int align)
+{
+     void *found, *addr;
+     for(addr=virt; addr <= (void*)PROM_CLAIM_MAX_ADDR;
+         addr+=(0x100000/sizeof(addr))) {
+          found = prom_claim(addr, size, 0);
+          if (found != (void *)-1) {
+               DEBUG_F("claimed %i at 0x%x (0x%x)\n",size,(int)found,(int)virt);
+               return(found);
+          }
+     }
+     prom_printf("Claim error, can't allocate %x at 0x%x\n",size,(int)virt);
+     return((void*)-1);
+}
+
 void *
 prom_claim (void *virt, unsigned int size, unsigned int align)
 {