Change SPARC32 memory allocator to allocate memory starting from just below the OpenBIOS image downwards.

The existing code appeared to be allocating memory from the wrong property (map rather than avail) and so rather than allocating 
memory starting from just below the OpenBIOS image downwards, it was simply reducing the reported size of the OpenBIOS image.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk> 


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@923 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Mark Cave-Ayland
2010-10-28 20:53:58 +00:00
committed by Mark Cave-Ayland
parent 380cd335cc
commit 36d943f6d3

View File

@@ -451,9 +451,9 @@ char *obp_dumb_memalloc(char *va, unsigned int size)
size = (size + 7) & ~7;
// XXX should use normal memory alloc
totmap[0].num_bytes -= size;
totavail[0].num_bytes -= size;
DPRINTF("obp_dumb_memalloc va 0x%p size %x at 0x%x\n", va, size,
totmap[0].num_bytes);
totavail[0].num_bytes);
// If va is null, the allocator is supposed to pick a "suitable" address.
// (See OpenSolaric prom_alloc.c) There's not any real guidance as
@@ -467,7 +467,7 @@ char *obp_dumb_memalloc(char *va, unsigned int size)
DPRINTF("obp_dumb_memalloc req null -> 0x%p\n", va);
}
map_pages((unsigned long)va, totmap[0].num_bytes, 0, size);
map_pages((unsigned long)va, totavail[0].num_bytes, 0, size);
return va;
}