#include <linux/stringify.h>
#include <linux/delay.h>
#include <linux/initrd.h>
+#include <linux/bitops.h>
#include <asm/prom.h>
#include <asm/rtas.h>
#include <asm/abs_addr.h>
#include <asm/system.h>
#include <asm/mmu.h>
#include <asm/pgtable.h>
-#include <asm/bitops.h>
-#include <asm/naca.h>
#include <asm/pci.h>
#include <asm/iommu.h>
#include <asm/bootinfo.h>
#include <asm/btext.h>
#include <asm/sections.h>
#include <asm/machdep.h>
-#include "open_pic.h"
#ifdef CONFIG_LOGO_LINUX_CLUT224
#include <linux/linux_logo.h>
extern unsigned long klimit;
-//int global_width = 640, global_height = 480, global_depth = 8, global_pitch;
-//unsigned global_address;
/* prom structure */
static struct prom_t __initdata prom;
if ( RELOC(of_platform) == PLATFORM_PSERIES_LPAR )
RELOC(alloc_top) = RELOC(rmo_top);
else
- RELOC(alloc_top) = min(0x40000000ul, RELOC(ram_top));
+ RELOC(alloc_top) = RELOC(rmo_top) = min(0x40000000ul, RELOC(ram_top));
RELOC(alloc_bottom) = PAGE_ALIGN(RELOC(klimit) - offset + 0x4000);
RELOC(alloc_top_high) = RELOC(ram_top);
{
unsigned long offset = reloc_offset();
struct prom_t *_prom = PTRRELOC(&prom);
- phandle prom_rtas;
- u64 base, entry = 0;
- u32 size;
+ phandle prom_rtas, rtas_node;
+ u32 base, entry = 0;
+ u32 size = 0;
prom_debug("prom_instantiate_rtas: start...\n");
prom_rtas = call_prom("finddevice", 1, 1, ADDR("/rtas"));
- if (prom_rtas != (phandle) -1) {
- prom_getprop(prom_rtas, "rtas-size", &size, sizeof(size));
- if (size != 0) {
- base = alloc_down(size, PAGE_SIZE, 0);
- if (base == 0) {
- prom_printf("RTAS allocation failed !\n");
- return;
- }
- prom_printf("instantiating rtas at 0x%x", base);
-
- prom_rtas = call_prom("open", 1, 1, ADDR("/rtas"));
- prom_printf("...");
+ prom_debug("prom_rtas: %x\n", prom_rtas);
+ if (prom_rtas == (phandle) -1)
+ return;
- if (call_prom("call-method", 3, 2,
- ADDR("instantiate-rtas"),
- prom_rtas, base) != PROM_ERROR) {
- entry = (long)_prom->args.rets[1];
- }
- if (entry == 0) {
- prom_printf(" failed\n");
- return;
- }
- prom_printf(" done\n");
+ prom_getprop(prom_rtas, "rtas-size", &size, sizeof(size));
+ if (size == 0)
+ return;
- reserve_mem(base, size);
- }
+ base = alloc_down(size, PAGE_SIZE, 0);
+ if (base == 0) {
+ prom_printf("RTAS allocation failed !\n");
+ return;
+ }
+ prom_printf("instantiating rtas at 0x%x", 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-size", &size, sizeof(size));
+ rtas_node = call_prom("open", 1, 1, ADDR("/rtas"));
+ prom_printf("...");
- prom_debug("rtas base = 0x%x\n", base);
- prom_debug("rtas entry = 0x%x\n", entry);
- prom_debug("rtas size = 0x%x\n", (long)size);
+ if (call_prom("call-method", 3, 2,
+ ADDR("instantiate-rtas"),
+ rtas_node, base) != PROM_ERROR) {
+ entry = (long)_prom->args.rets[1];
+ }
+ if (entry == 0) {
+ prom_printf(" failed\n");
+ return;
}
+ prom_printf(" done\n");
+
+ reserve_mem(base, size);
+
+ prom_setprop(prom_rtas, "linux,rtas-base", &base, sizeof(base));
+ prom_setprop(prom_rtas, "linux,rtas-entry", &entry, sizeof(entry));
+
+ prom_debug("rtas base = 0x%x\n", base);
+ prom_debug("rtas entry = 0x%x\n", entry);
+ prom_debug("rtas size = 0x%x\n", (long)size);
+
prom_debug("prom_instantiate_rtas: end...\n");
}
unsigned long offset = reloc_offset();
char compatible[64], type[64], model[64];
char *path = RELOC(prom_scratch);
- u64 base, vbase, align;
+ u64 base, align;
u32 minalign, minsize;
u64 tce_entry, *tce_entryp;
u64 local_alloc_top, local_alloc_bottom;
if (base < local_alloc_bottom)
local_alloc_bottom = base;
- vbase = (unsigned long)abs_to_virt(base);
-
/* Save away the TCE table attributes for later use. */
- prom_setprop(node, "linux,tce-base", &vbase, sizeof(vbase));
+ prom_setprop(node, "linux,tce-base", &base, sizeof(base));
prom_setprop(node, "linux,tce-size", &minsize, sizeof(minsize));
- prom_setprop(node, "linux,has-tce-table", NULL, 0);
/* It seems OF doesn't null-terminate the path :-( */
memset(path, 0, sizeof(path));
prom_debug("TCE table: %s\n", path);
prom_debug("\tnode = 0x%x\n", node);
- prom_debug("\tbase = 0x%x\n", vbase);
+ prom_debug("\tbase = 0x%x\n", base);
prom_debug("\tsize = 0x%x\n", minsize);
/* Initialize the table to have a one-to-one mapping
continue;
/* Skip non-configured cpus. */
- prom_getprop(node, "status", type, sizeof(type));
- if (strcmp(type, RELOC("okay")) != 0)
- continue;
+ if (prom_getprop(node, "status", type, sizeof(type)) > 0)
+ if (strcmp(type, RELOC("okay")) != 0)
+ continue;
reg = -1;
prom_getprop(node, "reg", ®, sizeof(reg));
/* Primary Thread of non-boot cpu */
prom_printf("%x : starting cpu hw idx %x... ", cpuid, reg);
call_prom("start-cpu", 3, 0, node,
- secondary_hold, cpuid);
+ secondary_hold, reg);
for ( i = 0 ; (i < 100000000) &&
- (*acknowledge == ((unsigned long)-1)); i++ ) ;
+ (*acknowledge == ((unsigned long)-1)); i++ )
+ mb();
- if (*acknowledge == cpuid) {
+ if (*acknowledge == reg) {
prom_printf("done\n");
/* We have to get every CPU out of OF,
* even if we never start it. */
}
}
+static void __init prom_close_stdin(void)
+{
+ unsigned long offset = reloc_offset();
+ struct prom_t *_prom = PTRRELOC(&prom);
+ ihandle val;
+
+ if (prom_getprop(_prom->chosen, "stdin", &val, sizeof(val)) > 0)
+ call_prom("close", 1, 0, val);
+}
+
static int __init prom_find_machine_type(void)
{
unsigned long offset = reloc_offset();
if (strstr(p, RELOC("Power Macintosh")) ||
strstr(p, RELOC("MacRISC4")))
return PLATFORM_POWERMAC;
+ if (strstr(p, RELOC("Momentum,Maple")))
+ return PLATFORM_MAPLE;
i += sl + 1;
}
}
* So we check whether we will need to open the display,
* 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();
struct prom_t *_prom = PTRRELOC(&prom);
prom_debug("klimit=0x%x\n", RELOC(klimit));
prom_debug("offset=0x%x\n", offset);
- /*
- * Reserve kernel in reserve map
- */
- reserve_mem(0, __pa(RELOC(klimit)));
-
/*
* Check for an initrd
*/
prom_printf("copying OF device tree ...\n");
flatten_device_tree();
+ /* in case stdin is USB and still active on IBM machines... */
+ prom_close_stdin();
+
/*
* Call OF "quiesce" method to shut down pending DMA's from
* devices etc...