Commit b0fce583 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Linus Torvalds

[PATCH] ppc64: Some cleanups of prom_init.c

This patch does a few cleanups of arch/ppc64/kernel/prom_init.c, making
the RTAS instanciation code more readable & more robust, fixing a bug
in the code bringing in additional CPUs (would work with IBM firmware,
but not with another firmware of an upcoming platform), plus remove some
old commented out cruft left-over from the big cleanup.
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 967eee40
...@@ -159,8 +159,6 @@ extern void copy_and_flush(unsigned long dest, unsigned long src, ...@@ -159,8 +159,6 @@ extern void copy_and_flush(unsigned long dest, unsigned long src,
extern unsigned long klimit; extern unsigned long klimit;
//int global_width = 640, global_height = 480, global_depth = 8, global_pitch;
//unsigned global_address;
/* prom structure */ /* prom structure */
static struct prom_t __initdata prom; static struct prom_t __initdata prom;
...@@ -705,14 +703,19 @@ static void __init prom_instantiate_rtas(void) ...@@ -705,14 +703,19 @@ static void __init prom_instantiate_rtas(void)
struct prom_t *_prom = PTRRELOC(&prom); struct prom_t *_prom = PTRRELOC(&prom);
phandle prom_rtas; phandle prom_rtas;
u64 base, entry = 0; u64 base, entry = 0;
u32 size; u32 size = 0;
prom_debug("prom_instantiate_rtas: start...\n"); prom_debug("prom_instantiate_rtas: start...\n");
prom_rtas = call_prom("finddevice", 1, 1, ADDR("/rtas")); prom_rtas = call_prom("finddevice", 1, 1, ADDR("/rtas"));
if (prom_rtas != (phandle) -1) { prom_debug("prom_rtas: %x\n", prom_rtas);
if (prom_rtas == (phandle) -1)
return;
prom_getprop(prom_rtas, "rtas-size", &size, sizeof(size)); prom_getprop(prom_rtas, "rtas-size", &size, sizeof(size));
if (size != 0) { if (size == 0)
return;
base = alloc_down(size, PAGE_SIZE, 0); base = alloc_down(size, PAGE_SIZE, 0);
if (base == 0) { if (base == 0) {
prom_printf("RTAS allocation failed !\n"); prom_printf("RTAS allocation failed !\n");
...@@ -735,7 +738,6 @@ static void __init prom_instantiate_rtas(void) ...@@ -735,7 +738,6 @@ static void __init prom_instantiate_rtas(void)
prom_printf(" done\n"); prom_printf(" done\n");
reserve_mem(base, size); reserve_mem(base, size);
}
prom_setprop(_prom->chosen, "linux,rtas-base", &base, sizeof(base)); prom_setprop(_prom->chosen, "linux,rtas-base", &base, sizeof(base));
prom_setprop(_prom->chosen, "linux,rtas-entry", &entry, sizeof(entry)); prom_setprop(_prom->chosen, "linux,rtas-entry", &entry, sizeof(entry));
...@@ -744,7 +746,7 @@ static void __init prom_instantiate_rtas(void) ...@@ -744,7 +746,7 @@ static void __init prom_instantiate_rtas(void)
prom_debug("rtas base = 0x%x\n", base); prom_debug("rtas base = 0x%x\n", base);
prom_debug("rtas entry = 0x%x\n", entry); prom_debug("rtas entry = 0x%x\n", entry);
prom_debug("rtas size = 0x%x\n", (long)size); prom_debug("rtas size = 0x%x\n", (long)size);
}
prom_debug("prom_instantiate_rtas: end...\n"); prom_debug("prom_instantiate_rtas: end...\n");
} }
...@@ -951,7 +953,7 @@ static void __init prom_hold_cpus(void) ...@@ -951,7 +953,7 @@ static void __init prom_hold_cpus(void)
continue; continue;
/* Skip non-configured cpus. */ /* Skip non-configured cpus. */
prom_getprop(node, "status", type, sizeof(type)); if (prom_getprop(node, "status", type, sizeof(type)) > 0)
if (strcmp(type, RELOC("okay")) != 0) if (strcmp(type, RELOC("okay")) != 0)
continue; continue;
...@@ -993,7 +995,8 @@ static void __init prom_hold_cpus(void) ...@@ -993,7 +995,8 @@ static void __init prom_hold_cpus(void)
secondary_hold, cpuid); secondary_hold, cpuid);
for ( i = 0 ; (i < 100000000) && for ( i = 0 ; (i < 100000000) &&
(*acknowledge == ((unsigned long)-1)); i++ ) ; (*acknowledge == ((unsigned long)-1)); i++ )
mb();
if (*acknowledge == cpuid) { if (*acknowledge == cpuid) {
prom_printf("done\n"); prom_printf("done\n");
...@@ -1160,7 +1163,7 @@ static int __init prom_set_color(ihandle ih, int i, int r, int g, int b) ...@@ -1160,7 +1163,7 @@ static int __init prom_set_color(ihandle ih, int i, int r, int g, int b)
* So we check whether we will need to open the display, * So we check whether we will need to open the display,
* and if so, open it now. * and if so, open it now.
*/ */
static unsigned long __init prom_check_displays(void) static void __init prom_check_displays(void)
{ {
unsigned long offset = reloc_offset(); unsigned long offset = reloc_offset();
struct prom_t *_prom = PTRRELOC(&prom); struct prom_t *_prom = PTRRELOC(&prom);
......
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