# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Date 1168557803 21600
# Node ID 9b15f4125a34abe83964d6523ac805e93ce91fce
# Parent  c934371553ac69d6a832a9bac92b7f4094e66e11
[POWERPC][XEN] Parse multiboot2 structures as passed to us from a bootloader.
- Remove code that manufactured a multiboot1 structure.
- Walk the multiboot2 tags and fill out globals with what we find.

Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>

diff -r c934371553ac -r 9b15f4125a34 xen/arch/powerpc/Makefile
--- a/xen/arch/powerpc/Makefile Thu Jan 11 16:57:05 2007 -0600
+++ b/xen/arch/powerpc/Makefile Thu Jan 11 17:23:23 2007 -0600
@@ -27,6 +27,7 @@ obj-y += mm.o
 obj-y += mm.o
 obj-y += mpic.o
 obj-y += mpic_init.o
+obj-y += multiboot2.o
 obj-y += numa.o
 obj-y += of-devtree.o
 obj-y += of-devwalk.o
diff -r c934371553ac -r 9b15f4125a34 xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.c        Thu Jan 11 16:57:05 2007 -0600
+++ b/xen/arch/powerpc/boot_of.c        Thu Jan 11 17:23:23 2007 -0600
@@ -22,7 +22,6 @@
 #include <xen/config.h>
 #include <xen/init.h>
 #include <xen/lib.h>
-#include <xen/multiboot.h>
 #include <xen/version.h>
 #include <xen/spinlock.h>
 #include <xen/serial.h>
@@ -30,6 +29,7 @@
 #include <xen/sched.h>
 #include <asm/page.h>
 #include <asm/io.h>
+#include <asm/boot.h>
 #include "exceptions.h"
 #include "of-devtree.h"
 #include "oftree.h"
@@ -644,8 +644,11 @@ static ulong boot_of_mem_init(void)
     return 0;
 }
 
-static void boot_of_bootargs(multiboot_info_t *mbi)
-{
+char *boot_of_bootargs(char **dom0_cmdline)
+{
+    static const char *sepr[] = {" -- ", " || "};
+    char *p;
+    int sepr_index;
     int rc;
 
     if (builtin_cmdline[0] == '\0') {
@@ -655,10 +658,22 @@ static void boot_of_bootargs(multiboot_i
             of_panic("bootargs[] not big enough for /chosen/bootargs\n");
     }
 
-    mbi->flags |= MBI_CMDLINE;
-    mbi->cmdline = (ulong)builtin_cmdline;
-
     of_printf("bootargs = %s\n", builtin_cmdline);
+
+    /* look for delimiter: "--" or "||" */
+    for (sepr_index = 0; sepr_index < ARRAY_SIZE(sepr); sepr_index++){
+        p = strstr(builtin_cmdline, sepr[sepr_index]);
+        if (p != NULL) {
+            /* Xen proper should never know about the dom0 args.  */
+            *p = '\0';
+            p += strlen(sepr[sepr_index]);
+            *dom0_cmdline = p;
+            of_printf("%s: dom0 cmdline: %s\n", __func__, *dom0_cmdline);
+            break;
+        }
+    }
+
+    return builtin_cmdline;
 }
 
 static int save_props(void *m, ofdn_t n, int pkg)
@@ -929,8 +944,8 @@ static void __init boot_of_fix_maple(voi
         }
     }
 }
-    
-static int __init boot_of_serial(void *oft)
+
+void __init boot_of_serial(void *oft)
 {
     int n;
     int p;
@@ -1010,11 +1025,9 @@ static int __init boot_of_serial(void *o
                   __func__, ns16550.irq);
         ns16550.irq = 0;
     }
-
-    return 1;
-}
-
-static int __init boot_of_rtas(module_t *mod, multiboot_info_t *mbi)
+}
+
+static int __init boot_of_rtas(void)
 {
     int rtas_node;
     int rtas_instance;
@@ -1061,12 +1074,10 @@ static int __init boot_of_rtas(module_t 
     rtas_end = mem + size;
     rtas_msr = of_msr;
 
-    mod->mod_start = rtas_base;
-    mod->mod_end = rtas_end;
     return 1;
 }
 
-static void * __init boot_of_devtree(module_t *mod, multiboot_info_t *mbi)
+void __init *boot_of_devtree(void)
 {
     void *oft;
     ulong oft_sz = 48 * PAGE_SIZE;
@@ -1092,103 +1103,9 @@ static void * __init boot_of_devtree(mod
 
     ofd_walk(oft, __func__, OFD_ROOT, /* add_hype_props */ NULL, 2);
 
-    mod->mod_start = (ulong)oft;
-    mod->mod_end = mod->mod_start + oft_sz;
-    of_printf("%s: devtree mod @ 0x%016x - 0x%016x\n", __func__,
-              mod->mod_start, mod->mod_end);
-
-    return oft;
-}
-
-static void * __init boot_of_module(ulong r3, ulong r4, multiboot_info_t *mbi)
-{
-    static module_t mods[4];
-    ulong mod0_start;
-    ulong mod0_size;
-    static const char * sepr[] = {" -- ", " || "};
-    int sepr_index;
-    extern char dom0_start[] __attribute__ ((weak));
-    extern char dom0_size[] __attribute__ ((weak));
-    const char *p = NULL;
-    int mod;
-    void *oft;
-
-    if ((r3 > 0) && (r4 > 0)) {
-        /* was it handed to us in registers ? */
-        mod0_start = r3;
-        mod0_size = r4;
-            of_printf("%s: Dom0 was loaded and found using r3/r4:"
-                      "0x%lx[size 0x%lx]\n",
-                      __func__, mod0_start, mod0_size);
-    } else {
-        /* see if it is in the boot params */
-        p = strstr((char *)((ulong)mbi->cmdline), "dom0_start=");
-        if ( p != NULL) {
-            p += 11;
-            mod0_start = simple_strtoul(p, NULL, 0);
-
-            p = strstr((char *)((ulong)mbi->cmdline), "dom0_size=");
-            p += 10;
-            mod0_size = simple_strtoul(p, NULL, 0);
-            of_printf("%s: Dom0 was loaded and found using cmdline:"
-                      "0x%lx[size 0x%lx]\n",
-                      __func__, mod0_start, mod0_size);
-        } else if ( ((ulong)dom0_start != 0) && ((ulong)dom0_size != 0) ) {
-            /* was it linked in ? */
-        
-            mod0_start = (ulong)dom0_start;
-            mod0_size = (ulong)dom0_size;
-            of_printf("%s: Dom0 is linked in: 0x%lx[size 0x%lx]\n",
-                      __func__, mod0_start, mod0_size);
-        } else {
-            mod0_start = (ulong)_end;
-            mod0_size = 0;
-            of_printf("%s: FYI Dom0 is unknown, will be caught later\n",
-                      __func__);
-        }
-    }
-
-    if (mod0_size > 0) {
-        const char *c = (const char *)mod0_start;
-
-        of_printf("mod0: %o %c %c %c\n", c[0], c[1], c[2], c[3]);
-    }
-
-    mod = 0;
-    mods[mod].mod_start = mod0_start;
-    mods[mod].mod_end = mod0_start + mod0_size;
-
-    of_printf("%s: dom0 mod @ 0x%016x[0x%x]\n", __func__,
-              mods[mod].mod_start, mods[mod].mod_end);
-
-    /* look for delimiter: "--" or "||" */
-    for (sepr_index = 0; sepr_index < ARRAY_SIZE(sepr); sepr_index++){
-        p = strstr((char *)(ulong)mbi->cmdline, sepr[sepr_index]);
-        if (p != NULL)
-            break;
-    }
-
-    if (p != NULL) {
-        /* Xen proper should never know about the dom0 args.  */
-        *(char *)p = '\0';
-        p += strlen(sepr[sepr_index]);
-        mods[mod].string = (u32)(ulong)p;
-        of_printf("%s: dom0 mod string: %s\n", __func__, p);
-    }
-
-    ++mod;
-    if (boot_of_rtas(&mods[mod], mbi))
-        ++mod;
-
-    oft = boot_of_devtree(&mods[mod], mbi);
-    if (oft == NULL)
-        of_panic("%s: boot_of_devtree failed\n", __func__);
-
-    ++mod;
-
-    mbi->flags |= MBI_MODULES;
-    mbi->mods_count = mod;
-    mbi->mods_addr = (u32)mods;
+    oftree = (ulong)oft;
+    oftree_end = (ulong)oft + oft_sz;
+    oftree_len = oft_sz;
 
     return oft;
 }
@@ -1313,15 +1230,19 @@ static int __init boot_of_cpus(void)
     return 1;
 }
 
-multiboot_info_t __init *boot_of_init(
-        ulong r3, ulong r4, ulong vec, ulong r6, ulong r7, ulong orig_msr)
-{
-    static multiboot_info_t mbi;
-    void *oft;
+void __init boot_of_init(ulong vec, ulong orig_msr)
+{
     int r;
 
     of_vec = vec;
     of_msr = orig_msr;
+
+    if ((vec >= (ulong)_start) && (vec <= (ulong)_end)) {
+        of_panic("Hmm.. OF[0x%lx] seems to have stepped on our image "
+                "that ranges: %p .. %p.\n",
+                vec, _start, _end);
+    }
+    of_printf("%s: _start %p _end %p\n", __func__, _start, _end);
 
     bof_chosen = of_finddevice("/chosen");
     of_getprop(bof_chosen, "stdout", &of_out, sizeof (of_out));
@@ -1332,32 +1253,20 @@ multiboot_info_t __init *boot_of_init(
               xen_compile_by(), xen_compile_domain(),
               xen_compiler(), xen_compile_date());
 
-    of_printf("%s args: 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n"
-            "boot msr: 0x%lx\n",
-            __func__,
-            r3, r4, vec, r6, r7, orig_msr);
-
-    if ((vec >= (ulong)_start) && (vec <= (ulong)_end)) {
-        of_panic("Hmm.. OF[0x%lx] seems to have stepped on our image "
-                "that ranges: %p .. %p.\n",
-                vec, _start, _end);
-    }
-    of_printf("%s: _start %p _end %p 0x%lx\n", __func__, _start, _end, r6);
-
     boot_of_fix_maple();
     r = boot_of_mem_init();
     if (r == 0)
         of_panic("failure to initialize memory allocator");
-    boot_of_bootargs(&mbi);
-    oft = boot_of_module(r3, r4, &mbi);
+
+    boot_of_rtas();
     boot_of_cpus();
-    boot_of_serial(oft);
-
+}
+
+void __init boot_of_finish(void)
+{
     /* end of OF */
     of_printf("Quiescing Open Firmware ...\n");
     of_call("quiesce", 0, 0, NULL);
-
-    return &mbi;
 }
 
 /*
diff -r c934371553ac -r 9b15f4125a34 xen/arch/powerpc/exceptions.h
--- a/xen/arch/powerpc/exceptions.h     Thu Jan 11 16:57:05 2007 -0600
+++ b/xen/arch/powerpc/exceptions.h     Thu Jan 11 17:23:23 2007 -0600
@@ -13,7 +13,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
- * Copyright (C) IBM Corp. 2005
+ * Copyright IBM Corp. 2005
  *
  * Authors: Hollis Blanchard <[EMAIL PROTECTED]>
  */
@@ -33,9 +33,6 @@ extern void ack_APIC_irq(void);
 extern void ack_APIC_irq(void);
 extern int ioapic_guest_read(unsigned long physbase, unsigned int reg, u32 
*pval);
 extern int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 
val);
-extern void __start_xen_ppc(
-    ulong r3, ulong r4, ulong r5, ulong r6, ulong r7, ulong orig_msr);
-extern  multiboot_info_t *boot_of_init(ulong r3, ulong r4, ulong vec, ulong 
r6, ulong r7, ulong orig_msr);
 
 extern void do_timer(struct cpu_user_regs *regs);
 extern void do_dec(struct cpu_user_regs *regs);
diff -r c934371553ac -r 9b15f4125a34 xen/arch/powerpc/memory.c
--- a/xen/arch/powerpc/memory.c Thu Jan 11 16:57:05 2007 -0600
+++ b/xen/arch/powerpc/memory.c Thu Jan 11 17:23:23 2007 -0600
@@ -21,6 +21,7 @@
 #include <xen/sched.h>
 #include <xen/mm.h>
 #include <xen/numa.h>
+#include <asm/boot.h>
 #include "of-devtree.h"
 #include "oftree.h"
 #include "rtas.h"
@@ -116,7 +117,7 @@ static void ofd_walk_mem(void *m, walk_m
     }
 }
 
-void memory_init(module_t *mod, int mcount)
+void memory_init(void)
 {
     ulong eomem;
     ulong heap_start;
diff -r c934371553ac -r 9b15f4125a34 xen/arch/powerpc/multiboot2.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/powerpc/multiboot2.c     Thu Jan 11 17:23:23 2007 -0600
@@ -0,0 +1,67 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright IBM Corp. 2006, 2007
+ *
+ * Authors: Hollis Blanchard <[EMAIL PROTECTED]>
+ */
+
+#include <xen/config.h>
+#include <xen/lib.h>
+#include <xen/multiboot2.h>
+#include <asm/boot.h>
+#include <asm/init.h>
+
+static struct mb2_tag_module *mb2_tag_mod_find(struct mb2_tag_header *tags,
+                                                const char *type)
+{
+    struct mb2_tag_header *tag;
+
+    for_each_tag(tag, tags) {
+        if (tag->key == MB2_TAG_MODULE) {
+            struct mb2_tag_module *mod = (struct mb2_tag_module *)tag;
+            if (!strcmp(mod->type, type))
+                return mod;
+        }
+    }
+    return NULL;
+}
+
+void parse_multiboot(ulong tags_addr)
+{
+    struct mb2_tag_header *tags = (struct mb2_tag_header *)tags_addr;
+    struct mb2_tag_module *mod;
+
+    if (tags->key != MB2_TAG_START)
+        return;
+
+    /* parse the command-line options. */
+    mod = mb2_tag_mod_find(tags, "xen");
+    if (mod)
+        cmdline_parse(mod->cmdline);
+
+    mod = mb2_tag_mod_find(tags, "dom0");
+    if (mod) {
+        dom0_addr = mod->addr;
+        dom0_len = mod->size;
+        dom0_cmdline = mod->cmdline;
+    }
+
+    mod = mb2_tag_mod_find(tags, "initrd");
+    if (mod) {
+        initrd_start = mod->addr;
+        initrd_len = mod->size;
+    }
+}
diff -r c934371553ac -r 9b15f4125a34 xen/arch/powerpc/oftree.h
--- a/xen/arch/powerpc/oftree.h Thu Jan 11 16:57:05 2007 -0600
+++ b/xen/arch/powerpc/oftree.h Thu Jan 11 17:23:23 2007 -0600
@@ -13,7 +13,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
- * Copyright (C) IBM Corp. 2005
+ * Copyright IBM Corp. 2005
  *
  * Authors: Jimi Xenidis <[EMAIL PROTECTED]>
  */
@@ -34,6 +34,4 @@ extern int firmware_image_start[0];
 extern int firmware_image_start[0];
 extern int firmware_image_size[0];
 
-extern void memory_init(module_t *mod, int mcount);
-
 #endif  /* #ifndef _OFTREE_H */
diff -r c934371553ac -r 9b15f4125a34 xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Thu Jan 11 16:57:05 2007 -0600
+++ b/xen/arch/powerpc/setup.c  Thu Jan 11 17:23:23 2007 -0600
@@ -13,7 +13,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
- * Copyright (C) IBM Corp. 2005, 2006
+ * Copyright IBM Corp. 2005, 2006, 2007
  *
  * Authors: Jimi Xenidis <[EMAIL PROTECTED]>
  *          Amos Waterland <[EMAIL PROTECTED]>
@@ -25,7 +25,7 @@
 #include <xen/lib.h>
 #include <xen/cpumask.h>
 #include <xen/sched.h>
-#include <xen/multiboot.h>
+#include <xen/multiboot2.h>
 #include <xen/serial.h>
 #include <xen/softirq.h>
 #include <xen/console.h>
@@ -46,6 +46,7 @@
 #include <asm/delay.h>
 #include <asm/percpu.h>
 #include <asm/io.h>
+#include <asm/boot.h>
 #include "exceptions.h"
 #include "of-devtree.h"
 #include "oftree.h"
@@ -76,6 +77,15 @@ ulong oftree;
 ulong oftree;
 ulong oftree_len;
 ulong oftree_end;
+
+/* linked-in dom0: */
+extern char dom0_start[] __attribute__ ((weak));
+extern char dom0_size[] __attribute__ ((weak));
+
+ulong dom0_addr;
+ulong dom0_len;
+ulong initrd_start;
+ulong initrd_len;
 
 uint cpu_hard_id[NR_CPUS] __initdata;
 cpumask_t cpu_present_map;
@@ -287,21 +297,15 @@ void secondary_cpu_init(int cpuid, unsig
     panic("should never get here\n");
 }
 
-static void __init __start_xen(multiboot_info_t *mbi)
-{
-    char *cmdline;
-    module_t *mod = (module_t *)((ulong)mbi->mods_addr);
-    ulong dom0_start, dom0_len;
-    ulong initrd_start, initrd_len;
-
+static void __init __start_xen(char *xen_cmdline, char *dom0_cmdline)
+{
     memcpy(0, exception_vectors, exception_vectors_end - exception_vectors);
     synchronize_caches(0, exception_vectors_end - exception_vectors);
 
     ticks_per_usec = timebase_freq / 1000000ULL;
 
     /* Parse the command-line options. */
-    if ((mbi->flags & MBI_CMDLINE) && (mbi->cmdline != 0))
-        cmdline_parse(__va((ulong)mbi->cmdline));
+    cmdline_parse(xen_cmdline);
 
     /* we need to be able to identify this CPU early on */
     init_boot_cpu();
@@ -314,32 +318,11 @@ static void __init __start_xen(multiboot
     serial_init_preirq();
 
     init_console();
-    /* let synchronize until we really get going */
-    console_start_sync();
-
-    /* Check that we have at least one Multiboot module. */
-    if (!(mbi->flags & MBI_MODULES) || (mbi->mods_count == 0)) {
-        panic("FATAL ERROR: Require at least one Multiboot module.\n");
-    }
-
-    /* OF dev tree is the last module */
-    oftree = mod[mbi->mods_count-1].mod_start;
-    oftree_end = mod[mbi->mods_count-1].mod_end;
-    oftree_len = oftree_end - oftree;
-
-    /* remove it from consideration */
-    mod[mbi->mods_count-1].mod_start = 0;
-    mod[mbi->mods_count-1].mod_end = 0;
-    --mbi->mods_count;
-
-    if (rtas_entry) {
-        rtas_init((void *)oftree);
-        /* remove rtas module from consideration */
-        mod[mbi->mods_count-1].mod_start = 0;
-        mod[mbi->mods_count-1].mod_end = 0;
-        --mbi->mods_count;
-    }
-    memory_init(mod, mbi->mods_count);
+    console_start_sync(); /* Stay synchronous for early debugging. */
+
+    rtas_init((void *)oftree);
+
+    memory_init();
 
 #ifdef OF_DEBUG
     key_ofdump(0);
@@ -392,30 +375,22 @@ static void __init __start_xen(multiboot
     /* Post-create hook sets security label. */
     acm_post_domain0_create(dom0->domain_id);
 
-    cmdline = (char *)(mod[0].string ? __va((ulong)mod[0].string) : NULL);
-
     /* scrub_heap_pages() requires IRQs enabled, and we're post IRQ setup... */
     local_irq_enable();
     /* Scrub RAM that is still free and so may go to an unprivileged domain. */
     scrub_heap_pages();
 
-    dom0_start = mod[0].mod_start;
-    dom0_len = mod[0].mod_end - mod[0].mod_start;
-    if (mbi->mods_count > 1) {
-        initrd_start = mod[1].mod_start;
-        initrd_len = mod[1].mod_end - mod[1].mod_start;
-    } else {
-        initrd_start = 0;
-        initrd_len = 0;
-    }
-    if (construct_dom0(dom0, dom0_start, dom0_len,
+    if ((dom0_addr == 0) || (dom0_len == 0))
+        panic("No domain 0 found.\n");
+
+    if (construct_dom0(dom0, dom0_addr, dom0_len,
                        initrd_start, initrd_len,
-                       cmdline) != 0) {
+                       dom0_cmdline) != 0) {
         panic("Could not set up DOM0 guest OS\n");
     }
 
-    init_xenheap_pages(ALIGN_UP(dom0_start, PAGE_SIZE),
-                       ALIGN_DOWN(dom0_start + dom0_len, PAGE_SIZE));
+    init_xenheap_pages(ALIGN_UP(dom0_addr, PAGE_SIZE),
+                       ALIGN_DOWN(dom0_addr + dom0_len, PAGE_SIZE));
     if (initrd_start)
         init_xenheap_pages(ALIGN_UP(initrd_start, PAGE_SIZE),
                            ALIGN_DOWN(initrd_start + initrd_len, PAGE_SIZE));
@@ -436,25 +411,46 @@ static void __init __start_xen(multiboot
     startup_cpu_idle_loop();
 }
 
+void __init __start_xen_ppc(ulong, ulong, ulong, ulong, ulong, ulong);
 void __init __start_xen_ppc(
     ulong r3, ulong r4, ulong r5, ulong r6, ulong r7, ulong orig_msr)
 {
-    multiboot_info_t *mbi = NULL;
+    void *oft;
+    char *xen_cmdline;
+    char *dom0_cmdline;
 
     /* clear bss */
     memset(__bss_start, 0, (ulong)_end - (ulong)__bss_start);
 
-    if (r5 > 0) {
-        /* we were booted by OpenFirmware */
-        mbi = boot_of_init(r3, r4, r5, r6, r7, orig_msr);
-
+    if (r5) {
+        /* We came from Open Firmware. */
+        boot_of_init(r5, orig_msr);
+        oft = boot_of_devtree(); /* Copy the device tree. */
+
+        /* Use the device tree to find the Xen console. */
+        boot_of_serial(oft);
+        /* Get the command line. */
+        xen_cmdline = boot_of_bootargs(&dom0_cmdline);
+
+        boot_of_finish(); /* End firmware. */
     } else {
         /* booted by someone else that hopefully has a trap handler */
         __builtin_trap();
     }
 
-    __start_xen(mbi);
-
+    if (r3 == MB2_BOOTLOADER_MAGIC) {
+        parse_multiboot(r4);
+    } else if (r3 && r4) {
+        /* Was dom0's location handed to us in registers? */
+        dom0_addr = r3;
+        dom0_len = r4;
+    } else {
+        /* Dom0 had better be built in. */
+        dom0_addr = (ulong)dom0_start;
+        dom0_len = (ulong)dom0_size;
+    }
+
+    __start_xen(xen_cmdline, dom0_cmdline);
 }
 
 extern void arch_get_xen_caps(xen_capabilities_info_t info);
diff -r c934371553ac -r 9b15f4125a34 xen/include/asm-powerpc/boot.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-powerpc/boot.h    Thu Jan 11 17:23:23 2007 -0600
@@ -0,0 +1,42 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright IBM Corp. 2007
+ *
+ * Authors: Hollis Blanchard <[EMAIL PROTECTED]>
+ */
+
+#ifndef _ASM_BOOT_H
+#define _ASM_BOOT_H
+
+/* a collection of interfaces used during boot. */
+
+extern void boot_of_init(ulong, ulong);
+extern void *boot_of_devtree(void);
+extern void boot_of_serial(void *);
+extern char *boot_of_bootargs(void);
+extern void boot_of_finish(void);
+extern int boot_of_mem_avail(int pos, ulong *startpage, ulong *endpage);
+
+extern void parse_multiboot(ulong tags_addr);
+
+extern void memory_init(void);
+
+extern ulong dom0_addr;
+extern ulong dom0_len;
+extern ulong initrd_start;
+extern ulong initrd_len;
+
+#endif
diff -r c934371553ac -r 9b15f4125a34 xen/include/asm-powerpc/mm.h
--- a/xen/include/asm-powerpc/mm.h      Thu Jan 11 16:57:05 2007 -0600
+++ b/xen/include/asm-powerpc/mm.h      Thu Jan 11 17:23:23 2007 -0600
@@ -35,7 +35,6 @@
 #define memguard_unguard_range(_p,_l)    ((void)0)
 
 extern unsigned long xenheap_phys_end;
-extern int boot_of_mem_avail(int pos, ulong *start, ulong *end);
 
 /*
  * Per-page-frame information.
diff -r c934371553ac -r 9b15f4125a34 xen/include/xen/multiboot2.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/xen/multiboot2.h      Thu Jan 11 17:23:23 2007 -0600
@@ -0,0 +1,99 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright IBM Corp. 2006, 2007
+ *
+ * Authors: Hollis Blanchard <[EMAIL PROTECTED]>
+ *          
+ */
+
+#ifndef _MULTIBOOT2_H_
+#define _MULTIBOOT2_H_
+
+/* How many bytes from the start of the file we search for the header.  */
+#define MB2_HEADER_SEARCH           8192
+
+/* The magic field should contain this.  */
+#define MB2_HEADER_MAGIC            0xe85250d6
+
+/* Passed from the bootloader to the kernel.  */
+#define MB2_BOOTLOADER_MAGIC        0x36d76289
+
+#include <stdint.h>
+
+#define for_each_tag(_tag, _tags) \
+    for ((_tag) = (_tags); \
+            ((_tag)->key != MB2_TAG_END && (_tag)->key != 0); \
+            (_tag) = (void *)(_tag) + (_tag)->len)
+
+typedef uint32_t mb2_word;
+
+struct mb2_header
+{
+  uint32_t magic;
+};
+
+struct mb2_tag_header
+{
+  uint32_t key;
+  uint32_t len;
+};
+
+#define MB2_TAG_START     1
+struct mb2_tag_start
+{
+  struct mb2_tag_header header;
+  mb2_word size; /* Total size of all mb2 tags. */
+};
+
+#define MB2_TAG_NAME      2
+struct mb2_tag_name
+{
+  struct mb2_tag_header header;
+  char name[1];
+};
+
+#define MB2_TAG_MODULE    3
+struct mb2_tag_module
+{
+  struct mb2_tag_header header;
+  mb2_word addr;
+  mb2_word size;
+  unsigned char type[36];
+  unsigned char cmdline[1];
+};
+
+#define MB2_TAG_MEMORY    4
+struct mb2_tag_memory
+{
+  struct mb2_tag_header header;
+  mb2_word addr;
+  mb2_word size;
+  mb2_word type;
+};
+
+#define MB2_TAG_UNUSED    5
+struct mb2_tag_unused
+{
+  struct mb2_tag_header header;
+};
+
+#define MB2_TAG_END       0xffff
+struct mb2_tag_end
+{
+  struct mb2_tag_header header;
+};
+
+#endif

_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel

Reply via email to