X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=arch%2Fpowerpc%2Fboot%2Fof.c;h=d16ee3e3f868eb2592822d63ecff77e07faeccc9;hb=b91cba52e9b7b3f1c0037908a192d93a869ca9e5;hp=fd99f789a37bbdd32a1507cca72191ef5e1f37af;hpb=6585b572402e5ec7936422123b44b65fef7a5ea6;p=linux-2.6 diff --git a/arch/powerpc/boot/of.c b/arch/powerpc/boot/of.c index fd99f789a3..d16ee3e3f8 100644 --- a/arch/powerpc/boot/of.c +++ b/arch/powerpc/boot/of.c @@ -173,15 +173,12 @@ static void *claim(unsigned long virt, unsigned long size, unsigned long align) return (void *) virt; } -static void *of_try_claim(u32 size) +static void *of_try_claim(unsigned long size) { unsigned long addr = 0; - static u8 first_time = 1; - if (first_time) { + if (claim_base == 0) claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB); - first_time = 0; - } for(; claim_base < RAM_END; claim_base += ONE_MB) { #ifdef DEBUG @@ -211,6 +208,16 @@ static void of_image_hdr(const void *hdr) } } +static void *of_vmlinux_alloc(unsigned long size) +{ + void *p = malloc(size); + + if (!p) + fatal("Can't allocate memory for kernel image!\n\r"); + + return p; +} + static void of_exit(void) { call_prom("exit", 0, 0); @@ -259,25 +266,24 @@ static void of_console_write(char *buf, int len) call_prom("write", 3, 1, of_stdout_handle, buf, len); } -int platform_init(void *promptr) +void platform_init(unsigned long a1, unsigned long a2, void *promptr) { - platform_ops.fixups = NULL; platform_ops.image_hdr = of_image_hdr; platform_ops.malloc = of_try_claim; - platform_ops.free = NULL; platform_ops.exit = of_exit; + platform_ops.vmlinux_alloc = of_vmlinux_alloc; dt_ops.finddevice = of_finddevice; dt_ops.getprop = of_getprop; dt_ops.setprop = of_setprop; - dt_ops.translate_addr = NULL; console_ops.open = of_console_open; console_ops.write = of_console_write; - console_ops.edit_cmdline = NULL; - console_ops.close = NULL; - console_ops.data = NULL; prom = (int (*)(void *))promptr; - return 0; + loader_info.promptr = promptr; + if (a1 && a2 && a2 != 0xdeadbeef) { + loader_info.initrd_addr = a1; + loader_info.initrd_size = a2; + } }