Commit 59e8d5c9 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ppc64: prom.c fix for CONFIG_BLK_DEV_INITRD=n

From: Rusty Russell <rusty@rustcorp.com.au>

Doesn't compile with CONFIG_BLK_DEV_INITRD=n.  Be more careful with the
conditionals.

Spotted by Dave Boutcher...
parent e51a23c6
...@@ -1548,6 +1548,7 @@ static void __init *__make_room(unsigned long *mem_start, unsigned long *mem_end ...@@ -1548,6 +1548,7 @@ static void __init *__make_room(unsigned long *mem_start, unsigned long *mem_end
*mem_start = ALIGN(*mem_start, align); *mem_start = ALIGN(*mem_start, align);
if (*mem_start + needed > *mem_end) { if (*mem_start + needed > *mem_end) {
#ifdef CONFIG_BLK_DEV_INITRD
/* FIXME: Apple OF doesn't map unclaimed mem. If this /* FIXME: Apple OF doesn't map unclaimed mem. If this
* ever happened on G5, we'd need to fix. */ * ever happened on G5, we'd need to fix. */
unsigned long initrd_len; unsigned long initrd_len;
...@@ -1563,6 +1564,9 @@ static void __init *__make_room(unsigned long *mem_start, unsigned long *mem_end ...@@ -1563,6 +1564,9 @@ static void __init *__make_room(unsigned long *mem_start, unsigned long *mem_end
initrd_len); initrd_len);
RELOC(initrd_start) = *mem_end; RELOC(initrd_start) = *mem_end;
RELOC(initrd_end) = RELOC(initrd_start) + initrd_len; RELOC(initrd_end) = RELOC(initrd_start) + initrd_len;
#else
prom_panic(RELOC("No memory for copy_device_tree"));
#endif
} }
ret = (void *)*mem_start; ret = (void *)*mem_start;
...@@ -1699,11 +1703,14 @@ copy_device_tree(unsigned long mem_start) ...@@ -1699,11 +1703,14 @@ copy_device_tree(unsigned long mem_start)
phandle root; phandle root;
struct device_node **allnextp; struct device_node **allnextp;
unsigned long offset = reloc_offset(); unsigned long offset = reloc_offset();
unsigned long mem_end = RELOC(initrd_start); unsigned long mem_end;
/* We pass mem_end-mem_start to OF: keep it well under 32-bit */ /* We pass mem_end-mem_start to OF: keep it well under 32-bit */
if (!mem_end)
mem_end = mem_start + 1024*1024*1024; mem_end = mem_start + 1024*1024*1024;
#ifdef CONFIG_BLK_DEV_INITRD
if (RELOC(initrd_start) && RELOC(initrd_start) > mem_start)
mem_end = RELOC(initrd_start);
#endif /* CONFIG_BLK_DEV_INITRD */
root = call_prom(RELOC("peer"), 1, 1, (phandle)0); root = call_prom(RELOC("peer"), 1, 1, (phandle)0);
if (root == (phandle)0) { if (root == (phandle)0) {
...@@ -1964,12 +1971,14 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp, ...@@ -1964,12 +1971,14 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp,
prom_print(RELOC("after basic inits, mem=0x")); prom_print(RELOC("after basic inits, mem=0x"));
prom_print_hex(mem); prom_print_hex(mem);
prom_print_nl(); prom_print_nl();
#ifdef CONFIG_BLK_DEV_INITRD
prom_print(RELOC("initrd_start=0x")); prom_print(RELOC("initrd_start=0x"));
prom_print_hex(RELOC(initrd_start)); prom_print_hex(RELOC(initrd_start));
prom_print_nl(); prom_print_nl();
prom_print(RELOC("initrd_end=0x")); prom_print(RELOC("initrd_end=0x"));
prom_print_hex(RELOC(initrd_end)); prom_print_hex(RELOC(initrd_end));
prom_print_nl(); prom_print_nl();
#endif /* CONFIG_BLK_DEV_INITRD */
prom_print(RELOC("copying OF device tree...\n")); prom_print(RELOC("copying OF device tree...\n"));
#endif /* DEBUG_PROM */ #endif /* DEBUG_PROM */
mem = copy_device_tree(mem); mem = copy_device_tree(mem);
......
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