X-Git-Url: http://git.ozlabs.org/?p=yaboot.git;a=blobdiff_plain;f=second%2Fprom.c;h=4ad727761b47a58f2a6b47869df912dd3de04df4;hp=74bbac6b2855f080df4e682ebdf9f3bbfb733c68;hb=66ffb9d32d2acb3613594ef492d341b5bacf02e5;hpb=78cfabe0fac2682681c604bfe9b7266f173b9ea2 diff --git a/second/prom.c b/second/prom.c index 74bbac6..4ad7277 100644 --- a/second/prom.c +++ b/second/prom.c @@ -33,6 +33,7 @@ #include "asm/processor.h" #include "errors.h" #include "debug.h" +#include "string.h" #define READ_BLOCKS_USE_READ 1 @@ -567,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) {