Commit 9b9407e8 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Linus Torvalds

[PATCH] ppc64: more issues with mem_reserve

As Milton noticed, Anton actually broke the logic if the memory isn't
aligned in the first place.  Sorry about this mess for such a little
piece of code.  This _really_ fixes is it all
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent bcc167be
......@@ -587,19 +587,20 @@ static unsigned long __init prom_next_cell(int s, cell_t **cellp)
static void reserve_mem(unsigned long base, unsigned long size)
{
unsigned long offset = reloc_offset();
unsigned long top = base + size;
unsigned long cnt = RELOC(mem_reserve_cnt);
if (!size)
if (size == 0)
return;
base = _ALIGN_DOWN(base, PAGE_SIZE);
size = _ALIGN_UP(size, PAGE_SIZE);
/*
* We need to always keep one empty entry so that we
/* We need to always keep one empty entry so that we
* have our terminator with "size" set to 0 since we are
* dumb and just copy this entire array to the boot params
*/
base = _ALIGN_DOWN(base, PAGE_SIZE);
top = _ALIGN_UP(top, PAGE_SIZE);
size = top - base;
if (cnt >= (MEM_RESERVE_MAP_SIZE - 1))
prom_panic("Memory reserve map exhausted !\n");
RELOC(mem_reserve_map)[cnt].base = base;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment