Mailing List Archive

[xen-unstable] [POWERPC][XEN] Commit missing multiboot files.
# HG changeset patch
# User Hollis Blanchard <hollisb@us.ibm.com>
# Date 1186066255 18000
# Node ID 976db28bcc43bfbb38728aa08e079e6c4d20b3bb
# Parent 553f64e4f6efb0482490324a8e7cd99d3a9a653d
[POWERPC][XEN] Commit missing multiboot files.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
---
xen/arch/powerpc/multiboot2.c | 67 +++++++++++++++++++++++++++
xen/include/asm-powerpc/boot.h | 46 +++++++++++++++++++
xen/include/xen/multiboot2.h | 99 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 212 insertions(+)

diff -r 553f64e4f6ef -r 976db28bcc43 xen/arch/powerpc/multiboot2.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/powerpc/multiboot2.c Thu Aug 02 09:50:55 2007 -0500
@@ -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 <hollisb@us.ibm.com>
+ */
+
+#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((char *)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;
+
+ mod = mb2_tag_mod_find(tags, "kernel");
+ if (mod) {
+ xen_cmdline = (char *)mod->cmdline;
+ }
+
+ mod = mb2_tag_mod_find(tags, "dom0");
+ if (mod) {
+ dom0_addr = mod->addr;
+ dom0_len = mod->size;
+ dom0_cmdline = (char *)mod->cmdline;
+ }
+
+ mod = mb2_tag_mod_find(tags, "initrd");
+ if (mod) {
+ initrd_start = mod->addr;
+ initrd_len = mod->size;
+ }
+}
diff -r 553f64e4f6ef -r 976db28bcc43 xen/include/asm-powerpc/boot.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-powerpc/boot.h Thu Aug 02 09:50:55 2007 -0500
@@ -0,0 +1,46 @@
+/*
+ * 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 <hollisb@us.ibm.com>
+ */
+
+#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 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 char *xen_cmdline;
+extern ulong dom0_addr;
+extern ulong dom0_len;
+extern char *dom0_cmdline;
+extern ulong initrd_start;
+extern ulong initrd_len;
+
+/* From linker script. */
+extern char builtin_cmdline[];
+
+#endif
diff -r 553f64e4f6ef -r 976db28bcc43 xen/include/xen/multiboot2.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/xen/multiboot2.h Thu Aug 02 09:50:55 2007 -0500
@@ -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 <hollisb@us.ibm.com>
+ *
+ */
+
+#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-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog