[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Remove defunct powerpc port.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1210250440 -3600
# Node ID b0d7780794ebb087766391380b1c17467f016fb6
# Parent  0ac957f9d42e778565e745d7b6dc55bd527c8e90
Remove defunct powerpc port.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 config/powerpc64.mk                                |    6 
 tools/libxc/powerpc64/Makefile                     |    4 
 tools/libxc/powerpc64/flatdevtree.c                |  662 -----------
 tools/libxc/powerpc64/flatdevtree.h                |  108 -
 tools/libxc/powerpc64/flatdevtree_env.h            |   94 -
 tools/libxc/powerpc64/mk_flatdevtree.c             |  648 ----------
 tools/libxc/powerpc64/mk_flatdevtree.h             |   37 
 tools/libxc/powerpc64/xc_memory.c                  |   42 
 tools/libxc/xc_core_powerpc.c                      |   79 -
 tools/libxc/xc_core_powerpc.h                      |   58 
 tools/libxc/xc_dom_powerpc.c                       |  236 ---
 tools/xm-test/ramdisk/configs/buildroot-powerpc    |  338 -----
 xen/arch/powerpc/0opt.c                            |   34 
 xen/arch/powerpc/Makefile                          |  152 --
 xen/arch/powerpc/Rules.mk                          |   52 
 xen/arch/powerpc/audit.c                           |   47 
 xen/arch/powerpc/backtrace.c                       |  217 ---
 xen/arch/powerpc/bitops.c                          |   94 -
 xen/arch/powerpc/boot_of.c                         | 1257 ---------------------
 xen/arch/powerpc/cmdline.c                         |   24 
 xen/arch/powerpc/crash.c                           |   20 
 xen/arch/powerpc/dart.c                            |  297 ----
 xen/arch/powerpc/dart.h                            |   36 
 xen/arch/powerpc/dart_u3.c                         |  108 -
 xen/arch/powerpc/dart_u4.c                         |  184 ---
 xen/arch/powerpc/domain.c                          |  357 -----
 xen/arch/powerpc/domain_build.c                    |  297 ----
 xen/arch/powerpc/domctl.c                          |  120 --
 xen/arch/powerpc/exceptions.c                      |   91 -
 xen/arch/powerpc/exceptions.h                      |   54 
 xen/arch/powerpc/external.c                        |  202 ---
 xen/arch/powerpc/float.S                           |  243 ----
 xen/arch/powerpc/gdbstub.c                         |  216 ---
 xen/arch/powerpc/hcalls.c                          |  171 --
 xen/arch/powerpc/iommu.c                           |   95 -
 xen/arch/powerpc/iommu.h                           |   28 
 xen/arch/powerpc/irq.c                             |   22 
 xen/arch/powerpc/machine_kexec.c                   |   41 
 xen/arch/powerpc/memory.c                          |  224 ---
 xen/arch/powerpc/mm.c                              |  617 ----------
 xen/arch/powerpc/mpic.c                            | 1100 ------------------
 xen/arch/powerpc/mpic_init.c                       |  416 ------
 xen/arch/powerpc/mpic_init.h                       |   27 
 xen/arch/powerpc/multiboot2.c                      |   67 -
 xen/arch/powerpc/numa.c                            |    1 
 xen/arch/powerpc/of-devtree.c                      | 1087 ------------------
 xen/arch/powerpc/of-devtree.h                      |  157 --
 xen/arch/powerpc/of-devwalk.c                      |  133 --
 xen/arch/powerpc/of_handler/Makefile               |   32 
 xen/arch/powerpc/of_handler/console.c              |  233 ---
 xen/arch/powerpc/of_handler/control.c              |   90 -
 xen/arch/powerpc/of_handler/cpu.c                  |   82 -
 xen/arch/powerpc/of_handler/devtree.c              |  268 ----
 xen/arch/powerpc/of_handler/head.S                 |  156 --
 xen/arch/powerpc/of_handler/io.c                   |  160 --
 xen/arch/powerpc/of_handler/leap.S                 |   38 
 xen/arch/powerpc/of_handler/memcmp.c               |   39 
 xen/arch/powerpc/of_handler/memory.c               |  129 --
 xen/arch/powerpc/of_handler/memset.c               |   67 -
 xen/arch/powerpc/of_handler/ofh.c                  |  439 -------
 xen/arch/powerpc/of_handler/ofh.h                  |  164 --
 xen/arch/powerpc/of_handler/papr.S                 |   97 -
 xen/arch/powerpc/of_handler/papr.h                 |   69 -
 xen/arch/powerpc/of_handler/rtas.c                 |   82 -
 xen/arch/powerpc/of_handler/services.c             |   96 -
 xen/arch/powerpc/of_handler/snprintf.c             |  332 -----
 xen/arch/powerpc/of_handler/strcmp.c               |   36 
 xen/arch/powerpc/of_handler/strlcpy.c              |   58 
 xen/arch/powerpc/of_handler/strlen.c               |   30 
 xen/arch/powerpc/of_handler/strncmp.c              |   39 
 xen/arch/powerpc/of_handler/strnlen.c              |   30 
 xen/arch/powerpc/of_handler/vdevice.c              |   74 -
 xen/arch/powerpc/of_handler/xen_hvcall.S           |   44 
 xen/arch/powerpc/of_handler/xencomm.c              |   84 -
 xen/arch/powerpc/ofd_fixup.c                       |  428 -------
 xen/arch/powerpc/ofd_fixup_memory.c                |  128 --
 xen/arch/powerpc/oftree.h                          |   38 
 xen/arch/powerpc/papr/Makefile                     |   11 
 xen/arch/powerpc/papr/debug.c                      |   84 -
 xen/arch/powerpc/papr/h_perfmon.c                  |  158 --
 xen/arch/powerpc/papr/tce.c                        |   84 -
 xen/arch/powerpc/papr/vtce.c                       |  158 --
 xen/arch/powerpc/papr/vterm.c                      |   70 -
 xen/arch/powerpc/papr/xlate.c                      |  619 ----------
 xen/arch/powerpc/physdev.c                         |   24 
 xen/arch/powerpc/platform.c                        |   43 
 xen/arch/powerpc/powerpc64/Makefile                |   14 
 xen/arch/powerpc/powerpc64/asm-offsets.c           |   67 -
 xen/arch/powerpc/powerpc64/domain.c                |  222 ---
 xen/arch/powerpc/powerpc64/exceptions.S            |  644 ----------
 xen/arch/powerpc/powerpc64/hypercall_table.S       |   46 
 xen/arch/powerpc/powerpc64/io.S                    |  193 ---
 xen/arch/powerpc/powerpc64/memcpy.S                |  171 --
 xen/arch/powerpc/powerpc64/ppc970.c                |  302 -----
 xen/arch/powerpc/powerpc64/ppc970_machinecheck.c   |  125 --
 xen/arch/powerpc/powerpc64/ppc970_scom.c           |  184 ---
 xen/arch/powerpc/powerpc64/prom_call.S             |  116 -
 xen/arch/powerpc/powerpc64/scom.h                  |   39 
 xen/arch/powerpc/powerpc64/string.S                |  286 ----
 xen/arch/powerpc/powerpc64/traps.c                 |   58 
 xen/arch/powerpc/ppc32/prom_call.c                 |   41 
 xen/arch/powerpc/rtas.c                            |  201 ---
 xen/arch/powerpc/rtas.h                            |   65 -
 xen/arch/powerpc/rtas_flash.c                      |  182 ---
 xen/arch/powerpc/rtas_nvram.c                      |  129 --
 xen/arch/powerpc/setup.c                           |  509 --------
 xen/arch/powerpc/shadow.c                          |  155 --
 xen/arch/powerpc/smp-tbsync.c                      |  193 ---
 xen/arch/powerpc/smp.c                             |  214 ---
 xen/arch/powerpc/smpboot.c                         |   29 
 xen/arch/powerpc/start.S                           |   62 -
 xen/arch/powerpc/sysctl.c                          |   65 -
 xen/arch/powerpc/systemsim.S                       |   64 -
 xen/arch/powerpc/tce.h                             |   71 -
 xen/arch/powerpc/time.c                            |   90 -
 xen/arch/powerpc/usercopy.c                        |   50 
 xen/arch/powerpc/xen.lds.S                         |  250 ----
 xen/include/asm-powerpc/acpi.h                     |    2 
 xen/include/asm-powerpc/asm_defns.h                |   28 
 xen/include/asm-powerpc/atomic.h                   |  211 ---
 xen/include/asm-powerpc/bitops.h                   |  309 -----
 xen/include/asm-powerpc/boot.h                     |   46 
 xen/include/asm-powerpc/bug.h                      |    7 
 xen/include/asm-powerpc/byteorder.h                |   80 -
 xen/include/asm-powerpc/cache.h                    |   74 -
 xen/include/asm-powerpc/config.h                   |   85 -
 xen/include/asm-powerpc/current.h                  |   79 -
 xen/include/asm-powerpc/debugger.h                 |   97 -
 xen/include/asm-powerpc/delay.h                    |   40 
 xen/include/asm-powerpc/desc.h                     |   25 
 xen/include/asm-powerpc/div64.h                    |   33 
 xen/include/asm-powerpc/domain.h                   |  123 --
 xen/include/asm-powerpc/elf.h                      |   30 
 xen/include/asm-powerpc/event.h                    |   99 -
 xen/include/asm-powerpc/flushtlb.h                 |  105 -
 xen/include/asm-powerpc/grant_table.h              |   92 -
 xen/include/asm-powerpc/guest_access.h             |   26 
 xen/include/asm-powerpc/hardirq.h                  |   21 
 xen/include/asm-powerpc/hcalls.h                   |   34 
 xen/include/asm-powerpc/htab.h                     |  136 --
 xen/include/asm-powerpc/hypercall.h                |   26 
 xen/include/asm-powerpc/init.h                     |   40 
 xen/include/asm-powerpc/io.h                       |   69 -
 xen/include/asm-powerpc/iocap.h                    |   26 
 xen/include/asm-powerpc/irq.h                      |   31 
 xen/include/asm-powerpc/mach-default/irq_vectors.h |   89 -
 xen/include/asm-powerpc/memory.h                   |   39 
 xen/include/asm-powerpc/mm.h                       |  286 ----
 xen/include/asm-powerpc/mpic.h                     |  294 ----
 xen/include/asm-powerpc/msr.h                      |   66 -
 xen/include/asm-powerpc/multicall.h                |   27 
 xen/include/asm-powerpc/nmi.h                      |    9 
 xen/include/asm-powerpc/numa.h                     |   28 
 xen/include/asm-powerpc/page.h                     |  134 --
 xen/include/asm-powerpc/papr.h                     |  219 ---
 xen/include/asm-powerpc/pci.h                      |   35 
 xen/include/asm-powerpc/percpu.h                   |   36 
 xen/include/asm-powerpc/perfc.h                    |   16 
 xen/include/asm-powerpc/platform.h                 |   28 
 xen/include/asm-powerpc/powerpc64/config.h         |   39 
 xen/include/asm-powerpc/powerpc64/ppc970-hid.h     |  144 --
 xen/include/asm-powerpc/powerpc64/ppc970.h         |   31 
 xen/include/asm-powerpc/powerpc64/procarea.h       |   38 
 xen/include/asm-powerpc/powerpc64/processor.h      |  228 ---
 xen/include/asm-powerpc/powerpc64/string.h         |   42 
 xen/include/asm-powerpc/processor.h                |  429 -------
 xen/include/asm-powerpc/reg_defs.h                 |  210 ---
 xen/include/asm-powerpc/regs.h                     |   25 
 xen/include/asm-powerpc/shadow.h                   |   52 
 xen/include/asm-powerpc/shared.h                   |    4 
 xen/include/asm-powerpc/smp.h                      |   60 -
 xen/include/asm-powerpc/softirq.h                  |    6 
 xen/include/asm-powerpc/spinlock.h                 |  218 ---
 xen/include/asm-powerpc/string.h                   |   26 
 xen/include/asm-powerpc/system.h                   |  247 ----
 xen/include/asm-powerpc/time.h                     |   86 -
 xen/include/asm-powerpc/trace.h                    |    4 
 xen/include/asm-powerpc/types.h                    |   79 -
 xen/include/asm-powerpc/xenoprof.h                 |  100 -
 xen/include/public/arch-powerpc.h                  |  120 --
 Config.mk                                          |    3 
 tools/libxc/Makefile                               |    2 
 tools/libxc/xc_core.h                              |    2 
 tools/libxc/xc_dom_elfloader.c                     |    2 
 tools/libxc/xenctrl.h                              |    9 
 tools/libxc/xenguest.h                             |   14 
 tools/python/xen/lowlevel/xc/xc.c                  |   32 
 tools/python/xen/xend/arch.py                      |    2 
 tools/python/xen/xend/image.py                     |   17 
 tools/xm-test/lib/XmTestLib/arch.py                |   40 
 tools/xm-test/lib/XmTestReport/arch.py             |    6 
 tools/xm-test/ramdisk/Makefile.am                  |    2 
 tools/xm-test/ramdisk/make-release.sh              |    3 
 tools/xm-test/runtest.sh                           |    2 
 xen/Rules.mk                                       |    3 
 xen/include/asm-x86/desc.h                         |    2 
 xen/include/public/io/protocols.h                  |    3 
 xen/include/public/libelf.h                        |    4 
 xen/include/public/xen.h                           |    2 
 199 files changed, 6 insertions(+), 25862 deletions(-)

diff -r 0ac957f9d42e -r b0d7780794eb Config.mk
--- a/Config.mk Thu May 08 13:15:45 2008 +0100
+++ b/Config.mk Thu May 08 13:40:40 2008 +0100
@@ -4,8 +4,7 @@ debug ?= n
 debug ?= n
 
 XEN_COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/ \
-                         -e s/ppc/powerpc/ -e s/i86pc/x86_32/   \
-                         -e s/amd64/x86_64/)
+                         -e s/i86pc/x86_32/ -e s/amd64/x86_64/)
 XEN_TARGET_ARCH     ?= $(XEN_COMPILE_ARCH)
 XEN_OS              ?= $(shell uname -s)
 
diff -r 0ac957f9d42e -r b0d7780794eb config/powerpc64.mk
--- a/config/powerpc64.mk       Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-CONFIG_POWERPC := y
-CONFIG_POWERPC_$(XEN_OS) := y
-
-CONFIG_XENCOMM := y
-
-CFLAGS += -DELFSIZE=64
diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/Makefile
--- a/tools/libxc/Makefile      Thu May 08 13:15:45 2008 +0100
+++ b/tools/libxc/Makefile      Thu May 08 13:40:40 2008 +0100
@@ -9,7 +9,6 @@ CTRL_SRCS-y       += xc_core.c
 CTRL_SRCS-y       += xc_core.c
 CTRL_SRCS-$(CONFIG_X86) += xc_core_x86.c
 CTRL_SRCS-$(CONFIG_IA64) += xc_core_ia64.c
-CTRL_SRCS-$(CONFIG_POWERPC) += xc_core_powerpc.c
 endif
 CTRL_SRCS-y       += xc_domain.c
 CTRL_SRCS-y       += xc_evtchn.c
@@ -55,7 +54,6 @@ GUEST_SRCS-$(CONFIG_X86)     += xc_dom_x
 GUEST_SRCS-$(CONFIG_X86)     += xc_dom_x86.c
 GUEST_SRCS-$(CONFIG_X86)     += xc_cpuid_x86.c
 GUEST_SRCS-$(CONFIG_IA64)    += xc_dom_ia64.c
-GUEST_SRCS-$(CONFIG_POWERPC) += xc_dom_powerpc.c
 endif
 
 -include $(XEN_TARGET_ARCH)/Makefile
diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/powerpc64/Makefile
--- a/tools/libxc/powerpc64/Makefile    Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-GUEST_SRCS-y += powerpc64/flatdevtree.c
-GUEST_SRCS-y += powerpc64/mk_flatdevtree.c
-
-CTRL_SRCS-y += powerpc64/xc_memory.c
diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/powerpc64/flatdevtree.c
--- a/tools/libxc/powerpc64/flatdevtree.c       Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,662 +0,0 @@
-/*
- * 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 Pantelis Antoniou 2006
- * Copyright IBM Corporation 2006, 2007
- * 2006 (c) MontaVista, Software, Inc.
- *
- * Authors: Pantelis Antoniou <pantelis@xxxxxxxxxxxxxxxxx>
- *          Hollis Blanchard <hollisb@xxxxxxxxxx>
- *          Mark A. Greer <mgreer@xxxxxxxxxx>
- */
-
-#include "flatdevtree.h"
-
-/* Set ptrs to current one's info; return addr of next one */
-static u32 *ft_next(u32 *p, const u32 *p_strings, const u32 version,
-               u32 **tagpp, char **namepp, char **datapp, u32 **sizepp)
-{
-       u32 sz;
-
-       *namepp = NULL;
-       *datapp = NULL;
-       *sizepp = NULL;
-       *tagpp = p;
-
-       switch (be32_to_cpu(*p++)) { /* Tag */
-       case OF_DT_BEGIN_NODE:
-               *namepp = (char *)p;
-               p = (u32 *)_ALIGN((unsigned long)p + strlen((char *)p) + 1, 4);
-               break;
-       case OF_DT_PROP:
-               sz = be32_to_cpu(*p);
-               *sizepp = p++;
-               *namepp = (char *)p_strings + be32_to_cpu(*p++);
-               if ((version < 0x10) && (sz >= 8))
-                       p = (u32 *)_ALIGN((unsigned long)p, 8);
-               *datapp = (char *)p;
-               p = (u32 *)_ALIGN((unsigned long)p + sz, 4);
-               break;
-       case OF_DT_END_NODE:
-       case OF_DT_NOP:
-               break;
-       case OF_DT_END:
-       default:
-               p = NULL;
-               break;
-       }
-
-       return p;
-}
-
-static void ft_put_word(struct ft_cxt *cxt, u32 v)
-{
-       if (cxt->overflow)      /* do nothing */
-               return;
-
-       /* check for overflow */
-       if (cxt->p + 4 > cxt->pstr) {
-               cxt->overflow = 1;
-               return;
-       }
-
-       *(u32 *) cxt->p = cpu_to_be32(v);
-       cxt->p += 4;
-}
-
-static inline void ft_put_bin(struct ft_cxt *cxt, const void *data, int sz)
-{
-       char *p;
-
-       if (cxt->overflow)      /* do nothing */
-               return;
-
-       /* next pointer pos */
-       p = (char *) _ALIGN((unsigned long)cxt->p + sz, 4);
-
-       /* check for overflow */
-       if (p > cxt->pstr) {
-               cxt->overflow = 1;
-               return;
-       }
-
-       memcpy(cxt->p, data, sz);
-       if ((sz & 3) != 0)
-               memset(cxt->p + sz, 0, 4 - (sz & 3));
-       cxt->p = p;
-}
-
-void ft_begin_node(struct ft_cxt *cxt, const char *name)
-{
-       ft_put_word(cxt, OF_DT_BEGIN_NODE);
-       ft_put_bin(cxt, name, strlen(name) + 1);
-}
-
-void ft_end_node(struct ft_cxt *cxt)
-{
-       ft_put_word(cxt, OF_DT_END_NODE);
-}
-
-void ft_nop(struct ft_cxt *cxt)
-{
-       ft_put_word(cxt, OF_DT_NOP);
-}
-
-static int lookup_string(struct ft_cxt *cxt, const char *name)
-{
-       char *p;
-
-       p = cxt->pstr;
-       while (p < cxt->pstr_begin) {
-               if (strcmp(p, (char *)name) == 0)
-                       return p - cxt->p_begin;
-               p += strlen(p) + 1;
-       }
-
-       return -1;
-}
-
-void ft_prop(struct ft_cxt *cxt, const char *name,
-               const void *data, unsigned int sz)
-{
-       int len, off;
-
-       if (cxt->overflow)
-               return;
-
-       len = strlen(name) + 1;
-
-       off = lookup_string(cxt, name);
-       if (off == -1) {
-               /* check if we have space */
-               if (cxt->p + 12 + sz + len > cxt->pstr) {
-                       cxt->overflow = 1;
-                       return;
-               }
-
-               cxt->pstr -= len;
-               memcpy(cxt->pstr, name, len);
-               off = cxt->pstr - cxt->p_begin;
-       }
-
-       /* now put offset from beginning of *STRUCTURE* */
-       /* will be fixed up at the end */
-       ft_put_word(cxt, OF_DT_PROP);
-       ft_put_word(cxt, sz);
-       ft_put_word(cxt, off);
-       ft_put_bin(cxt, data, sz);
-}
-
-void ft_prop_str(struct ft_cxt *cxt, const char *name, const char *str)
-{
-       ft_prop(cxt, name, str, strlen(str) + 1);
-}
-
-void ft_prop_int(struct ft_cxt *cxt, const char *name, unsigned int val)
-{
-       u32 v = cpu_to_be32((u32) val);
-
-       ft_prop(cxt, name, &v, 4);
-}
-
-/* start construction of the flat OF tree */
-void ft_begin(struct ft_cxt *cxt, void *blob, unsigned int max_size)
-{
-       struct boot_param_header *bph = blob;
-       u32 off;
-
-       /* clear the cxt */
-       memset(cxt, 0, sizeof(*cxt));
-
-       cxt->bph = bph;
-       cxt->max_size = max_size;
-
-       /* zero everything in the header area */
-       memset(bph, 0, sizeof(*bph));
-
-       bph->magic = cpu_to_be32(OF_DT_HEADER);
-       bph->version = cpu_to_be32(0x10);
-       bph->last_comp_version = cpu_to_be32(0x10);
-
-       /* start pointers */
-       cxt->pres_begin = (char *) _ALIGN((unsigned long)(bph + 1), 8);
-       cxt->pres = cxt->pres_begin;
-
-       off = (unsigned long)cxt->pres_begin - (unsigned long)bph;
-       bph->off_mem_rsvmap = cpu_to_be32(off);
-
-       ((u64 *) cxt->pres)[0] = 0;     /* phys = 0, size = 0, terminate */
-       ((u64 *) cxt->pres)[1] = 0;
-
-       cxt->p_anchor = cxt->pres + 16; /* over the terminator */
-}
-
-/* add a reserver physical area to the rsvmap */
-void ft_add_rsvmap(struct ft_cxt *cxt, u64 physaddr, u64 size)
-{
-       ((u64 *) cxt->pres)[0] = cpu_to_be64(physaddr); /* phys = 0, size = 0, 
terminate */
-       ((u64 *) cxt->pres)[1] = cpu_to_be64(size);
-
-       cxt->pres += 16;        /* advance two u64s worth */
-
-       ((u64 *) cxt->pres)[0] = 0;     /* phys = 0, size = 0, terminate */
-       ((u64 *) cxt->pres)[1] = 0;
-
-       /* keep track of size */
-       cxt->res_size = cxt->pres + 16 - cxt->pres_begin;
-
-       cxt->p_anchor = cxt->pres + 16; /* over the terminator */
-}
-
-int ft_set_rsvmap(void *bphp, int m, u64 physaddr, u64 size)
-{
-       const struct boot_param_header *bph = bphp;
-       u64 *p_rsvmap = (u64 *)
-               ((char *)bph + be32_to_cpu(bph->off_mem_rsvmap));
-       u32 i;
-
-       for (i = 0;; i++) {
-               u64 addr, sz;
-
-               addr = be64_to_cpu(p_rsvmap[i * 2]);
-               sz = be64_to_cpu(p_rsvmap[i * 2 + 1]);
-               if (addr == 0 && size == 0)
-                       break;
-               if (m == i) {
-                       p_rsvmap[i * 2] = cpu_to_be64(physaddr);
-                       p_rsvmap[i * 2 + 1] = cpu_to_be64(size);
-                       return 0;
-               }
-       }
-       return -1;
-}
-
-void ft_begin_tree(struct ft_cxt *cxt)
-{
-       cxt->p_begin = cxt->p_anchor;
-       cxt->pstr_begin = (char *)cxt->bph + cxt->max_size;     /* point at the 
end */
-
-       cxt->p = cxt->p_begin;
-       cxt->pstr = cxt->pstr_begin;
-}
-
-int ft_end_tree(struct ft_cxt *cxt)
-{
-       struct boot_param_header *bph = cxt->bph;
-       int off, sz, sz1;
-       u32 tag, v;
-       char *p;
-
-       ft_put_word(cxt, OF_DT_END);
-
-       if (cxt->overflow)
-               return -ENOMEM;
-
-       /* size of the areas */
-       cxt->struct_size = cxt->p - cxt->p_begin;
-       cxt->strings_size = cxt->pstr_begin - cxt->pstr;
-
-       /* the offset we must move */
-       off = (cxt->pstr_begin - cxt->p_begin) - cxt->strings_size;
-
-       /* the new strings start */
-       cxt->pstr_begin = cxt->p_begin + cxt->struct_size;
-
-       /* move the whole string area */
-       memmove(cxt->pstr_begin, cxt->pstr, cxt->strings_size);
-
-       /* now perform the fixup of the strings */
-       p = cxt->p_begin;
-       while ((tag = be32_to_cpu(*(u32 *) p)) != OF_DT_END) {
-               p += 4;
-
-               if (tag == OF_DT_BEGIN_NODE) {
-                       p = (char *) _ALIGN((unsigned long)p + strlen(p) + 1, 
4);
-                       continue;
-               }
-
-               if (tag == OF_DT_END_NODE || tag == OF_DT_NOP)
-                       continue;
-
-               if (tag != OF_DT_PROP)
-                       return -EINVAL;
-
-               sz = be32_to_cpu(*(u32 *) p);
-               p += 4;
-
-               v = be32_to_cpu(*(u32 *) p);
-               v -= off;
-               *(u32 *) p = cpu_to_be32(v);    /* move down */
-               p += 4;
-
-               p = (char *) _ALIGN((unsigned long)p + sz, 4);
-       }
-
-       /* fix sizes */
-       p = (char *)cxt->bph;
-       sz = (cxt->pstr_begin + cxt->strings_size) - p;
-       sz1 = _ALIGN(sz, 16);   /* align at 16 bytes */
-       if (sz != sz1)
-               memset(p + sz, 0, sz1 - sz);
-       bph->totalsize = cpu_to_be32(sz1);
-       bph->off_dt_struct = cpu_to_be32(cxt->p_begin - p);
-       bph->off_dt_strings = cpu_to_be32(cxt->pstr_begin - p);
-
-       /* the new strings start */
-       cxt->pstr_begin = cxt->p_begin + cxt->struct_size;
-       cxt->pstr = cxt->pstr_begin + cxt->strings_size;
-
-       /* mark the size of string structure in bph */
-       bph->size_dt_strings = cxt->strings_size;
-
-       return 0;
-}
-
-/**********************************************************************/
-
-static inline int isprint(int c)
-{
-       return c >= 0x20 && c <= 0x7e;
-}
-
-static int is_printable_string(const void *data, int len)
-{
-       const char *s = data;
-       const char *ss;
-
-       /* zero length is not */
-       if (len == 0)
-               return 0;
-
-       /* must terminate with zero */
-       if (s[len - 1] != '\0')
-               return 0;
-
-       ss = s;
-       while (*s && isprint(*s))
-               s++;
-
-       /* not zero, or not done yet */
-       if (*s != '\0' || (s + 1 - ss) < len)
-               return 0;
-
-       return 1;
-}
-
-static void print_data(const void *data, int len)
-{
-       int i;
-       const char *s;
-
-       /* no data, don't print */
-       if (len == 0)
-               return;
-
-       if (is_printable_string(data, len)) {
-               printf(" = \"%s\"", (char *)data);
-               return;
-       }
-
-       switch (len) {
-       case 1:         /* byte */
-               printf(" = <0x%02x>", (*(char *) data) & 0xff);
-               break;
-       case 2:         /* half-word */
-               printf(" = <0x%04x>", be16_to_cpu(*(u16 *) data) & 0xffff);
-               break;
-       case 4:         /* word */
-               printf(" = <0x%08x>", be32_to_cpu(*(u32 *) data) & 0xffffffffU);
-               break;
-       case 8:         /* double-word */
-               printf(" = <0x%16llx>", be64_to_cpu(*(u64 *) data));
-               break;
-       default:                /* anything else... hexdump */
-               printf(" = [");
-               for (i = 0, s = data; i < len; i++)
-                       printf("%02x%s", s[i], i < len - 1 ? " " : "");
-               printf("]");
-
-               break;
-       }
-}
-
-void ft_dump_blob(const void *bphp)
-{
-       const struct boot_param_header *bph = bphp;
-       const u64 *p_rsvmap = (const u64 *)
-               ((const char *)bph + be32_to_cpu(bph->off_mem_rsvmap));
-       const u32 *p_struct = (const u32 *)
-               ((const char *)bph + be32_to_cpu(bph->off_dt_struct));
-       const u32 *p_strings = (const u32 *)
-               ((const char *)bph + be32_to_cpu(bph->off_dt_strings));
-       const u32 version = be32_to_cpu(bph->version);
-       u32 i, *p, *tagp, *sizep;
-       char *namep, *datap;
-       int depth, shift;
-       u64 addr, size;
-
-
-       if (be32_to_cpu(bph->magic) != OF_DT_HEADER) {
-               /* not valid tree */
-               return;
-       }
-
-       depth = 0;
-       shift = 4;
-
-       for (i = 0;; i++) {
-               addr = be64_to_cpu(p_rsvmap[i * 2]);
-               size = be64_to_cpu(p_rsvmap[i * 2 + 1]);
-               if (addr == 0 && size == 0)
-                       break;
-
-               printf("/memreserve/ 0x%llx 0x%llx;\n", addr, size);
-       }
-
-       p = (u32 *)p_struct;
-       while ((p = ft_next(p, p_strings, version, &tagp, &namep, &datap,
-                                       &sizep)) != NULL)
-               switch (be32_to_cpu(*tagp)) {
-               case OF_DT_BEGIN_NODE:
-                       printf("%*s%s {\n", depth * shift, "", namep);
-                       depth++;
-                       break;
-               case OF_DT_END_NODE:
-                       depth--;
-                       printf("%*s};\n", depth * shift, "");
-                       break;
-               case OF_DT_NOP:
-                       printf("%*s[NOP]\n", depth * shift, "");
-                       break;
-               case OF_DT_END:
-                       break;
-               case OF_DT_PROP:
-                       printf("%*s%s", depth * shift, "", namep);
-                       print_data(datap, *sizep);
-                       printf(";\n");
-                       break;
-               default:
-                       fprintf(stderr, "%*s ** Unknown tag 0x%08x\n",
-                               depth * shift, "", *tagp);
-                       return;
-               }
-}
-
-void ft_backtrack_node(struct ft_cxt *cxt)
-{
-       if (be32_to_cpu(*(u32 *) (cxt->p - 4)) != OF_DT_END_NODE)
-               return;         /* XXX only for node */
-
-       cxt->p -= 4;
-}
-
-/* note that the root node of the blob is "peeled" off */
-void ft_merge_blob(struct ft_cxt *cxt, void *blob)
-{
-       struct boot_param_header *bph = (struct boot_param_header *)blob;
-       u32 *p_struct = (u32 *) ((char *)bph + be32_to_cpu(bph->off_dt_struct));
-       u32 *p_strings =
-               (u32 *) ((char *)bph + be32_to_cpu(bph->off_dt_strings));
-       const u32 version = be32_to_cpu(bph->version);
-       u32 *p, *tagp, *sizep;
-       char *namep, *datap;
-       int depth;
-
-       if (be32_to_cpu(*(u32 *) (cxt->p - 4)) != OF_DT_END_NODE)
-               return;         /* XXX only for node */
-
-       cxt->p -= 4;
-
-       depth = 0;
-       p = p_struct;
-       while ((p = ft_next(p, p_strings, version, &tagp, &namep, &datap,
-                                       &sizep)) != NULL)
-               switch (be32_to_cpu(*tagp)) {
-               case OF_DT_BEGIN_NODE:
-                       if (depth++ > 0)
-                               ft_begin_node(cxt, namep);
-                       break;
-               case OF_DT_END_NODE:
-                       ft_end_node(cxt);
-                       if (--depth == 0)
-                               return;
-                       break;
-               case OF_DT_PROP:
-                       ft_prop(cxt, namep, datap, *sizep);
-                       break;
-               }
-}
-
-/**********************************************************************/
-
-void *ft_find_node(const void *bphp, const char *srch_path)
-{
-       const struct boot_param_header *bph = bphp;
-       u32 *p_struct = (u32 *)((char *)bph + be32_to_cpu(bph->off_dt_struct));
-       u32 *p_strings= (u32 *)((char *)bph + be32_to_cpu(bph->off_dt_strings));
-       u32 version = be32_to_cpu(bph->version);
-       u32 *p, *tagp, *sizep;
-       char *namep, *datap;
-       static char path[MAX_PATH_LEN];
-
-       path[0] = '\0';
-       p = p_struct;
-
-       while ((p = ft_next(p, p_strings, version, &tagp, &namep, &datap,
-                                       &sizep)) != NULL)
-               switch (be32_to_cpu(*tagp)) {
-               case OF_DT_BEGIN_NODE:
-                       strcat(path, namep);
-                       if (!strcmp(path, srch_path))
-                               return tagp;
-                       strcat(path, "/");
-                       break;
-               case OF_DT_END_NODE:
-                       ft_parentize(path, 1);
-                       break;
-               }
-       return NULL;
-}
-
-int ft_get_prop(const void *bphp, const void *node, const char *propname,
-               void *buf, const unsigned int buflen)
-{
-       const struct boot_param_header *bph = bphp;
-       u32 *p_strings= (u32 *)((char *)bph + be32_to_cpu(bph->off_dt_strings));
-       u32 version = be32_to_cpu(bph->version);
-       u32 *p, *tagp, *sizep, size;
-       char *namep, *datap;
-       int depth;
-
-       depth = 0;
-       p = (u32 *)node;
-
-       while ((p = ft_next(p, p_strings, version, &tagp, &namep, &datap,
-                                       &sizep)) != NULL)
-               switch (be32_to_cpu(*tagp)) {
-               case OF_DT_BEGIN_NODE:
-                       depth++;
-                       break;
-               case OF_DT_PROP:
-                       if ((depth == 1) && !strcmp(namep, propname)) {
-                               size = min(be32_to_cpu(*sizep), (u32)buflen);
-                               memcpy(buf, datap, size);
-                               return size;
-                       }
-                       break;
-               case OF_DT_END_NODE:
-                       if (--depth <= 0)
-                               return -1;
-                       break;
-               }
-       return -1;
-}
-
-static void ft_modify_prop(void **bphpp, char *datap, u32 *old_prop_sizep,
-               const char *buf, const unsigned int buflen)
-{
-       u32 old_prop_data_len, new_prop_data_len;
-
-       old_prop_data_len = _ALIGN(be32_to_cpu(*old_prop_sizep), 4);
-       new_prop_data_len = _ALIGN(buflen, 4);
-
-       /* Check if new prop data fits in old prop data area */
-       if (new_prop_data_len == old_prop_data_len) {
-               memcpy(datap, buf, buflen);
-               *old_prop_sizep = cpu_to_be32(buflen);
-       } else {
-               /* Need to alloc new area to put larger or smaller ft */
-               struct boot_param_header *old_bph = *bphpp, *new_bph;
-               u32 *old_tailp, *new_tailp, *new_datap;
-               u32 old_total_size, new_total_size, head_len, tail_len, diff, v;
-
-               old_total_size = be32_to_cpu(old_bph->totalsize);
-               head_len = (u32)(datap - (char *)old_bph);
-               tail_len = old_total_size - (head_len + old_prop_data_len);
-               old_tailp = (u32 *)(datap + old_prop_data_len);
-               new_total_size = head_len + new_prop_data_len + tail_len;
-
-               if (!(new_bph = malloc(new_total_size))) {
-                       printf("Can't alloc space for new ft\n");
-                       ft_exit(-ENOSPC);
-               }
-
-               new_datap = (u32 *)((char *)new_bph + head_len);
-               new_tailp = (u32 *)((char *)new_datap + new_prop_data_len);
-
-               memcpy(new_bph, *bphpp, head_len);
-               memcpy(new_datap, buf, buflen);
-               memcpy(new_tailp, old_tailp, tail_len);
-
-               *(new_datap - 2) = cpu_to_be32(buflen); /* Set prop size */
-
-               new_bph->totalsize = cpu_to_be32(new_total_size);
-               diff = new_prop_data_len - old_prop_data_len;
-
-               if (be32_to_cpu(old_bph->off_dt_strings)
-                               > be32_to_cpu(old_bph->off_dt_struct)) {
-                       v = be32_to_cpu(new_bph->off_dt_strings);
-                       new_bph->off_dt_strings = cpu_to_be32(v + diff);
-               }
-
-               if (be32_to_cpu(old_bph->off_mem_rsvmap)
-                               > be32_to_cpu(old_bph->off_dt_struct)) {
-                       v = be32_to_cpu(new_bph->off_mem_rsvmap);
-                       new_bph->off_mem_rsvmap = cpu_to_be32(v + diff);
-               }
-
-               ft_free(*bphpp, old_total_size);
-               *bphpp = new_bph;
-       }
-}
-
-/*
- * - Only modifies existing properties.
- * - The dev tree passed in may be freed and a new one allocated
- *   (and *bphpp set to location of new dev tree).
- */
-int ft_set_prop(void **bphpp, const void *node, const char *propname,
-               const void *buf, const unsigned int buflen)
-{
-       struct boot_param_header *bph = *bphpp;
-       u32 *p_strings= (u32 *)((char *)bph + be32_to_cpu(bph->off_dt_strings));
-       u32 version = be32_to_cpu(bph->version);
-       u32 *p, *tagp, *sizep;
-       char *namep, *datap;
-       int depth;
-
-       depth = 0;
-       p = (u32 *)node;
-
-       while ((p = ft_next(p, p_strings, version, &tagp, &namep, &datap,
-                                       &sizep)) != NULL)
-               switch (be32_to_cpu(*tagp)) {
-               case OF_DT_BEGIN_NODE:
-                       depth++;
-                       break;
-               case OF_DT_PROP:
-                       if ((depth == 1) && !strcmp(namep, propname)) {
-                               ft_modify_prop(bphpp, datap, sizep, buf,
-                                               buflen);
-                               return be32_to_cpu(*sizep);
-                       }
-                       break;
-               case OF_DT_END_NODE:
-                       if (--depth <= 0)
-                               return -1;
-                       break;
-               }
-       return -1;
-}
diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/powerpc64/flatdevtree.h
--- a/tools/libxc/powerpc64/flatdevtree.h       Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef _FLATDEVTREE_H_
-#define _FLATDEVTREE_H_
-
-#include "flatdevtree_env.h"
-
-/* Definitions used by the flattened device tree */
-#define OF_DT_HEADER            0xd00dfeed      /* marker */
-#define OF_DT_BEGIN_NODE        0x1     /* Start of node, full name */
-#define OF_DT_END_NODE          0x2     /* End node */
-#define OF_DT_PROP              0x3     /* Property: name off, size, content */
-#define OF_DT_NOP               0x4     /* nop */
-#define OF_DT_END               0x9
-
-#define OF_DT_VERSION           0x10
-
-struct boot_param_header {
-       u32 magic;              /* magic word OF_DT_HEADER */
-       u32 totalsize;          /* total size of DT block */
-       u32 off_dt_struct;      /* offset to structure */
-       u32 off_dt_strings;     /* offset to strings */
-       u32 off_mem_rsvmap;     /* offset to memory reserve map */
-       u32 version;            /* format version */
-       u32 last_comp_version;  /* last compatible version */
-       /* version 2 fields below */
-       u32 boot_cpuid_phys;    /* Physical CPU id we're booting on */
-       /* version 3 fields below */
-       u32 size_dt_strings;    /* size of the DT strings block */
-};
-
-struct ft_cxt {
-       struct boot_param_header *bph;
-       int max_size;           /* maximum size of tree */
-       int overflow;           /* set when this happens */
-       char *p, *pstr, *pres;  /* running pointers */
-       char *p_begin, *pstr_begin, *pres_begin;        /* starting pointers */
-       char *p_anchor;         /* start of constructed area */
-       int struct_size, strings_size, res_size;
-};
-
-void ft_begin_node(struct ft_cxt *cxt, const char *name);
-void ft_end_node(struct ft_cxt *cxt);
-
-void ft_begin_tree(struct ft_cxt *cxt);
-int ft_end_tree(struct ft_cxt *cxt);
-
-void ft_nop(struct ft_cxt *cxt);
-void ft_prop(struct ft_cxt *cxt, const char *name,
-             const void *data, unsigned int sz);
-void ft_prop_str(struct ft_cxt *cxt, const char *name, const char *str);
-void ft_prop_int(struct ft_cxt *cxt, const char *name, unsigned int val);
-void ft_begin(struct ft_cxt *cxt, void *blob, unsigned int max_size);
-void ft_add_rsvmap(struct ft_cxt *cxt, u64 physaddr, u64 size);
-int ft_set_rsvmap(void *bphp, int m, u64 physaddr, u64 size);
-
-void ft_dump_blob(const void *bphp);
-void ft_backtrack_node(struct ft_cxt *cxt);
-void ft_merge_blob(struct ft_cxt *cxt, void *blob);
-
-void *ft_find_node(const void *bphp, const char *srch_path);
-int ft_get_prop(const void *bphp, const void *node, const char *propname,
-               void *buf, const unsigned int buflen);
-int ft_set_prop(void **bphp, const void *node, const char *propname,
-               const void *buf, const unsigned int buflen);
-
-static inline char *ft_strrchr(const char *s, int c)
-{
-       const char *p = s + strlen(s);
-
-       do {
-               if (*p == (char)c)
-                       return (char *)p;
-       } while (--p >= s);
-       return NULL;
-}
-
-/* 'path' is modified */
-static inline void ft_parentize(char *path, int leave_slash)
-{
-       char *s = &path[strlen(path) - 1];
-
-       if (*s == '/')
-               *s = '\0';
-       s = ft_strrchr(path, '/');
-       if (s != NULL) {
-               if (leave_slash)
-                       s[1] = '\0';
-               else if (s[0] == '/')
-                       s[0] = '\0';
-       }
-}
-
-#endif /* FLATDEVTREE_H */
diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/powerpc64/flatdevtree_env.h
--- a/tools/libxc/powerpc64/flatdevtree_env.h   Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef _FLATDEVTREE_ENV_H_
-#define _FLATDEVTREE_ENV_H_
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <endian.h>
-#include <errno.h>
-
-#define MAX_PATH_LEN 1024
-
-#define _ALIGN(addr,size)       (((addr)+(size)-1)&(~((size)-1)))
-
-typedef unsigned short u16;
-typedef unsigned int u32;
-typedef unsigned long long u64;
-
-static inline u16 swab16(u16 x)
-{
-       return  (((u16)(x) & (u16)0x00ffU) << 8) |
-                       (((u16)(x) & (u16)0xff00U) >> 8);
-}
-
-static inline u32 swab32(u32 x)
-{
-       return  (((u32)(x) & (u32)0x000000ffUL) << 24) |
-                       (((u32)(x) & (u32)0x0000ff00UL) <<  8) |
-                       (((u32)(x) & (u32)0x00ff0000UL) >>  8) |
-                       (((u32)(x) & (u32)0xff000000UL) >> 24);
-}
-
-static inline u64 swab64(u64 x)
-{
-       return  (u64)(((u64)(x) & (u64)0x00000000000000ffULL) << 56) |
-                       (u64)(((u64)(x) & (u64)0x000000000000ff00ULL) << 40) |
-                       (u64)(((u64)(x) & (u64)0x0000000000ff0000ULL) << 24) |
-                       (u64)(((u64)(x) & (u64)0x00000000ff000000ULL) <<  8) |
-                       (u64)(((u64)(x) & (u64)0x000000ff00000000ULL) >>  8) |
-                       (u64)(((u64)(x) & (u64)0x0000ff0000000000ULL) >> 24) |
-                       (u64)(((u64)(x) & (u64)0x00ff000000000000ULL) >> 40) |
-                       (u64)(((u64)(x) & (u64)0xff00000000000000ULL) >> 56);
-}
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define cpu_to_be16(x) swab16(x)
-#define be16_to_cpu(x) swab16(x)
-#define cpu_to_be32(x) swab32(x)
-#define be32_to_cpu(x) swab32(x)
-#define cpu_to_be64(x) swab64(x)
-#define be64_to_cpu(x) swab64(x)
-#else
-#define cpu_to_be16(x) (x)
-#define be16_to_cpu(x) (x)
-#define cpu_to_be32(x) (x)
-#define be32_to_cpu(x) (x)
-#define cpu_to_be64(x) (x)
-#define be64_to_cpu(x) (x)
-#endif
-
-static inline void ft_exit(int code)
-{
-       exit(code);
-}
-
-static inline void ft_free(void *ptr, int len)
-{
-       free(ptr);
-}
-
-static inline u32 min(u32 a, u32 b)
-{
-       if (a < b)
-               return a;
-       return b;
-}
-
-#endif /* _FLATDEVTREE_ENV_H_ */
diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/powerpc64/mk_flatdevtree.c
--- a/tools/libxc/powerpc64/mk_flatdevtree.c    Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,648 +0,0 @@
-/*
- * 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Copyright IBM Corporation 2007
- *
- * Authors: Ryan Harper <ryanh@xxxxxxxxxx>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <libgen.h>    
-#include <inttypes.h>
-#include <math.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/dir.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-
-#include <xc_private.h> /* for PERROR() */
-#include <xc_dom.h>
-
-#include "mk_flatdevtree.h"
-
-static uint32_t current_phandle = 0;
-
-static uint32_t get_phandle(void)
-{
-   return current_phandle++;
-}
-
-static int readfile(const char *fullpath, void *data, int len)
-{
-    struct stat st;
-    int saved_errno;
-    int rc = -1;
-    int fd;
-   
-    if ((fd = open(fullpath, O_RDONLY)) == -1) {
-        PERROR("%s: failed to open file %s", __func__, fullpath);
-        return -1;
-    }
-
-    if ((rc = fstat(fd, &st)) == -1) {
-        PERROR("%s: failed to stat fd %d", __func__, fd);
-        goto error;
-    }
-
-    if (S_ISREG(st.st_mode))
-        rc = read(fd, data, len); 
-
-    close(fd);
-    return rc;
-
-error:
-    saved_errno = errno;
-    close(fd);
-    errno = saved_errno;
-    return -1;
-}
-
-/* 
- * @property - string to check against the filter list
- * @filter   - NULL terminated list of strings 
- *
- * compare @property string to each string in @filter
- *
- * return 1 if @property matches any filter, otherwise 0
- *
- */
-static int match(const char *property, const char **filter)
-{
-    int i;
-    
-    for (i=0; filter[i] != NULL; i++) {
-        /* compare the filter to property */
-        if (strncmp(property, filter[i], strlen(filter[i])) == 0)
-            return 1;
-    }
-
-    return 0;
-}
-
-/*
- * copy the node at @dirpath filtering out any properties that match in 
@propfilter
- */
-static int copynode(struct ft_cxt *cxt, const char *dirpath, const char 
**propfilter)
-{   
-    struct dirent *tree;
-    struct stat st;
-    DIR *dir;
-    char fullpath[MAX_PATH];
-    char *bname = NULL;
-    char *basec = NULL;
-    int saved_errno;
-
-    if ((dir = opendir(dirpath)) == NULL) {
-        PERROR("%s: failed to open dir %s", __func__, dirpath);
-        return -1;
-    }
-
-    while (1) {
-        if ((tree = readdir(dir)) == NULL)
-            break;  /* reached end of directory entries */
-
-        /* ignore . and .. */
-        if (strcmp(tree->d_name,"." ) == 0 || strcmp(tree->d_name,"..") == 0)
-            continue;
-
-        /* build full path name of the file, for stat() */
-        if (snprintf(fullpath, sizeof(fullpath), "%s/%s", dirpath,
-                     tree->d_name) >= sizeof(fullpath)) {
-            PERROR("%s: failed to build full path", __func__);
-            goto error;
-        }
-
-        /* stat the entry */
-        if (stat(fullpath, &st) < 0) {
-            PERROR("%s: failed to stat file %s", __func__, fullpath);
-            goto error;
-        }
-
-        if (S_ISDIR(st.st_mode)) {
-            /* start a new node for a dir */
-            ft_begin_node(cxt, tree->d_name);
-
-            /* copy everything in this dir */
-            if (copynode(cxt, fullpath, propfilter) < 0) {
-                PERROR("%s: failed to copy node @ %s", __func__, fullpath);
-                goto error;
-            }
-
-            /* end the node */
-            ft_end_node(cxt);
-        }
-        /* add files in dir as properties */
-        else if (S_ISREG(st.st_mode)) {
-
-            if ((basec = strdup(fullpath)) == NULL) {
-                PERROR("%s: failed to dupe string", __func__);
-                goto error;
-            }
-
-            if ((bname = basename(basec)) == NULL) {
-                PERROR("%s: basename() failed", __func__);
-                goto error;
-            }
-
-            /* only add files that don't match the property filter string */
-            if (!match(bname, propfilter)) {
-                char data[BUFSIZE];
-                int len;
-
-                /* snarf the data and push into the property */
-                if ((len = readfile(fullpath, data, sizeof(data))) < 0) {
-                    PERROR("%s: failed to read data from file %s", __func__,
-                                                                   fullpath);
-                    goto error;
-                }
-                ft_prop(cxt, tree->d_name, data, len);
-
-            }
-
-            /* strdup mallocs memory */
-            if (basec != NULL ) {
-                free(basec);
-                basec = NULL;
-            }
-
-        }
-    }
-
-    closedir(dir);
-    return 0;
-
-error:
-    saved_errno = errno;
-
-    /* strdup mallocs memory */
-    if (basec != NULL ) {
-        free(basec);
-        basec = NULL;
-    }
-
-    closedir(dir);
-
-    errno = saved_errno;
-    return -1;
-}
-
-static int find_cpu0(char *cpupath, int len)
-{   
-    const char path[] = "/proc/device-tree/cpus";
-    const char device[] = "device_type";
-    const char dev_cpu[] = "cpu";
-    const char reg[] = "reg";
-    char data[sizeof(dev_cpu)];
-    char prop[MAX_PATH];
-    char node[MAX_PATH];
-    struct dirent *tree;
-    struct stat st;
-    DIR* dir;
-    int saved_errno;
-    int found = 0;
-
-    if ((dir = opendir(path)) == NULL) {
-        PERROR("%s: failed to open directory %s", __func__, path);
-        return -1;
-    }    
-
-    while (!found) {
-
-        if ((tree = readdir(dir)) == NULL)
-            break;  /* reached end of directory entries */
-
-        /* ignore ., .. */
-        if (strcmp(tree->d_name,"." ) == 0 || strcmp(tree->d_name,"..") == 0)
-            continue;
-
-        /* build full path name of the file, for stat() */
-        if (snprintf(node, sizeof(node), "%s/%s", path,
-                     tree->d_name) >= sizeof(node)) {
-            PERROR("%s: failed to concat strings", __func__);
-            goto error;
-        }
-
-        /* stat the entry */
-        if (stat(node, &st) < 0) {
-            PERROR("%s: failed to stat file %s", __func__, node);
-            /* something funny happen in /proc/device-tree, but march onward */
-            continue;
-        }
-
-        /* for each dir, check the device_type property until we find 'cpu'*/
-        if (S_ISDIR(st.st_mode)) {
-
-            /* construct path to device_type */
-            if (snprintf(prop, sizeof(prop), "%s/%s", node,
-                         device) >= sizeof(prop)) {
-                PERROR("%s: failed to concat strings", __func__);
-                goto error;
-            }
-
-            /* read device_type into buffer */
-            if ((readfile(prop, data, sizeof(data))) < 0) {
-                PERROR("%s: failed to read data from file %s", __func__, prop);
-                goto error;
-            }
-
-            /* if the device_type is 'cpu',  and reg is 0 
-             * return the path where we found it */
-            if (strcmp(data, "cpu") == 0) {
-
-                /* construct path to reg */
-                if (snprintf(prop, sizeof(prop), "%s/%s", node,
-                             reg) >= sizeof(prop)) {
-                    PERROR("%s: failed to concat strings", __func__);
-                    goto error;
-                }
-
-                /* using data buffer since reg and device_type values have 
same size */
-                if ((readfile(prop, data, sizeof(data))) < 0) {
-                    PERROR("%s: failed to read data from file %s", __func__, 
prop);
-                    goto error;
-                }
-
-                /* now check property "reg" for value 0 */
-                if ((u32)*data == 0) {
-                    if (snprintf(cpupath, len, "%s", node) >= len) {
-                        PERROR("%s: failed to copy cpupath", __func__);
-                        goto error;
-                    }
-                    found = 1;
-                }
-            }
-        }
-    }
-
-    closedir(dir);
-    return found;
-
-error:
-    saved_errno = errno;
-    closedir(dir);
-    errno = saved_errno;
-    return -1;
-}
-
-void free_devtree(struct ft_cxt *root)
-{
-    if ((root != NULL) && root->bph != NULL) {
-        free(root->bph);
-        root->bph = NULL;
-    }
-}
-
-int make_devtree(struct ft_cxt *root,
-                 struct xc_dom_image *dom,
-                 unsigned long shadow_mb)
-{
-    struct boot_param_header *bph = NULL;
-    uint64_t val[2];
-    uint32_t val32[2];
-    uint64_t shared_info_paddr = dom->shared_info_pfn << PAGE_SHIFT;
-    uint64_t xenstore_paddr = dom->xenstore_pfn << PAGE_SHIFT;
-    uint64_t console_paddr = dom->console_pfn << PAGE_SHIFT;
-    long remaining;
-    unsigned long ramdisk_start;
-    unsigned long ramdisk_size;
-    unsigned long rma_bytes = 1 << dom->realmodearea_log;
-    int64_t shadow_mb_log;
-    uint64_t pft_size;
-    char cpupath[MAX_PATH];
-    const char *propfilter[] = { "ibm", "linux,", NULL };
-    char *cpupath_copy = NULL;
-    char *cpuname = NULL;
-    int saved_errno;
-    int dtb_fd = -1;
-    uint32_t cpu0_phandle = get_phandle();
-    uint32_t xen_phandle = get_phandle();
-    uint32_t rma_phandle = get_phandle();
-
-    /* initialize bph to prevent double free on error path */
-    root->bph = NULL;
-
-    /* carve out space for bph */
-    if ((bph = (struct boot_param_header *)malloc(BPH_SIZE)) == NULL) {
-        PERROR("%s: Failed to malloc bph buffer size", __func__);
-        goto error;
-    }
-
-    /* NB: struct ft_cxt root defined at top of file */
-    /* root = Tree() */
-    ft_begin(root, bph, BPH_SIZE);
-
-    /* you MUST set reservations BEFORE _starting_the_tree_ */
-
-    /* reserve shared_info_t page */
-    if (shared_info_paddr) {
-        val[0] = cpu_to_be64((u64) shared_info_paddr);
-        val[1] = cpu_to_be64((u64) PAGE_SIZE);
-        ft_add_rsvmap(root, val[0], val[1]);
-    }
-
-    /* reserve console page for domU */
-    if (console_paddr) {
-        val[0] = cpu_to_be64((u64) console_paddr);
-        val[1] = cpu_to_be64((u64) PAGE_SIZE);
-        ft_add_rsvmap(root, val[0], val[1]);
-    }
-
-    /* reserve xen store page for domU */
-    if (xenstore_paddr) {
-        val[0] = cpu_to_be64((u64) xenstore_paddr);
-        val[1] = cpu_to_be64((u64) PAGE_SIZE);
-        ft_add_rsvmap(root, val[0], val[1]);
-    }
-
-    /* reserve space for initrd if needed */
-    ramdisk_start = dom->ramdisk_seg.pfn << PAGE_SHIFT;
-    ramdisk_size = dom->ramdisk_seg.vend - dom->ramdisk_seg.vstart;
-    if (ramdisk_size > 0) {
-        val[0] = cpu_to_be64((u64) ramdisk_start);
-        val[1] = cpu_to_be64((u64) ramdisk_size);
-        ft_add_rsvmap(root, val[0], val[1]);
-    }
-
-    /* NB: ft_add_rsvmap() already terminates with a NULL reservation for us */
-
-    /* done with reservations, _starting_the_tree_ */
-    ft_begin_tree(root);
-
-    /* make root node */
-    ft_begin_node(root, "");
-
-    /* root.addprop('device_type', 'chrp-but-not-really\0') */
-    ft_prop_str(root, "device_type", "chrp-but-not-really");
-
-    /* root.addprop('#size-cells', 2) */
-    ft_prop_int(root, "#size-cells", 2);
-
-    /* root.addprop('#address-cells', 2) */
-    ft_prop_int(root, "#address-cells", 2);
-
-    /* root.addprop('model', 'Momentum,Maple-D\0') */
-    ft_prop_str(root, "model", "Momentum,Maple-D");
-
-    /* root.addprop('compatible', 'Momentum,Maple\0') */
-    ft_prop_str(root, "compatible", "Momentum,Maple");
-
-    /* start chosen node */
-    ft_begin_node(root, "chosen");
-
-    /* chosen.addprop('cpu', cpu0.get_phandle()) */
-    ft_prop_int(root, "cpu", cpu0_phandle);
-
-    /* chosen.addprop('rma', rma.get_phandle()) */
-    ft_prop_int(root, "memory", rma_phandle);
-
-    /* chosen.addprop('linux,stdout-path', '/xen/console\0') */
-    ft_prop_str(root, "linux,stdout-path", "/xen/console");
-
-    /* chosen.addprop('interrupt-controller, xen.get_phandle()) */
-    ft_prop_int(root, "interrupt-controller", xen_phandle);
-
-    /* chosen.addprop('bootargs', imghandler.cmdline + '\0') */
-    if (dom->cmdline != NULL)
-        ft_prop_str(root, "bootargs", dom->cmdline);
-
-    /* mark where the initrd is, if present */
-    if (ramdisk_size > 0) {
-        val[0] = cpu_to_be64((u64) ramdisk_start);
-        val[1] = cpu_to_be64((u64) ramdisk_start + ramdisk_size);
-        ft_prop(root, "linux,initrd-start", &(val[0]), sizeof(val[0]));
-        ft_prop(root, "linux,initrd-end", &(val[1]), sizeof(val[1]));
-    }
-
-    /* end chosen node */
-    ft_end_node(root);
-
-    /* xen = root.addnode('xen') */
-    ft_begin_node(root, "xen");
-
-    /*  xen.addprop('version', 'Xen-3.0-unstable\0') */
-    ft_prop_str(root, "compatible", "Xen-3.0-unstable");
-
-    /* xen.addprop('reg', long(imghandler.vm.domid), long(0)) */
-    val[0] = cpu_to_be64((u64) dom->guest_domid);
-    val[1] = cpu_to_be64((u64) 0);
-    ft_prop(root, "reg", val, sizeof(val));
-
-    /* point to shared_info_t page base addr */
-    val[0] = cpu_to_be64((u64) shared_info_paddr);
-    val[1] = cpu_to_be64((u64) PAGE_SIZE);
-    ft_prop(root, "shared-info", val, sizeof(val));
-
-    /* xen.addprop('domain-name', imghandler.vm.getName() + '\0') */
-    /* libxc doesn't know the domain name, that is purely a xend thing */
-    /* ft_prop_str(root, "domain-name", domain_name); */
-
-    /* add xen/linux,phandle for chosen/interrupt-controller */
-    ft_prop_int(root, "linux,phandle", xen_phandle);
-
-    if (console_paddr != 0) {
-        /* xencons = xen.addnode('console') */
-        ft_begin_node(root, "console");
-
-        /* console_paddr */
-        val[0] = cpu_to_be64((u64) console_paddr);
-        val[1] = cpu_to_be64((u64) PAGE_SIZE);
-        ft_prop(root, "reg", val, sizeof(val));
-
-        /* xencons.addprop('interrupts', console_evtchn, 0) */
-        val32[0] = cpu_to_be32((u32) dom->console_evtchn);
-        val32[1] = cpu_to_be32((u32) 0);
-        ft_prop(root, "interrupts", val32, sizeof(val32));
-
-        /* end of console */
-        ft_end_node(root);
-    }
-
-    if (xenstore_paddr != 0) {
-        /* start store node */
-        ft_begin_node(root, "store");
-
-        /* store paddr */
-        val[0] = cpu_to_be64((u64) xenstore_paddr);
-        val[1] = cpu_to_be64((u64) PAGE_SIZE);
-        ft_prop(root, "reg", val, sizeof(val));
-
-        /* store event channel */
-        val32[0] = cpu_to_be32((u32) dom->xenstore_evtchn);
-        val32[1] = cpu_to_be32((u32) 0);
-        ft_prop(root, "interrupts", val32, sizeof(val32));
-
-        /* end of store */
-        ft_end_node(root);
-    }
-
-    /* end of xen node */
-    ft_end_node(root);
-
-    /* rma = root.addnode('memory@0') */
-    ft_begin_node(root, "memory@0");
-
-    /* rma.addprop('reg', long(0), long(rma_bytes)) */
-    val[0] = cpu_to_be64((u64) 0);
-    val[1] = cpu_to_be64((u64) rma_bytes);
-    ft_prop(root, "reg", val, sizeof(val));
-
-    /* rma.addprop('device_type', 'memory\0') */
-    ft_prop_str(root, "device_type", "memory");
-
-    /* add linux,phandle for chosen/rma node */
-    ft_prop_int(root, "linux,phandle", rma_phandle);
-
-    /* end of memory@0 */
-    ft_end_node(root);
-
-    /* calculate remaining bytes from total - rma size */
-    remaining = (dom->total_pages << PAGE_SHIFT) - rma_bytes;
-
-    /* memory@<rma_bytes> is all remaining memory after RMA */
-    if (remaining > 0)
-    {
-        char mem[MAX_PATH];
-        
-        if (snprintf(mem, sizeof(mem), "memory@%lx",
-                     rma_bytes) >= sizeof(mem)) {
-            PERROR("%s: failed to build memory string", __func__);
-            goto error;
-        }
-
-        /* memory@<rma_bytes> is all remaining memory after RMA */
-        ft_begin_node(root, mem);
-
-        /* mem.addprop('reg', long(rma_bytes), long(remaining)) */
-        val[0] = cpu_to_be64((u64) rma_bytes);
-        val[1] = cpu_to_be64((u64) remaining);
-        ft_prop(root, "reg", val, sizeof(val));
-
-        /* mem.addprop('device_type', 'memory\0') */
-        ft_prop_str(root, "device_type", "memory");
-
-        /* end memory@<rma_bytes> node */
-        ft_end_node(root);
-    }
-
-    /* add CPU nodes */
-    /* cpus = root.addnode('cpus') */
-    ft_begin_node(root, "cpus");
-
-    /* cpus.addprop('smp-enabled') */
-    ft_prop(root, "smp-enabled", NULL, 0);
-
-    /* cpus.addprop('#size-cells', 0) */
-    ft_prop_int(root, "#size-cells", 0);
-
-    /* cpus.addprop('#address-cells', 1) */
-    ft_prop_int(root, "#address-cells", 1);
-
-    /*
-     * Copy all properties the system firmware gave us from a 
-     * CPU node in the device tree.
-     */
-    if (find_cpu0(cpupath, sizeof(cpupath)) <= 0) {
-        PERROR("%s: failed find cpu0 node in host devtree", __func__);
-        goto error;
-    }
-
-    /* get the basename from path to cpu device */
-    if ((cpupath_copy = strdup(cpupath)) == NULL) {
-        PERROR("%s: failed to dupe string", __func__);
-        goto error;
-    }
-    if ((cpuname = basename(cpupath_copy)) == NULL) {
-        PERROR("%s: basename() failed", __func__);
-        goto error;
-    }
-     
-    /* start node for the cpu */
-    ft_begin_node(root, cpuname);
-
-    /* strdup() mallocs memory */
-    if ( cpupath_copy != NULL ) {
-        free(cpupath_copy);
-        cpupath_copy = NULL;
-    }
-
-    /* copy over most properties from host tree for cpu */
-    if (copynode(root, cpupath, propfilter) < 0) {
-        PERROR("%s: failed to copy node", __func__);
-            goto error;
-    }
-
-    /* calculate the pft-size */
-    shadow_mb_log = (int)log2((double)shadow_mb);
-    pft_size = shadow_mb_log + 20;
-
-    val32[0] = cpu_to_be32((u32) 0);
-    val32[1] = cpu_to_be32((u32) pft_size);
-    ft_prop(root, "ibm,pft-size", val32, sizeof(val32));
-
-    /* make phandle for cpu0 */
-    ft_prop_int(root, "linux,phandle", cpu0_phandle);
-
-    /* end <cpuname> node */
-    ft_end_node(root);
-
-    /* end cpus node */
-    ft_end_node(root);
-
-    /* end root node */
-    ft_end_node(root);
-
-    /* end of the tree */
-    if (ft_end_tree(root) != 0) {
-        PERROR("%s: failed to end tree", __func__);
-        goto error;
-    }
-
-    /* write a copy of the tree to a file */
-    if ((dtb_fd = creat(DTB_FILE, S_IRUSR | S_IWUSR)) == -1) {
-        PERROR("%s: failed to open file %s", __func__, DTB_FILE);
-        goto error;
-    }
-
-    if (write(dtb_fd, (const void *)bph, bph->totalsize) != bph->totalsize) {
-        PERROR("%s: failed to write blob to file", __func__);
-        goto error; 
-    }
-
-    return 0;
- 
-error:
-    saved_errno = errno;
-
-    /* strdup() mallocs memory */
-    if ( cpupath_copy != NULL ) {
-        free(cpupath_copy);
-        cpupath_copy = NULL;
-    }
-
-    /* free bph buffer */
-    free_devtree(root);
-
-    if (dtb_fd)
-        close(dtb_fd);
-
-    errno = saved_errno;
-    return -1;
-}
diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/powerpc64/mk_flatdevtree.h
--- a/tools/libxc/powerpc64/mk_flatdevtree.h    Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Copyright IBM Corporation 2007
- *
- * Authors: Ryan Harper <ryanh@xxxxxxxxxx>
- */
-
-#ifndef MK_FLATDEVTREE_H
-#define MK_FLATDEVTREE_H
-
-#include "flatdevtree_env.h"
-#include "flatdevtree.h"
-
-extern void free_devtree(struct ft_cxt *root);
-extern int make_devtree(struct ft_cxt *root,
-                        struct xc_dom_image *dom,
-                        unsigned long shadow_mb);
-
-#define MAX_PATH 200
-#define BUFSIZE 1024
-#define BPH_SIZE 16*1024
-#define DTB_FILE "/tmp/domU.dtb"
-
-#endif /* MK_FLATDEVTREE_H */
diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/powerpc64/xc_memory.c
--- a/tools/libxc/powerpc64/xc_memory.c Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Copyright (C) IBM Corporation 2006
- *
- * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
- */
-
-#include "xc_private.h"
-#include <xen/domctl.h>
-
-int xc_alloc_real_mode_area(int xc_handle,
-                            uint32_t domain,
-                            unsigned int log)
-{
-    DECLARE_DOMCTL;
-    int err;
-
-    domctl.cmd = XEN_DOMCTL_real_mode_area;
-    domctl.domain = (domid_t)domain;
-    domctl.u.real_mode_area.log = log;
-
-    err = do_domctl(xc_handle, &domctl);
-
-    if (err)
-        DPRINTF("Failed real mode area allocation for dom %u (log %u)\n",
-                domain, log);
-
-    return err;
-}
diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/xc_core.h
--- a/tools/libxc/xc_core.h     Thu May 08 13:15:45 2008 +0100
+++ b/tools/libxc/xc_core.h     Thu May 08 13:40:40 2008 +0100
@@ -148,8 +148,6 @@ int xc_core_arch_map_p2m(int xc_handle, 
 # include "xc_core_x86.h"
 #elif defined (__ia64__)
 # include "xc_core_ia64.h"
-#elif defined (__powerpc__)
-# include "xc_core_powerpc.h"
 #else
 # error "unsupported architecture"
 #endif
diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/xc_core_powerpc.c
--- a/tools/libxc/xc_core_powerpc.c     Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * 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 (c) 2007 Isaku Yamahata <yamahata at valinux co jp>
- *                    VA Linux Systems Japan K.K.
- * Copyright IBM Corp. 2007
- *
- * Authors: Isaku Yamahata <yamahata at valinux co jp>
- *          Hollis Blanchard <hollisb@xxxxxxxxxx>
- *
- */
-
-#include "xg_private.h"
-#include "xc_core.h"
-
-int
-xc_core_arch_auto_translated_physmap(const xc_dominfo_t *info)
-{
-       /* All PowerPC domU are autotranslated. */
-       return 1;
-}
-
-int
-xc_core_arch_map_p2m(int xc_handle, xc_dominfo_t *info,
-                     shared_info_t *live_shinfo, xen_pfn_t **live_p2m,
-                     unsigned long *pfnp)
-{
-       /* All PowerPC domU are autotranslated. */
-    errno = ENOSYS;
-    return -1;
-}
-
-int
-xc_core_arch_memory_map_get(int xc_handle, struct xc_core_arch_context *unused,
-                            xc_dominfo_t *info, shared_info_t *live_shinfo,
-                            xc_core_memory_map_t **mapp,
-                            unsigned int *nr_entries)
-{
-    xc_core_memory_map_t *map = NULL;
-
-    map = malloc(sizeof(*map));
-    if (!map) {
-        PERROR("Could not allocate memory");
-        goto out;
-    }
-
-    map->addr = 0;
-    map->size = info->max_memkb * 1024;
-
-    *mapp = map;
-    *nr_entries = 1;
-    return 0;
-
-out:
-    free(map);
-    return -1;
-}
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/xc_core_powerpc.h
--- a/tools/libxc/xc_core_powerpc.h     Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * 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 (c) 2007 Isaku Yamahata <yamahata at valinux co jp>
- *                    VA Linux Systems Japan K.K.
- *
- */
-
-#ifndef XC_CORE_POWERPC_H
-#define XC_CORE_POWERPC_H
-
-#define ELF_ARCH_DATA           ELFDATA2MSB
-#define ELF_ARCH_MACHINE        EM_PPC64
-
-struct xc_core_arch_context {
-    /* nothing */
-};
-
-#define xc_core_arch_context_init(arch_ctxt)            do {} while (0)
-#define xc_core_arch_context_free(arch_ctxt)            do {} while (0)
-#define xc_core_arch_context_get(arch_ctxt, ctxt, xc_handle, domid) \
-                                                                (0)
-#define xc_core_arch_context_dump(arch_ctxt, args, dump_rtn)    (0)
-#define xc_core_arch_gpfn_may_present(arch_ctxt, i)             (1)
-
-static inline int
-xc_core_arch_context_get_shdr(struct xc_core_arch_context *arch_ctxt, 
-                              struct xc_core_section_headers *sheaders,
-                              struct xc_core_strtab *strtab,
-                              uint64_t *filesz, uint64_t offset)
-{
-    *filesz = 0;
-    return 0;
-}
-
-#endif /* XC_CORE_POWERPC_H */
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/xc_dom_elfloader.c
--- a/tools/libxc/xc_dom_elfloader.c    Thu May 08 13:15:45 2008 +0100
+++ b/tools/libxc/xc_dom_elfloader.c    Thu May 08 13:40:40 2008 +0100
@@ -43,8 +43,6 @@ static char *xc_dom_guest_type(struct xc
         return "xen-3.0-x86_64";
     case EM_IA_64:
         return elf_msb(elf) ? "xen-3.0-ia64be" : "xen-3.0-ia64";
-    case EM_PPC64:
-        return "xen-3.0-powerpc64";
     default:
         return "xen-3.0-unknown";
     }
diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/xc_dom_powerpc.c
--- a/tools/libxc/xc_dom_powerpc.c      Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,236 +0,0 @@
-/*
- * Xen domain builder -- powerpc bits.
- *
- * Most architecture-specific code for powerpc goes here.
- *
- * This code is licenced under the GPL.
- * written 2006 by Gerd Hoffmann <kraxel@xxxxxxx>.
- *
- * Copyright IBM Corp. 2007
- *
- * Authors: Gerd Hoffmann <kraxel@xxxxxxx>
- *          Hollis Blanchard <hollisb@xxxxxxxxxx>
- *
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include <xen/xen.h>
-
-#include "xg_private.h"
-#include "xc_dom.h"
-#include "powerpc64/flatdevtree.h"
-#include "powerpc64/mk_flatdevtree.h"
-
-#define RMA_LOG 26 /* 64 MB */
-#define EXTENT_LOG 24 /* 16 MB */
-#define EXTENT_ORDER (EXTENT_LOG - PAGE_SHIFT)
-
-/* ------------------------------------------------------------------------ */
-
-static int alloc_magic_pages(struct xc_dom_image *dom)
-{
-    struct ft_cxt devtree;
-    void *guest_devtree;
-    unsigned long shadow_mb;
-    int rma_pages;
-    int rc;
-
-    /* Allocate special pages from the end of the RMA. */
-    rma_pages = 1 << (dom->realmodearea_log - PAGE_SHIFT);
-    dom->shared_info_pfn = --rma_pages;
-    dom->console_pfn = --rma_pages;
-    dom->xenstore_pfn = --rma_pages;
-
-    /* Gather shadow allocation info for the device tree. */
-    rc = xc_shadow_control(dom->guest_xc, dom->guest_domid,
-                           XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION, NULL, 0, 
-                           &shadow_mb, 0, NULL);
-    if (rc < 0 || shadow_mb == 0) {
-        xc_dom_printf("Couldn't get shadow allocation size or it was 0.\n");
-        return rc;
-    }
-
-    /* Build device tree. */
-    rc = make_devtree(&devtree, dom, shadow_mb);
-    if (rc < 0) {
-        xc_dom_printf("Failed to create flattened device tree.\n");
-        return rc;
-    }
-
-    /* Find a spot for it. */
-    rc = xc_dom_alloc_segment(dom, &dom->devicetree_seg, "devtree", 0,
-                              devtree.bph->totalsize);
-    if (rc)
-        goto out;
-
-    /* Copy the device tree into place. */
-    guest_devtree = xc_dom_seg_to_ptr(dom, &dom->devicetree_seg);
-    if (!guest_devtree) {
-        xc_dom_printf("Couldn't map guest memory for device tree.\n");
-        rc = -1;
-        goto out;
-    }
-    memcpy(guest_devtree, devtree.bph, devtree.bph->totalsize);
-
-out:
-    free_devtree(&devtree);
-    return rc;
-}
-
-static int shared_info(struct xc_dom_image *dom, void *ptr)
-{
-    shared_info_t *shared_info = ptr;
-
-    xc_dom_printf("%s: called\n", __FUNCTION__);
-
-    memset(shared_info, 0, sizeof(*shared_info));
-    return 0;
-}
-
-static int vcpu(struct xc_dom_image *dom, void *ptr)
-{
-    vcpu_guest_context_t *ctxt = ptr;
-
-    memset(ctxt, 0x55, sizeof(*ctxt));
-    ctxt->user_regs.pc = dom->parms.virt_entry;
-    ctxt->user_regs.msr = 0;
-    ctxt->user_regs.gprs[1] = 0; /* Linux uses its own stack */
-    ctxt->user_regs.gprs[3] = dom->devicetree_seg.pfn << PAGE_SHIFT;
-    ctxt->user_regs.gprs[4] = dom->kernel_seg.pfn << PAGE_SHIFT;
-    ctxt->user_regs.gprs[5] = 0;
-
-    /* There is a buggy kernel that does not zero the "local_paca", so
-     * we must make sure this register is 0 */
-    ctxt->user_regs.gprs[13] = 0;
-
-    xc_dom_printf("%s: initial vcpu:\n", __FUNCTION__);
-    xc_dom_printf("  pc 0x%016"PRIx64", msr 0x%016"PRIx64"\n"
-                  "  r1-5 %016"PRIx64" %016"PRIx64" %016"PRIx64" %016"PRIx64
-                  " %016"PRIx64"\n",
-                  ctxt->user_regs.pc, ctxt->user_regs.msr,
-                  ctxt->user_regs.gprs[1],
-                  ctxt->user_regs.gprs[2],
-                  ctxt->user_regs.gprs[3],
-                  ctxt->user_regs.gprs[4],
-                  ctxt->user_regs.gprs[5]);
-
-    return 0;
-}
-
-/* ------------------------------------------------------------------------ */
-
-static struct xc_dom_arch xc_dom_arch = {
-    .guest_type = "xen-3.0-powerpc64",
-    .page_shift = PAGE_SHIFT,
-    .alloc_magic_pages = alloc_magic_pages,
-    .shared_info = shared_info,
-    .vcpu = vcpu,
-};
-
-static void __init register_arch_hooks(void)
-{
-    xc_dom_register_arch_hooks(&xc_dom_arch);
-}
-
-int arch_setup_meminit(struct xc_dom_image *dom)
-{
-    xen_pfn_t *extent_list;
-    unsigned long total_mem = dom->total_pages << PAGE_SHIFT;
-    unsigned long rma_bytes;
-    unsigned long rma_nr_pages;
-    unsigned long nr_extents;
-    int rc = 0;
-    int i;
-
-    /* XXX RMA size is processor-dependent. */
-    dom->realmodearea_log = RMA_LOG;
-    rma_bytes = 1 << dom->realmodearea_log;
-    rma_nr_pages = rma_bytes >> PAGE_SHIFT;
-
-    xc_dom_printf("dom%u memory: %lu MB RMA, %lu MB additional.\n",
-            dom->guest_domid, rma_bytes >> 20, (total_mem - rma_bytes) >> 20);
-
-    if (total_mem < rma_bytes) {
-        xc_dom_printf("Domain must have at least %lu MB\n", rma_bytes >> 20);
-        return -EINVAL;
-    }
-
-    /* Allocate the first chunk of memory. */
-    rc = xc_alloc_real_mode_area(dom->guest_xc, dom->guest_domid,
-                                 dom->realmodearea_log);
-    if (rc) {
-        xc_dom_printf("Failed to allocate real mode area.\n");
-        return rc;
-    }
-
-    /* Allocate p2m map. */
-    dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages);
-    if (dom->p2m_host == NULL) {
-        xc_dom_printf("Couldn't allocate p2m map.\n");
-        return -ENOMEM;
-    }
-
-    nr_extents = (dom->total_pages - rma_nr_pages) >> EXTENT_ORDER;
-    if (nr_extents) {
-        /* Allocate extent list for populate_physmap() call. */
-        extent_list = xc_dom_malloc(dom, sizeof(xen_pfn_t) * nr_extents);
-        if (extent_list == NULL) {
-            xc_dom_printf("Couldn't allocate extent list.\n");
-            return -ENOMEM;
-        }
-
-        /* Allocate the remaining (non-RMA) memory. */
-        for (i = 0; i < nr_extents; i++) {
-            /* Use PFNs above the RMA memory we already allocated. */
-            extent_list[i] = rma_nr_pages + i * (1<<EXTENT_ORDER);
-        }
-        rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
-                                               nr_extents, EXTENT_ORDER, 0,
-                                               extent_list);
-        if (rc < 0) {
-            xc_dom_printf("populate_physmap(0x%lx extents order %u) -> 0x%x\n",
-                          nr_extents, EXTENT_ORDER, rc);
-            return rc;
-        }
-    }
-
-    /* Populate the p2m map. */
-    rc = xc_get_pfn_list(dom->guest_xc, dom->guest_domid, dom->p2m_host,
-                         dom->total_pages);
-    if (rc < 0) {
-        xc_dom_printf("Couldn't get p2m translation.\n");
-        return rc;
-    }
-
-    xc_dom_printf("%s: success\n", __func__);
-
-    return 0;
-}
-
-int arch_setup_bootearly(struct xc_dom_image *dom)
-{
-    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
-    return 0;
-}
-
-int arch_setup_bootlate(struct xc_dom_image *dom)
-{
-    unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
-    shared_info_t *shared_info;
-
-    /* setup shared_info page */
-    xc_dom_printf("%s: shared_info: mfn 0x%" PRIpfn "\n",
-                  __FUNCTION__, dom->shared_info_mfn);
-    shared_info = xc_map_foreign_range(dom->guest_xc, dom->guest_domid,
-                                       page_size,
-                                       PROT_READ | PROT_WRITE,
-                                       dom->shared_info_mfn);
-    if ( shared_info == NULL )
-        return -1;
-    dom->arch_hooks->shared_info(dom, shared_info);
-    munmap(shared_info, page_size);
-    return 0;
-}
diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Thu May 08 13:15:45 2008 +0100
+++ b/tools/libxc/xenctrl.h     Thu May 08 13:40:40 2008 +0100
@@ -55,10 +55,6 @@
 #define xen_mb()   asm volatile ("mf" ::: "memory")
 #define xen_rmb()  asm volatile ("mf" ::: "memory")
 #define xen_wmb()  asm volatile ("mf" ::: "memory")
-#elif defined(__powerpc__)
-#define xen_mb()   asm volatile ("sync" : : : "memory")
-#define xen_rmb()  asm volatile ("sync" : : : "memory") /* lwsync? */
-#define xen_wmb()  asm volatile ("sync" : : : "memory") /* eieio? */
 #else
 #error "Define barriers"
 #endif
@@ -944,11 +940,6 @@ int xc_set_hvm_param(int handle, domid_t
 int xc_set_hvm_param(int handle, domid_t dom, int param, unsigned long value);
 int xc_get_hvm_param(int handle, domid_t dom, int param, unsigned long *value);
 
-/* PowerPC specific. */
-int xc_alloc_real_mode_area(int xc_handle,
-                            uint32_t domid,
-                            unsigned int log);
-
 /* IA64 specific, nvram save */
 int xc_ia64_save_to_nvram(int xc_handle, uint32_t dom);
 
diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/xenguest.h
--- a/tools/libxc/xenguest.h    Thu May 08 13:15:45 2008 +0100
+++ b/tools/libxc/xenguest.h    Thu May 08 13:40:40 2008 +0100
@@ -136,18 +136,4 @@ int xc_hvm_build_mem(int xc_handle,
                      const char *image_buffer,
                      unsigned long image_size);
 
-/* PowerPC specific. */
-int xc_prose_build(int xc_handle,
-                   uint32_t domid,
-                   unsigned int mem_mb,
-                   const char *image_name,
-                   const char *ramdisk_name,
-                   const char *cmdline,
-                   const char *features,
-                   unsigned long flags,
-                   unsigned int store_evtchn,
-                   unsigned long *store_mfn,
-                   unsigned int console_evtchn,
-                   unsigned long *console_mfn);
-
 #endif /* XENGUEST_H */
diff -r 0ac957f9d42e -r b0d7780794eb tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Thu May 08 13:15:45 2008 +0100
+++ b/tools/python/xen/lowlevel/xc/xc.c Thu May 08 13:40:40 2008 +0100
@@ -1350,28 +1350,6 @@ static PyObject *dom_op(XcObject *self, 
     return zero;
 }
 
-#ifdef __powerpc__
-static PyObject *pyxc_alloc_real_mode_area(XcObject *self,
-                                           PyObject *args,
-                                           PyObject *kwds)
-{
-    uint32_t dom;
-    unsigned int log;
-
-    static char *kwd_list[] = { "dom", "log", NULL };
-
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, 
-                                      &dom, &log) )
-        return NULL;
-
-    if ( xc_alloc_real_mode_area(self->xc_handle, dom, log) )
-        return pyxc_error_to_exception();
-
-    Py_INCREF(zero);
-    return zero;
-}
-#endif /* powerpc */
-
 static PyMethodDef pyxc_methods[] = {
     { "handle",
       (PyCFunction)pyxc_handle,
@@ -1759,16 +1737,6 @@ static PyMethodDef pyxc_methods[] = {
       "Inject debug keys into Xen.\n"
       " keys    [str]: String of keys to inject.\n" },
 
-#ifdef __powerpc__
-    { "arch_alloc_real_mode_area", 
-      (PyCFunction)pyxc_alloc_real_mode_area, 
-      METH_VARARGS | METH_KEYWORDS, "\n"
-      "Allocate a domain's real mode area.\n"
-      " dom [int]: Identifier of domain.\n"
-      " log [int]: Specifies the area's size.\n"
-      "Returns: [int] 0 on success; -1 on error.\n" },
-#endif /* __powerpc */
-  
 #if defined(__i386__) || defined(__x86_64__)
     { "domain_check_cpuid", 
       (PyCFunction)pyxc_dom_check_cpuid, 
diff -r 0ac957f9d42e -r b0d7780794eb tools/python/xen/xend/arch.py
--- a/tools/python/xen/xend/arch.py     Thu May 08 13:15:45 2008 +0100
+++ b/tools/python/xen/xend/arch.py     Thu May 08 13:40:40 2008 +0100
@@ -28,7 +28,5 @@ _types = {
     "amd64": "x86",
     "i86pc": "x86",
     "ia64": "ia64",
-    "ppc": "powerpc",
-    "ppc64": "powerpc",
 }
 type = _types.get(os.uname()[4], "unknown")
diff -r 0ac957f9d42e -r b0d7780794eb tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Thu May 08 13:15:45 2008 +0100
+++ b/tools/python/xen/xend/image.py    Thu May 08 13:40:40 2008 +0100
@@ -506,20 +506,6 @@ class LinuxImageHandler(ImageHandler):
         return args
 
 
-class PPC_LinuxImageHandler(LinuxImageHandler):
-
-    ostype = "linux"
-    
-    def getRequiredShadowMemory(self, shadow_mem_kb, maxmem_kb):
-        """@param shadow_mem_kb The configured shadow memory, in KiB.
-        @param maxmem_kb The configured maxmem, in KiB.
-        @return The corresponding required amount of shadow memory, also in
-        KiB.
-        PowerPC currently uses "shadow memory" to refer to the hash table."""
-        return max(maxmem_kb / 64, shadow_mem_kb)
-
-
-
 class HVMImageHandler(ImageHandler):
 
     ostype = "hvm"
@@ -783,9 +769,6 @@ class X86_Linux_ImageHandler(LinuxImageH
         return LinuxImageHandler.buildDomain(self)
 
 _handlers = {
-    "powerpc": {
-        "linux": PPC_LinuxImageHandler,
-    },
     "ia64": {
         "linux": IA64_Linux_ImageHandler,
         "hvm": IA64_HVM_ImageHandler,
diff -r 0ac957f9d42e -r b0d7780794eb tools/xm-test/lib/XmTestLib/arch.py
--- a/tools/xm-test/lib/XmTestLib/arch.py       Thu May 08 13:15:45 2008 +0100
+++ b/tools/xm-test/lib/XmTestLib/arch.py       Thu May 08 13:40:40 2008 +0100
@@ -88,39 +88,6 @@ ia_HVMDefaults =      {"memory"       : 
 }
 # End  : Intel ia32 and ia64 as well as AMD 32-bit and 64-bit processors
 
-# Begin: PowerPC
-def ppc_checkBuffer(buffer):
-    checks = [
-        {"pattern" : re.compile("^\d+:mon>\s*$", re.MULTILINE),
-         "message" : "domain trapped into XMON"},
-    ]
-
-    for i in range(0, len(checks)):
-        check=checks[i]
-        if check.get('pattern').search(buffer):
-            FAIL(check.get('message'))
-
-    return
-
-def ppc_minSafeMem():
-    return 64
-
-def ppc_getDefaultKernel():
-    """Get the path to the default DomU kernel"""
-    dom0Ver = commands.getoutput("uname -r");
-    domUVer = dom0Ver.replace("xen0", "xenU");
-
-    return "/boot/vmlinux-" + domUVer;
-
-ppc_ParavirtDefaults = {"memory"  : 64,
-                        "vcpus"   : 1,
-                        "kernel"  : ppc_getDefaultKernel(),
-                        "root"    : "/dev/ram0",
-                        "ramdisk" : getRdPath() + "/initrd.img",
-                        "extra"   : "xencons=tty128 console=tty128",
-}
-# End  : PowerPC
-
 """Convert from uname specification to a more general platform."""
 _uname_to_arch_map = {
     "i386"  : "x86",
@@ -129,8 +96,6 @@ _uname_to_arch_map = {
     "i686"  : "x86",
     "x86_64": "x86_64",
     "ia64"  : "ia64",
-    "ppc"   : "powerpc",
-    "ppc64" : "powerpc",
 }
 
 # Lookup current platform.
@@ -158,10 +123,5 @@ if _arch == "x86" or _arch == "x86_64" o
         minSafeMem = ia64_minSafeMem
         configDefaults['memory'] = ia64_minSafeMem()
 
-elif _arch == "powerpc":
-    minSafeMem = ppc_minSafeMem
-    getDefaultKernel = ppc_getDefaultKernel
-    checkBuffer = ppc_checkBuffer
-    configDefaults = ppc_ParavirtDefaults
 else:
     raise ValueError, "Unknown architecture!"
diff -r 0ac957f9d42e -r b0d7780794eb tools/xm-test/lib/XmTestReport/arch.py
--- a/tools/xm-test/lib/XmTestReport/arch.py    Thu May 08 13:15:45 2008 +0100
+++ b/tools/xm-test/lib/XmTestReport/arch.py    Thu May 08 13:40:40 2008 +0100
@@ -30,8 +30,6 @@ _uname_to_arch_map = {
     "i686"  : "x86",
     "x86_64": "x86_64",
     "ia64"  : "ia64",
-    "ppc"   : "powerpc",
-    "ppc64" : "powerpc",
 }
 
 _arch = _uname_to_arch_map.get(os.uname()[4], "Unknown")
@@ -44,9 +42,5 @@ elif _arch == "ia64":
 elif _arch == "ia64":
     cpuValues = {"arch"     : "Unknown",
                  "features" : "Unknown"}
-elif _arch == "powerpc":
-    cpuValues = {"cpu"      : "Unknown",
-                 "platform" : "Unknown",
-                 "revision" : "Unknown"}
 else:
     raise ValueError, "Unknown architecture!"
diff -r 0ac957f9d42e -r b0d7780794eb tools/xm-test/ramdisk/Makefile.am
--- a/tools/xm-test/ramdisk/Makefile.am Thu May 08 13:15:45 2008 +0100
+++ b/tools/xm-test/ramdisk/Makefile.am Thu May 08 13:40:40 2008 +0100
@@ -14,7 +14,7 @@
 
 INITRD ?= http://xm-test.xensource.com/ramdisks
 
-BR_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/ppc\(64\)*/powerpc/' 
-e 's/x86_64/i386/')
+BR_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/x86_64/i386/')
 
 @MK@ifdef BR_SNAPSHOT
 @MK@  BR_URL = 
http://buildroot.uclibc.org/downloads/snapshots/buildroot-snapshot.tar.bz2
diff -r 0ac957f9d42e -r b0d7780794eb 
tools/xm-test/ramdisk/configs/buildroot-powerpc
--- a/tools/xm-test/ramdisk/configs/buildroot-powerpc   Thu May 08 13:15:45 
2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,338 +0,0 @@
-#
-# Automatically generated make config: don't edit
-#
-BR2_HAVE_DOT_CONFIG=y
-# BR2_alpha is not set
-# BR2_arm is not set
-# BR2_armeb is not set
-# BR2_cris is not set
-# BR2_i386 is not set
-# BR2_m68k is not set
-# BR2_mips is not set
-# BR2_mipsel is not set
-# BR2_nios2 is not set
-BR2_powerpc=y
-# BR2_sh is not set
-# BR2_sh64 is not set
-# BR2_sparc is not set
-# BR2_x86_64 is not set
-BR2_ARCH="powerpc"
-BR2_ENDIAN="BIG"
-
-#
-# Build options
-#
-BR2_WGET="wget --passive-ftp"
-BR2_SVN="svn co"
-BR2_ZCAT="zcat"
-BR2_TAR_OPTIONS=""
-BR2_DL_DIR="$(BASE_DIR)/dl"
-BR2_SOURCEFORGE_MIRROR="easynews"
-BR2_STAGING_DIR="$(BUILD_DIR)/staging_dir"
-BR2_TOPDIR_PREFIX=""
-BR2_TOPDIR_SUFFIX=""
-BR2_GNU_BUILD_SUFFIX="pc-linux-gnu"
-BR2_GNU_TARGET_SUFFIX="linux-uclibc"
-BR2_JLEVEL=1
-
-#
-# Toolchain Options
-#
-
-#
-# Kernel Header Options
-#
-# BR2_KERNEL_HEADERS_2_4_25 is not set
-# BR2_KERNEL_HEADERS_2_4_27 is not set
-# BR2_KERNEL_HEADERS_2_4_29 is not set
-# BR2_KERNEL_HEADERS_2_4_31 is not set
-# BR2_KERNEL_HEADERS_2_6_9 is not set
-# BR2_KERNEL_HEADERS_2_6_11 is not set
-BR2_KERNEL_HEADERS_2_6_12=y
-# BR2_KERNEL_HEADERS_2_6_18 is not set
-BR2_DEFAULT_KERNEL_HEADERS="2.6.12"
-
-#
-# uClibc Options
-#
-# BR2_UCLIBC_VERSION_SNAPSHOT is not set
-# BR2_ENABLE_LOCALE is not set
-# BR2_PTHREADS_NONE is not set
-# BR2_PTHREADS is not set
-BR2_PTHREADS_OLD=y
-# BR2_PTHREADS_NATIVE is not set
-
-#
-# Binutils Options
-#
-# BR2_BINUTILS_VERSION_2_14_90_0_8 is not set
-# BR2_BINUTILS_VERSION_2_15 is not set
-# BR2_BINUTILS_VERSION_2_15_94_0_2_2 is not set
-# BR2_BINUTILS_VERSION_2_16_1 is not set
-# BR2_BINUTILS_VERSION_2_16_90_0_3 is not set
-# BR2_BINUTILS_VERSION_2_16_91_0_5 is not set
-# BR2_BINUTILS_VERSION_2_16_91_0_6 is not set
-# BR2_BINUTILS_VERSION_2_16_91_0_7 is not set
-BR2_BINUTILS_VERSION_2_17=y
-# BR2_BINUTILS_VERSION_2_17_50_0_2 is not set
-# BR2_BINUTILS_VERSION_2_17_50_0_3 is not set
-# BR2_BINUTILS_VERSION_2_17_50_0_4 is not set
-# BR2_BINUTILS_VERSION_2_17_50_0_5 is not set
-# BR2_BINUTILS_VERSION_2_17_50_0_6 is not set
-BR2_BINUTILS_VERSION="2.17"
-BR2_EXTRA_BINUTILS_CONFIG_OPTIONS=""
-
-#
-# Gcc Options
-#
-# BR2_GCC_VERSION_3_3_5 is not set
-# BR2_GCC_VERSION_3_3_6 is not set
-BR2_GCC_VERSION_3_4_2=y
-# BR2_GCC_VERSION_3_4_3 is not set
-# BR2_GCC_VERSION_3_4_4 is not set
-# BR2_GCC_VERSION_3_4_5 is not set
-# BR2_GCC_VERSION_3_4_6 is not set
-# BR2_GCC_VERSION_4_0_0 is not set
-# BR2_GCC_VERSION_4_0_1 is not set
-# BR2_GCC_VERSION_4_0_2 is not set
-# BR2_GCC_VERSION_4_0_3 is not set
-# BR2_GCC_VERSION_4_1_0 is not set
-# BR2_GCC_VERSION_4_1_1 is not set
-# BR2_GCC_VERSION_4_2 is not set
-# BR2_GCC_IS_SNAP is not set
-BR2_GCC_VERSION="3.4.2"
-# BR2_GCC_USE_SJLJ_EXCEPTIONS is not set
-BR2_EXTRA_GCC_CONFIG_OPTIONS=""
-# BR2_INSTALL_LIBSTDCPP is not set
-# BR2_INSTALL_OBJC is not set
-# BR2_GCC_SHARED_LIBGCC is not set
-
-#
-# Ccache Options
-#
-BR2_CCACHE=y
-
-#
-# Gdb Options
-#
-# BR2_PACKAGE_GDB is not set
-# BR2_PACKAGE_GDB_SERVER is not set
-# BR2_PACKAGE_GDB_HOST is not set
-
-#
-# elf2flt
-#
-# BR2_ELF2FLT is not set
-# BR2_MKLIBS is not set
-
-#
-# Common Toolchain Options
-#
-# BR2_PACKAGE_SSTRIP_TARGET is not set
-# BR2_PACKAGE_SSTRIP_HOST is not set
-BR2_ENABLE_MULTILIB=y
-BR2_LARGEFILE=y
-# BR2_SOFT_FLOAT is not set
-BR2_TARGET_OPTIMIZATION="-Os -pipe"
-BR2_CROSS_TOOLCHAIN_TARGET_UTILS=y
-
-#
-# Package Selection for the target
-#
-
-#
-# The default minimal system
-#
-BR2_PACKAGE_BUSYBOX=y
-# BR2_PACKAGE_BUSYBOX_SNAPSHOT is not set
-BR2_PACKAGE_BUSYBOX_INSTALL_SYMLINKS=y
-BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox.config"
-
-#
-# The minimum needed to build a uClibc development system
-#
-# BR2_PACKAGE_BASH is not set
-# BR2_PACKAGE_BZIP2 is not set
-# BR2_PACKAGE_COREUTILS is not set
-# BR2_PACKAGE_DIFFUTILS is not set
-# BR2_PACKAGE_ED is not set
-# BR2_PACKAGE_FINDUTILS is not set
-# BR2_PACKAGE_FLEX is not set
-# BR2_PACKAGE_GAWK is not set
-# BR2_PACKAGE_GCC_TARGET is not set
-# BR2_PACKAGE_CCACHE_TARGET is not set
-# BR2_PACKAGE_GREP is not set
-# BR2_PACKAGE_MAKE is not set
-# BR2_PACKAGE_PATCH is not set
-# BR2_PACKAGE_SED is not set
-# BR2_PACKAGE_TAR is not set
-
-#
-# Other stuff
-#
-# BR2_PACKAGE_ACPID is not set
-# BR2_PACKAGE_ASTERISK is not set
-# BR2_PACKAGE_AT is not set
-# BR2_PACKAGE_AUTOCONF is not set
-# BR2_PACKAGE_AUTOMAKE is not set
-# BR2_PACKAGE_BERKELEYDB is not set
-# BR2_PACKAGE_BIND is not set
-# BR2_PACKAGE_BISON is not set
-# BR2_PACKAGE_BOA is not set
-# BR2_PACKAGE_BRIDGE is not set
-# BR2_PACKAGE_CUSTOMIZE is not set
-# BR2_PACKAGE_ISC_DHCP is not set
-# BR2_PACKAGE_DIALOG is not set
-# BR2_PACKAGE_DIRECTFB is not set
-# BR2_PACKAGE_DISTCC is not set
-# BR2_PACKAGE_DM is not set
-# BR2_PACKAGE_DMRAID is not set
-# BR2_PACKAGE_DNSMASQ is not set
-# BR2_PACKAGE_DROPBEAR is not set
-# BR2_PACKAGE_ETHTOOL is not set
-# BR2_PACKAGE_EXPAT is not set
-# BR2_PACKAGE_E2FSPROGS is not set
-# BR2_PACKAGE_FAKEROOT is not set
-# BR2_PACKAGE_FILE is not set
-# BR2_PACKAGE_FREETYPE is not set
-# BR2_PACKAGE_GETTEXT is not set
-# BR2_PACKAGE_LIBINTL is not set
-# BR2_PACKAGE_GZIP is not set
-# BR2_PACKAGE_HASERL is not set
-# BR2_PACKAGE_HDPARM is not set
-# BR2_PACKAGE_HOSTAP is not set
-# BR2_PACKAGE_HOTPLUG is not set
-# BR2_PACKAGE_IOSTAT is not set
-# BR2_PACKAGE_IPROUTE2 is not set
-# BR2_PACKAGE_IPSEC_TOOLS is not set
-# BR2_PACKAGE_IPTABLES is not set
-# BR2_PACKAGE_JPEG is not set
-# BR2_PACKAGE_LESS is not set
-# BR2_PACKAGE_LIBCGI is not set
-# BR2_PACKAGE_LIBCGICC is not set
-# BR2_PACKAGE_LIBELF is not set
-# BR2_PACKAGE_LIBFLOAT is not set
-# BR2_PACKAGE_LIBGLIB12 is not set
-# BR2_PACKAGE_LIBMAD is not set
-# BR2_PACKAGE_LIBPCAP is not set
-# BR2_PACKAGE_LIBPNG is not set
-# BR2_PACKAGE_LIBSYSFS is not set
-# BR2_PACKAGE_LIBTOOL is not set
-# BR2_PACKAGE_LIBUSB is not set
-# BR2_PACKAGE_LIGHTTPD is not set
-# BR2_PACKAGE_LINKS is not set
-# BR2_PACKAGE_LRZSZ is not set
-# BR2_PACKAGE_LSOF is not set
-# BR2_PACKAGE_LTP-TESTSUITE is not set
-# BR2_PACKAGE_LTT is not set
-# BR2_PACKAGE_LVM2 is not set
-# BR2_PACKAGE_LZO is not set
-# BR2_PACKAGE_LZMA is not set
-# BR2_PACKAGE_M4 is not set
-# BR2_PACKAGE_MDADM is not set
-# BR2_PACKAGE_MEMTESTER is not set
-# BR2_PACKAGE_MICROCOM is not set
-# BR2_PACKAGE_MICROPERL is not set
-# BR2_PACKAGE_MICROWIN is not set
-# BR2_PACKAGE_MKDOSFS is not set
-# BR2_PACKAGE_MODULE_INIT_TOOLS is not set
-# BR2_PACKAGE_MODUTILS is not set
-# BR2_PACKAGE_MPG123 is not set
-# BR2_PACKAGE_MROUTED is not set
-# BR2_PACKAGE_MTD is not set
-# BR2_PACKAGE_NANO is not set
-# BR2_PACKAGE_NBD is not set
-# BR2_PACKAGE_NCURSES is not set
-# BR2_PACKAGE_NETKITBASE is not set
-# BR2_PACKAGE_NETKITTELNET is not set
-# BR2_PACKAGE_NETSNMP is not set
-# BR2_PACKAGE_NEWT is not set
-# BR2_PACKAGE_NTP is not set
-# BR2_PACKAGE_OPENNTPD is not set
-# BR2_PACKAGE_OPENSSH is not set
-# BR2_PACKAGE_OPENSSL is not set
-# BR2_PACKAGE_OPENVPN is not set
-# BR2_PACKAGE_PCIUTILS is not set
-# BR2_PACKAGE_PKGCONFIG is not set
-# BR2_PACKAGE_PORTAGE is not set
-# BR2_PACKAGE_PORTMAP is not set
-# BR2_PACKAGE_PPPD is not set
-# BR2_PACKAGE_PROCPS is not set
-# BR2_PACKAGE_PSMISC is not set
-# BR2_PACKAGE_PYTHON is not set
-# BR2_PACKAGE_QTE is not set
-BR2_QTE_TMAKE_VERSION="1.13"
-# BR2_PACKAGE_RAIDTOOLS is not set
-# BR2_READLINE is not set
-# BR2_PACKAGE_RSYNC is not set
-# BR2_PACKAGE_RUBY is not set
-# BR2_PACKAGE_RXVT is not set
-# BR2_PACKAGE_SDL is not set
-# BR2_PACKAGE_SFDISK is not set
-# BR2_PACKAGE_SLANG is not set
-# BR2_PACKAGE_SMARTMONTOOLS is not set
-# BR2_PACKAGE_SOCAT is not set
-# BR2_PACKAGE_SQLITE is not set
-# BR2_PACKAGE_STRACE is not set
-# BR2_PACKAGE_SUDO is not set
-# BR2_PACKAGE_SYSKLOGD is not set
-# BR2_PACKAGE_SYSVINIT is not set
-# BR2_PACKAGE_TCL is not set
-# BR2_PACKAGE_TCPDUMP is not set
-# BR2_PACKAGE_TFTPD is not set
-# BR2_PACKAGE_THTTPD is not set
-# BR2_PACKAGE_TINYLOGIN is not set
-# BR2_PACKAGE_TINYX is not set
-# BR2_PACKAGE_TN5250 is not set
-# BR2_PACKAGE_TTCP is not set
-# BR2_PACKAGE_UDEV is not set
-# BR2_PACKAGE_UDHCP is not set
-# BR2_PACKAGE_UEMACS is not set
-# BR2_PACKAGE_USBUTILS is not set
-# BR2_PACKAGE_UTIL-LINUX is not set
-# BR2_PACKAGE_VALGRIND is not set
-# BR2_PACKAGE_VTUN is not set
-# BR2_PACKAGE_WGET is not set
-# BR2_PACKAGE_WHICH is not set
-# BR2_PACKAGE_WIPE is not set
-# BR2_PACKAGE_WIRELESS_TOOLS is not set
-# BR2_PACKAGE_XFSPROGS is not set
-# BR2_PACKAGE_ZLIB is not set
-BR2_PACKAGE_HPING=y
-
-#
-# Target Options
-#
-
-#
-# filesystem for target device
-#
-# BR2_TARGET_ROOTFS_CRAMFS is not set
-# BR2_TARGET_ROOTFS_CLOOP is not set
-BR2_TARGET_ROOTFS_EXT2=y
-BR2_TARGET_ROOTFS_EXT2_BLOCKS=0
-BR2_TARGET_ROOTFS_EXT2_INODES=0
-BR2_TARGET_ROOTFS_EXT2_RESBLKS=0
-BR2_TARGET_ROOTFS_EXT2_SQUASH=y
-BR2_TARGET_ROOTFS_EXT2_OUTPUT="$(IMAGE).ext2"
-# BR2_TARGET_ROOTFS_EXT2_GZ is not set
-BR2_TARGET_ROOTFS_EXT2_COPYTO=""
-# BR2_TARGET_ROOTFS_JFFS2 is not set
-# BR2_TARGET_ROOTFS_SQUASHFS is not set
-# BR2_TARGET_ROOTFS_TAR is not set
-
-#
-# bootloader for target device
-#
-# BR2_TARGET_YABOOT is not set
-
-#
-# Board Support Options
-#
-
-#
-# Generic System Support
-#
-# BR2_TARGET_GENERIC_ACCESS_POINT is not set
-# BR2_TARGET_GENERIC_FIREWALL is not set
-# BR2_TARGET_GENERIC_DEV_SYSTEM is not set
diff -r 0ac957f9d42e -r b0d7780794eb tools/xm-test/ramdisk/make-release.sh
--- a/tools/xm-test/ramdisk/make-release.sh     Thu May 08 13:15:45 2008 +0100
+++ b/tools/xm-test/ramdisk/make-release.sh     Thu May 08 13:40:40 2008 +0100
@@ -3,9 +3,6 @@ if [ "$1" == "" ]
 if [ "$1" == "" ]
 then
   arch=""
-elif [ "$1" == "powerpc" ]
-then
-  arch="BR_ARCH=powerpc"
 else
   echo "Invalid architecture specified." >&2
   exit 1
diff -r 0ac957f9d42e -r b0d7780794eb tools/xm-test/runtest.sh
--- a/tools/xm-test/runtest.sh  Thu May 08 13:15:45 2008 +0100
+++ b/tools/xm-test/runtest.sh  Thu May 08 13:40:40 2008 +0100
@@ -77,7 +77,7 @@ runnable_tests() {
     # using the right version
     realrd=$(readlink ramdisk/initrd.img)
     eval $(./lib/XmTestReport/xmtest.py)
-    ARCH=$(uname -m | sed -e s/i.86/i386/ -e 's/ppc\(64\)*/powerpc/')
+    ARCH=$(uname -m | sed -e s/i.86/i386/)
     rrdver="initrd-${XM_TEST_MAJ}.${XM_TEST_MIN}-${ARCH}.img"
     exp_flag=0
     realarch=`echo $realrd | awk -F- '{print $3}' | awk -F. '{print $1}'`
diff -r 0ac957f9d42e -r b0d7780794eb xen/Rules.mk
--- a/xen/Rules.mk      Thu May 08 13:15:45 2008 +0100
+++ b/xen/Rules.mk      Thu May 08 13:40:40 2008 +0100
@@ -30,8 +30,7 @@ endif
 # Set ARCH/SUBARCH appropriately.
 override TARGET_SUBARCH  := $(XEN_TARGET_ARCH)
 override TARGET_ARCH     := $(shell echo $(XEN_TARGET_ARCH) | \
-                              sed -e 's/x86.*/x86/' \
-                                  -e 's/powerpc.*/powerpc/')
+                              sed -e 's/x86.*/x86/')
 
 TARGET := $(BASEDIR)/xen
 
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/0opt.c
--- a/xen/arch/powerpc/0opt.c   Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * 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 (C) IBM Corp. 2005
- *
- * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- */
-
-#include <xen/config.h>
-#include <xen/lib.h>
-
-extern void __xchg_called_with_bad_pointer(void);
-void __xchg_called_with_bad_pointer(void)
-{
-    BUG();
-}
-
-extern void __cmpxchg_called_with_bad_pointer(void);
-void __cmpxchg_called_with_bad_pointer(void)
-{
-    BUG();
-}
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/Makefile
--- a/xen/arch/powerpc/Makefile Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-ifneq ($(DOM0_IMAGE),)
-builtin_dom0 := y
-endif
-
-subdir-$(HAS_PPC64) += powerpc64
-subdir-y += papr
-
-obj-y += audit.o
-obj-y += backtrace.o
-obj-y += bitops.o
-obj-y += boot_of.o
-obj-y += cmdline.o
-obj-y += dart.o
-obj-y += dart_u3.o
-obj-y += dart_u4.o
-obj-y += domctl.o
-obj-y += domain_build.o
-obj-y += domain.o
-obj-y += exceptions.o
-obj-y += external.o
-obj-y += float.o
-obj-y += hcalls.o
-obj-y += iommu.o
-obj-y += irq.o
-obj-y += systemsim.o
-obj-y += memory.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
-obj-y += ofd_fixup.o
-obj-y += ofd_fixup_memory.o
-obj-y += physdev.o
-obj-y += platform.o
-obj-y += rtas.o
-obj-y += rtas_nvram.o
-obj-y += rtas_flash.o
-obj-y += setup.o
-obj-y += shadow.o
-obj-y += smp.o
-obj-y += smpboot.o
-obj-y += smp-tbsync.o
-obj-y += sysctl.o
-obj-y += time.o
-obj-y += usercopy.o
-obj-y += machine_kexec.o
-obj-y += crash.o
-
-obj-$(debug) += 0opt.o
-obj-$(crash_debug) += gdbstub.o
-obj-$(builtin_dom0) += dom0.o
-
-obj-y += firmware_image.o
-
-# These are extra warnings like for the arch/ppc directory but may not
-# allow the rest of the tree to build.
-PPC_C_WARNINGS += -Wundef -Wmissing-prototypes -Wmissing-declarations
-PPC_C_WARNINGS += -Wshadow
-CFLAGS += $(PPC_C_WARNINGS)
-
-#
-# The following flags are fed to gcc in order to link several
-# objects into a single ELF segment and to not link in any additional
-# objects that gcc would normally like to
-#
-OMAGIC = -nodefaultlibs -nostartfiles -Wl,--omagic
-
-firmware: of_handler/built_in.o $(TARGET_SUBARCH)/memcpy.o of-devtree.o
-       $(CC) $(CFLAGS) $(OMAGIC) -e __ofh_start -Wl,-Ttext,0x0 $^ -o $@
-
-#
-# Link firmware again but this time at the place we expect to load it.
-# This makes debugging _way_ easier.
-#
-firmware.dbg: of_handler/built_in.o $(TARGET_SUBARCH)/memcpy.o of-devtree.o
-       $(CC) $(CFLAGS) $(OMAGIC) -e __ofh_start -Wl,-Ttext,0x2000000 $^ -o $@
-
-firmware_image.bin: firmware firmware.dbg
-       $(CROSS_COMPILE)objcopy --output-target=binary $< $@
-
-#
-# Hacks for included C files
-#
-irq.o: ../x86/irq.c
-physdev.o: ../x86/physdev.c
-numa.o: ../x86/numa.c
-
-ifneq ($(CMDLINE),)
-# The first token in the arguments will be silently dropped.
-FULL_CMDLINE := xen $(CMDLINE)
-endif
-
-ifeq ($(wildcard cmdline.dep),)
-cmdline.dep:
-       echo $(FULL_CMDLINE) > cmdline.dep
-else
-ifneq ($(FULL_CMDLINE),$(shell cat cmdline.dep))
-cmdline.dep::
-       echo $(FULL_CMDLINE) > cmdline.dep
-else
-cmdline.dep:
-endif
-endif
-
-cmdline.o: cmdline.dep
-cmdline.o: CFLAGS += -DCMDLINE="\"$(FULL_CMDLINE)\""
-
-TARGET_OPTS = $(OMAGIC) -Wl,-T,xen.lds
-TARGET_OPTS += start.o $(ALL_OBJS)
-
-.xen-syms: start.o $(ALL_OBJS) xen.lds
-       $(MAKE) -f $(BASEDIR)/Rules.mk $(BASEDIR)/common/symbols-dummy.o
-       $(CC) $(CFLAGS) $(TARGET_OPTS) $(BASEDIR)/common/symbols-dummy.o -o $@
-
-NM=$(CROSS_COMPILE)nm
-new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; 
then echo y; else echo n; fi)
-
-ifeq ($(new_nm),y)
-NM             := $(NM) --synthetic
-endif
-
-xen-syms.S: .xen-syms
-       $(NM) -n $^ | $(BASEDIR)/tools/symbols > $@
-
-xen-syms.o: xen-syms.S
-       $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
-
-$(TARGET)-syms: start.o $(ALL_OBJS) xen-syms.o xen.lds
-       $(CC) $(CFLAGS) $(TARGET_OPTS) xen-syms.o -o $@
-
-# our firmware only loads 32-bit ELF files
-OCPYFLAGS := --input-target=elf64-powerpc --output-target=elf32-powerpc
-$(TARGET): $(TARGET)-syms
-       $(CROSS_COMPILE)objcopy $(OCPYFLAGS) $^ $@
-
-asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(HDRS)
-       $(CC) $(CFLAGS) -S -o $@ $<
-
-xen.lds: xen.lds.S $(HDRS)
-       $(CC) -P -E $(AFLAGS) -o $@ $<
-
-dom0.bin: $(DOM0_IMAGE)
-       cp $< $@
-
-clean::
-       $(MAKE) -f $(BASEDIR)/Rules.mk -C of_handler clean
-       rm -f firmware firmware.dbg firmware_image.bin \
-               dom0.bin .xen-syms xen-syms.S \
-               xen.lds asm-offsets.s cmdline.dep
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/Rules.mk
--- a/xen/arch/powerpc/Rules.mk Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-HAS_PPC64 := y
-
-CC := $(CROSS_COMPILE)gcc
-LD := $(CROSS_COMPILE)ld
-
-# These are goodess that applies to all source.
-C_WARNINGS := -Wredundant-decls
-
-# _no_ common code can have packed data structures or we are in touble.
-C_WARNINGS += -Wpacked
-
-CFLAGS += -m64 -ffreestanding -fno-builtin -fno-common
-CFLAGS += -iwithprefix include -Werror -pipe
-CFLAGS += -I$(BASEDIR)/include
-CFLAGS += -I$(BASEDIR)/include/asm-powerpc/mach-default
-CFLAGS += $(C_WARNINGS)
-CFLAGS += -msoft-float -O2
-CFLAGS-$(debug) += -O0 # last one wins
-CFLAGS-$(papr_vterm) += -DPAPR_VDEVICE -DPAPR_VTERM
-
-LDFLAGS += -m elf64ppc
-
-#
-# command to embed a binary inside a .o
-#
-%.o: %.bin
-       $(CROSS_COMPILE)objcopy --input-target=binary \
-               --output-target=elf64-powerpc \
-               --binary-architecture=powerpc \
-               --redefine-sym _binary_$*_bin_start=$*_start \
-               --redefine-sym _binary_$*_bin_end=$*_end \
-               --redefine-sym _binary_$*_bin_size=$*_size \
-               $< $@
-
-HDRS += $(wildcard $(BASEDIR)/include/asm-powerpc/mach-*/*.h)
-
-# Test for at least GCC v3.2.x.
-gcc-ver = $(shell $(CC) -dumpversion | sed -e 's/^\(.\)\.\(.\)\.\(.\)/\$(1)/')
-ifeq ($(call gcc-ver,1),1)
-$(error gcc-1.x.x unsupported - upgrade to at least gcc-3.2.x)
-endif
-ifeq ($(call gcc-ver,1),2)
-$(error gcc-2.x.x unsupported - upgrade to at least gcc-3.2.x)
-endif
-ifeq ($(call gcc-ver,1),3)
-ifeq ($(call gcc-ver,2),0)
-$(error gcc-3.0.x unsupported - upgrade to at least gcc-3.2.x)
-endif
-ifeq ($(call gcc-ver,2),1)
-$(error gcc-3.1.x unsupported - upgrade to at least gcc-3.2.x)
-endif
-endif
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/audit.c
--- a/xen/arch/powerpc/audit.c  Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * 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 (C) IBM Corp. 2005
- *
- * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
- */
-
-#ifndef NDEBUG
-#include <xen/lib.h>
-#include <xen/sched.h>
-
-extern void audit_domain(struct domain *d);
-extern void audit_domains(void);
-extern void audit_domains_key(unsigned char key);
-
-void audit_domain(struct domain *d)
-{
-    panic("%s unimplemented\n", __func__);
-}
-
-void audit_domains(void)
-{
-    struct domain *d;
-    rcu_read_lock(&domlist_read_lock);
-    for_each_domain ( d )
-        audit_domain(d);
-    rcu_read_unlock(&domlist_read_lock);
-}
-
-void audit_domains_key(unsigned char key)
-{
-    audit_domains();
-}
-#endif
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/backtrace.c
--- a/xen/arch/powerpc/backtrace.c      Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,217 +0,0 @@
-/*
- * Routines providing a simple monitor for use on the PowerMac.
- *
- * Copyright (C) 1996-2005 Paul Mackerras.
- *
- *      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.
- */
-
-#include <xen/config.h>
-#include <xen/lib.h>
-#include <xen/console.h>
-#include <xen/sched.h>
-#include <xen/symbols.h>
-#include <asm/debugger.h>
-
-static char namebuf[KSYM_NAME_LEN+1];
-
-/* Shamelessly lifted from Linux Xmon try to keep pristene */
-#ifdef __powerpc64__
-#define LRSAVE_OFFSET          0x10
-#define REG_FRAME_MARKER       0x7265677368657265ul    /* "regshere" */
-#define MARKER_OFFSET          0x60
-#define REGS_OFFSET            0x70
-#define REG "%016lX"
-#else
-#define LRSAVE_OFFSET          4
-#define REG_FRAME_MARKER       0x72656773
-#define MARKER_OFFSET          8
-#define REGS_OFFSET            16
-#define REG "%08lX"
-#endif
-
-#define TRAP(regs) ((regs)->entry_vector & ~0xF)
-static int xmon_depth_to_print = 64;
-
-/* Very cheap human name for vector lookup. */
-static
-const char *getvecname(unsigned long vec)
-{
-       char *ret;
-
-       switch (vec) {
-       case 0x100:     ret = "(System Reset)"; break;
-       case 0x200:     ret = "(Machine Check)"; break;
-       case 0x300:     ret = "(Data Access)"; break;
-       case 0x380:     ret = "(Data SLB Access)"; break;
-       case 0x400:     ret = "(Instruction Access)"; break;
-       case 0x480:     ret = "(Instruction SLB Access)"; break;
-       case 0x500:     ret = "(Hardware Interrupt)"; break;
-       case 0x600:     ret = "(Alignment)"; break;
-       case 0x700:     ret = "(Program Check)"; break;
-       case 0x800:     ret = "(FPU Unavailable)"; break;
-       case 0x900:     ret = "(Decrementer)"; break;
-       case 0xc00:     ret = "(System Call)"; break;
-       case 0xd00:     ret = "(Single Step)"; break;
-       case 0xf00:     ret = "(Performance Monitor)"; break;
-       case 0xf20:     ret = "(Altivec Unavailable)"; break;
-       case 0x1300:    ret = "(Instruction Breakpoint)"; break;
-       default: ret = "";
-       }
-       return ret;
-}
-
-static int mread(unsigned long adrs, void *buf, int size)
-{
-    memcpy(buf, (void *)adrs, size);
-    return size;
-}
-
-static void get_function_bounds(unsigned long pc, unsigned long *startp,
-                               unsigned long *endp)
-{
-    unsigned long size, offset;
-       const char *name;
-
-    *startp = *endp = 0;
-       if (pc == 0)
-               return;
-
-    name = symbols_lookup(pc, &size, &offset, namebuf);
-    if (name != NULL) {
-                       *startp = pc - offset;
-                       *endp = pc - offset + size;
-    }
-}
-    
-/* Print an address in numeric and symbolic form (if possible) */
-static void xmon_print_symbol(unsigned long address, const char *mid,
-                              const char *after)
-{
-       const char *name = NULL;
-       unsigned long offset, size;
-
-       printk(REG, address);
-
-    name = symbols_lookup(address, &size, &offset, namebuf);
-       if (name) {
-               printk("%s%s+%#lx/%#lx", mid, name, offset, size);
-       }
-       printk("%s", after);
-}
-
-static void backtrace(
-    unsigned long sp, unsigned long lr, unsigned long pc)
-{
-       unsigned long ip;
-       unsigned long newsp;
-       unsigned long marker;
-       int count = 0;
-       struct cpu_user_regs regs;
-
-       do {
-               if (sp > xenheap_phys_end) {
-                       if (sp != 0)
-                               printk("SP (%lx) is not in xen space\n", sp);
-                       break;
-               }
-
-               if (!mread(sp + LRSAVE_OFFSET, &ip, sizeof(unsigned long))
-                   || !mread(sp, &newsp, sizeof(unsigned long))) {
-                       printk("Couldn't read stack frame at %lx\n", sp);
-                       break;
-               }
-
-               /*
-                * For the first stack frame, try to work out if
-                * LR and/or the saved LR value in the bottommost
-                * stack frame are valid.
-                */
-               if ((pc | lr) != 0) {
-                       unsigned long fnstart, fnend;
-                       unsigned long nextip;
-                       int printip = 1;
-
-                       get_function_bounds(pc, &fnstart, &fnend);
-                       nextip = 0;
-                       if (newsp > sp)
-                               mread(newsp + LRSAVE_OFFSET, &nextip,
-                                     sizeof(unsigned long));
-                       if (lr == ip) {
-                               if (lr >= xenheap_phys_end
-                                   || (fnstart <= lr && lr < fnend))
-                                       printip = 0;
-                       } else if (lr == nextip) {
-                               printip = 0;
-                       } else if (lr < xenheap_phys_end
-                       && !(fnstart <= lr && lr < fnend)) {
-                               printk("[link register   ] ");
-                               xmon_print_symbol(lr, " ", "\n");
-                       }
-                       if (printip) {
-                               printk("["REG"] ", sp);
-                               xmon_print_symbol(ip, " ", " (unreliable)\n");
-                       }
-                       pc = lr = 0;
-
-               } else {
-                       printk("["REG"] ", sp);
-                       xmon_print_symbol(ip, " ", "\n");
-               }
-
-               /* Look for "regshere" marker to see if this is
-                  an exception frame. */
-               if (mread(sp + MARKER_OFFSET, &marker, sizeof(unsigned long))
-                   && marker == REG_FRAME_MARKER) {
-                       if (mread(sp + REGS_OFFSET, &regs, sizeof(regs))
-                           != sizeof(regs)) {
-                               printk("Couldn't read registers at %lx\n",
-                                      sp + REGS_OFFSET);
-                               break;
-                       }
-            printk("--- Exception: %x %s at ", regs.entry_vector,
-                              getvecname(TRAP(&regs)));
-                       pc = regs.pc;
-                       lr = regs.lr;
-                       xmon_print_symbol(pc, " ", "\n");
-               }
-
-               if (newsp == 0)
-                       break;
-        
-               sp = newsp;
-       } while (count++ < xmon_depth_to_print);
-}
-
-void show_backtrace(ulong sp, ulong lr, ulong pc)
-{
-    console_start_sync();
-    backtrace(sp, lr, pc);
-    console_end_sync();
-}
-
-void show_backtrace_regs(struct cpu_user_regs *regs)
-{
-    console_start_sync();
-    
-    show_registers(regs);
-    printk("hid4 0x%016lx\n", regs->hid4);
-    printk("---[ backtrace ]---\n");
-    show_backtrace(regs->gprs[1], regs->lr, regs->pc);
-
-    console_end_sync();
-}
-
-void dump_execution_state(void)
-{
-    struct cpu_user_regs *regs = guest_cpu_user_regs();
-
-    show_registers(regs);
-    if (regs->msr & MSR_HV) {
-        printk("In Xen:\n");
-        show_backtrace(regs->gprs[1], regs->pc, regs->lr);
-    }
-}
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/bitops.c
--- a/xen/arch/powerpc/bitops.c Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/* from linux/arch/powerpc/lib/bitops.c */
-
-#include <asm/types.h>
-#include <asm/bitops.h>
-
-#define BITOP_WORD(nr)      ((nr) / BITS_PER_LONG)
-
-/**
- * find_next_bit - find the next set bit in a memory region
- * @addr: The address to base the search on
- * @offset: The bitnumber to start searching at
- * @size: The maximum size to search
- */
-unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
-                            unsigned long offset)
-{
-    const unsigned long *p = addr + BITOP_WORD(offset);
-    unsigned long result = offset & ~(BITS_PER_LONG-1);
-    unsigned long tmp;
-
-    if (offset >= size)
-        return size;
-    size -= result;
-    offset %= BITS_PER_LONG;
-    if (offset) {
-        tmp = *(p++);
-        tmp &= (~0UL << offset);
-        if (size < BITS_PER_LONG)
-            goto found_first;
-        if (tmp)
-            goto found_middle;
-        size -= BITS_PER_LONG;
-        result += BITS_PER_LONG;
-    }
-    while (size & ~(BITS_PER_LONG-1)) {
-        if ((tmp = *(p++)))
-            goto found_middle;
-        result += BITS_PER_LONG;
-        size -= BITS_PER_LONG;
-    }
-    if (!size)
-        return result;
-    tmp = *p;
-
-found_first:
-    tmp &= (~0UL >> (BITS_PER_LONG - size));
-    if (tmp == 0UL)        /* Are any bits set? */
-        return result + size;    /* Nope. */
-found_middle:
-    return result + __ffs(tmp);
-}
-
-/*
- * This implementation of find_{first,next}_zero_bit was stolen from
- * Linus' asm-alpha/bitops.h.
- */
-unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
-                                 unsigned long offset)
-{
-    const unsigned long *p = addr + BITOP_WORD(offset);
-    unsigned long result = offset & ~(BITS_PER_LONG-1);
-    unsigned long tmp;
-
-    if (offset >= size)
-        return size;
-    size -= result;
-    offset %= BITS_PER_LONG;
-    if (offset) {
-        tmp = *(p++);
-        tmp |= ~0UL >> (BITS_PER_LONG - offset);
-        if (size < BITS_PER_LONG)
-            goto found_first;
-        if (~tmp)
-            goto found_middle;
-        size -= BITS_PER_LONG;
-        result += BITS_PER_LONG;
-    }
-    while (size & ~(BITS_PER_LONG-1)) {
-        if (~(tmp = *(p++)))
-            goto found_middle;
-        result += BITS_PER_LONG;
-        size -= BITS_PER_LONG;
-    }
-    if (!size)
-        return result;
-    tmp = *p;
-
-found_first:
-    tmp |= ~0UL << size;
-    if (tmp == ~0UL)    /* Are any bits zero? */
-        return result + size;    /* Nope. */
-found_middle:
-    return result + ffz(tmp);
-}
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.c        Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,1257 +0,0 @@
-/*
- * 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. 2005, 2006, 2007
- *
- * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- *          Hollis Blanchard <hollisb@xxxxxxxxxx>
- */
-
-#include <xen/config.h>
-#include <xen/init.h>
-#include <xen/lib.h>
-#include <xen/version.h>
-#include <xen/spinlock.h>
-#include <xen/serial.h>
-#include <xen/time.h>
-#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"
-#include "rtas.h"
-
-/* Secondary processors use this for handshaking with main processor.  */
-volatile unsigned int __spin_ack;
-
-static ulong of_vec;
-static ulong of_msr;
-static int of_out;
-static ulong eomem;
-
-/* Track memory during early boot with a limited per-page bitmap. We need an
- * allocator to tell us where we can place RTAS, our copy of the device tree.
- * We could examine the "available" properties in memory nodes, but we
- * apparently can't depend on firmware to update those when we call "claim". So
- * we need to track it ourselves.
- * We can't dynamically allocate the bitmap, because we would need something
- * to tell us where it's safe to allocate...
- */
-#define MEM_AVAILABLE_PAGES ((32 << 20) >> PAGE_SHIFT)
-static DECLARE_BITMAP(mem_available_pages, MEM_AVAILABLE_PAGES);
-
-extern struct ns16550_defaults ns16550;
-
-#undef OF_DEBUG
-#undef OF_DEBUG_LOW
-
-#ifdef OF_DEBUG
-#define DBG(args...) of_printf(args)
-#else
-#define DBG(args...)
-#endif
-
-#ifdef OF_DEBUG_LOW
-#define DBG_LOW(args...) of_printf(args)
-#else
-#define DBG_LOW(args...)
-#endif
-
-#define of_panic(MSG...) \
-    do { of_printf(MSG); of_printf("\nHANG\n"); for (;;); } while (0)
-
-struct of_service {
-    u32 ofs_service;
-    u32 ofs_nargs;
-    u32 ofs_nrets;
-    u32 ofs_args[10];
-};
-
-static int bof_chosen;
-
-static struct of_service s;
-
-static int __init of_call(
-    const char *service, u32 nargs, u32 nrets, s32 rets[], ...)
-{
-    int rc;
-
-    if (of_vec != 0) {
-        va_list args;
-        int i;
-        memset(&s, 0, sizeof (s));
-        s.ofs_service = (ulong)service;
-        s.ofs_nargs = nargs;
-        s.ofs_nrets = nrets;
-        s.ofs_nargs = nargs;
-
-        /* copy all the params into the args array */
-        va_start(args, rets);
-
-        for (i = 0; i < nargs; i++) {
-            s.ofs_args[i] = va_arg(args, u32);
-        }
-
-        va_end(args);
-
-        rc = prom_call(&s, 0, of_vec, of_msr);
-
-        /* yes always to the copy, just in case */
-        for (i = 0; i < nrets; i++) {
-            rets[i] = s.ofs_args[i + nargs];
-        }
-    } else {
-        rc = OF_FAILURE;
-    }
-    return rc;
-}
-
-/* popular OF methods */
-static int __init _of_write(int ih, const char *addr, u32 len)
-{
-    int rets[1] = { OF_FAILURE };
-    if (of_call("write", 3, 1, rets, ih, addr, len) == OF_FAILURE) {
-        return OF_FAILURE;
-    }
-    return rets[0];
-}
-
-/* popular OF methods */
-static int __init of_write(int ih, const char *addr, u32 len)
-{
-    int rc;
-    int i = 0;
-    int sum = 0;
-
-    while (i < len) {
-        if (addr[i] == '\n') {
-            if (i > 0) {
-                rc = _of_write(ih, addr, i);
-                if (rc == OF_FAILURE)
-                    return rc;
-                sum += rc;
-            }
-            rc = _of_write(ih, "\r\n", 2);
-            if (rc == OF_FAILURE)
-                return rc;
-            sum += rc;
-            i++;
-            addr += i;
-            len -= i;
-            i = 0;
-            continue;
-        }
-        i++;
-    }
-    if (len > 0) {
-        rc = _of_write(ih, addr, len);
-        if (rc == OF_FAILURE)
-            return rc;
-        sum += rc;
-    }
-            
-    return sum;
-}
-
-static int of_printf(const char *fmt, ...)
-    __attribute__ ((format (printf, 1, 2)));
-static int __init of_printf(const char *fmt, ...)
-{
-    static char buf[1024];
-    va_list args;
-    int sz;
-
-    if (of_out == 0) {
-        return OF_FAILURE;
-    }
-
-    va_start(args, fmt);
-
-    sz = vsnprintf(buf, sizeof (buf), fmt, args);
-    if (sz <= sizeof (buf)) {
-        of_write(of_out, buf, sz);
-    } else {
-        static const char trunc[] = "\n(TRUNCATED)\n";
-
-        sz = sizeof (buf);
-        of_write(of_out, buf, sz);
-        of_write(of_out, trunc, sizeof (trunc));
-    }
-    return sz;
-}
-
-static int __init of_finddevice(const char *devspec)
-{
-    int rets[1] = { OF_FAILURE };
-
-    of_call("finddevice", 1, 1, rets, devspec);
-    if (rets[0] == OF_FAILURE) {
-        DBG("finddevice %s -> FAILURE %d\n",devspec,rets[0]);
-        return OF_FAILURE;
-    }
-    DBG_LOW("finddevice %s -> %d\n",devspec, rets[0]);
-    return rets[0];
-}
-
-static int __init of_getprop(int ph, const char *name, void *buf, u32 buflen)
-{
-    int rets[1] = { OF_FAILURE };
-
-    of_call("getprop", 4, 1, rets, ph, name, buf, buflen);
-
-    if (rets[0] == OF_FAILURE) {
-        DBG_LOW("getprop 0x%x %s -> FAILURE\n", ph, name);
-        return OF_FAILURE;
-    }
-
-    DBG_LOW("getprop 0x%x %s -> 0x%x (%s)\n", ph, name, rets[0], (char *)buf);
-    return rets[0];
-}
-
-static int __init of_setprop(
-    int ph, const char *name, const void *buf, u32 buflen)
-{
-    int rets[1] = { OF_FAILURE };
-
-    of_call("setprop", 4, 1, rets, ph, name, buf, buflen);
-
-    if (rets[0] == OF_FAILURE) {
-        DBG("setprop 0x%x %s -> FAILURE\n", ph, name);
-        return OF_FAILURE;
-    }
-
-    DBG_LOW("setprop 0x%x %s -> %s\n", ph, name, (char *)buf);
-    return rets[0];
-}
-
-/*
- * returns 0 if there are no children (of spec)
- */
-static int __init of_getchild(int ph)
-{
-    int rets[1] = { OF_FAILURE };
-
-    of_call("child", 1, 1, rets, ph);
-    DBG_LOW("getchild 0x%x -> 0x%x\n", ph, rets[0]);
-
-    return rets[0];
-}
-
-/*
- * returns 0 is there are no peers
- */
-static int __init of_getpeer(int ph)
-{
-    int rets[1] = { OF_FAILURE };
-
-    of_call("peer", 1, 1, rets, ph);
-    DBG_LOW("getpeer 0x%x -> 0x%x\n", ph, rets[0]);
-
-    return rets[0];
-}
-
-static int __init of_getproplen(int ph, const char *name)
-{
-    int rets[1] = { OF_FAILURE };
-
-    of_call("getproplen", 2, 1, rets, ph, name);
-    if (rets[0] == OF_FAILURE) {
-        DBG("getproplen 0x%x %s -> FAILURE\n", ph, name);
-        return OF_FAILURE;
-    }
-    DBG_LOW("getproplen 0x%x %s -> 0x%x\n", ph, name, rets[0]);
-    return rets[0];
-}
-
-static int __init of_package_to_path(int ph, char *buffer, u32 buflen)
-{
-    int rets[1] = { OF_FAILURE };
-
-    of_call("package-to-path", 3, 1, rets, ph, buffer, buflen);
-    if (rets[0] == OF_FAILURE) {
-        DBG("%s 0x%x -> FAILURE\n", __func__, ph);
-        return OF_FAILURE;
-    }
-    DBG_LOW("%s 0x%x %s -> 0x%x\n", __func__, ph, buffer, rets[0]);
-    if (rets[0] <= buflen)
-        buffer[rets[0]] = '\0';
-    return rets[0];
-}
-
-static int __init of_nextprop(int ph, const char *name, void *buf)
-{
-    int rets[1] = { OF_FAILURE };
-
-    of_call("nextprop", 3, 1, rets, ph, name, buf);
-
-    if (rets[0] == OF_FAILURE) {
-        DBG("nextprop 0x%x %s -> FAILURE\n", ph, name);
-        return OF_FAILURE;
-    }
-
-    DBG_LOW("nextprop 0x%x %s -> %s\n", ph, name, (char *)buf);
-    return rets[0];
-}
-
-static int __init of_instance_to_path(int ih, char *buffer, u32 buflen)
-{
-    int rets[1] = { OF_FAILURE };
-
-    if (of_call("instance-to-path", 3, 1, rets, ih, buffer, buflen)
-         == OF_FAILURE)
-        return OF_FAILURE;
-
-    if (rets[0] <= buflen)
-        buffer[rets[0]] = '\0';
-    return rets[0];
-}
-
-static int __init of_start_cpu(int cpu, u32 pc, u32 reg)
-{
-    int ret;
-
-    ret = of_call("start-cpu", 3, 0, NULL, cpu, pc, reg);
-
-    return ret;
-}
-
-static void __init of_test(const char *of_method_name)
-{
-    int rets[1] = { OF_FAILURE };
-    
-    of_call("test", 1, 1, rets, of_method_name);
-    if (rets[0] == OF_FAILURE ) {
-        of_printf("Warning: possibly no OF method %s.\n"
-                  "(Ignore this warning on PIBS.)\n", of_method_name);
-    }
-}
-
-static int __init of_claim(u32 virt, u32 size, u32 align)
-{
-    int rets[1] = { OF_FAILURE };
-    
-    of_call("claim", 3, 1, rets, virt, size, align);
-    if (rets[0] == OF_FAILURE) {
-        DBG("%s 0x%08x 0x%08x  0x%08x -> FAIL\n", __func__, virt, size, align);
-        return OF_FAILURE;
-    }
-
-    DBG_LOW("%s 0x%08x 0x%08x  0x%08x -> 0x%08x\n", __func__, virt, size, 
align,
-        rets[0]);
-    return rets[0];
-}
-
-static int __init of_instance_to_package(int ih)
-{
-    int rets[1] = { OF_FAILURE };
-
-    of_call("instance-to-package", 1, 1, rets, ih);
-    if (rets[0] == OF_FAILURE)
-        return OF_FAILURE;
-
-    return rets[0];
-}
-
-static int __init of_getparent(int ph)
-{
-    int rets[1] = { OF_FAILURE };
-
-    of_call("parent", 1, 1, rets, ph);
-
-    DBG_LOW("getparent 0x%x -> 0x%x\n", ph, rets[0]);
-    return rets[0];
-}
-
-static int __init of_open(const char *devspec)
-{
-    int rets[1] = { OF_FAILURE };
-
-    of_call("open", 1, 1, rets, devspec);
-    return rets[0];
-}
-
-static void boot_of_alloc_init(int m, uint addr_cells, uint size_cells)
-{
-    int rc;
-    uint pg;
-    uint a[64];
-    int tst;
-    u64 start;
-    u64 size;
-
-    rc = of_getprop(m, "available", a, sizeof (a));
-    if (rc > 0) {
-        int l =  rc / sizeof(a[0]);
-        int r = 0;
-
-#ifdef OF_DEBUG
-        { 
-            int i;
-            of_printf("avail:\n");
-            for (i = 0; i < l; i += 4)
-                of_printf("  0x%x%x, 0x%x%x\n",
-                          a[i], a[i + 1],
-                          a[i + 2] ,a[i + 3]);
-        }
-#endif
-            
-        pg = 0;
-        while (pg < MEM_AVAILABLE_PAGES && r < l) {
-            ulong end;
-
-            start = a[r++];
-            if (addr_cells == 2 && (r < l) )
-                start = (start << 32) | a[r++];
-            
-            size = a[r++];
-            if (size_cells == 2 && (r < l) )
-                size = (size << 32) | a[r++];
-                
-            end = ALIGN_DOWN(start + size, PAGE_SIZE);
-
-            start = ALIGN_UP(start, PAGE_SIZE);
-
-            DBG("%s: marking 0x%x - 0x%lx\n", __func__,
-                pg << PAGE_SHIFT, start);
-
-            start >>= PAGE_SHIFT;
-            while (pg < MEM_AVAILABLE_PAGES && pg < start) {
-                set_bit(pg, mem_available_pages);
-                pg++;
-            }
-
-            pg = end  >> PAGE_SHIFT;
-        }
-    }
-
-    /* Now make sure we mark our own memory */
-    pg =  (ulong)_start >> PAGE_SHIFT;
-    start = (ulong)_end >> PAGE_SHIFT;
-
-    DBG("%s: marking 0x%x - 0x%lx\n", __func__,
-        pg << PAGE_SHIFT, start << PAGE_SHIFT);
-
-    /* Lets try and detect if our image has stepped on something. It
-     * is possible that FW has already subtracted our image from
-     * available memory so we must make sure that the previous bits
-     * are the same for the whole image */
-    tst = test_and_set_bit(pg, mem_available_pages);
-    ++pg;
-    while (pg <= start) {
-        if (test_and_set_bit(pg, mem_available_pages) != tst)
-            of_panic("%s: pg :0x%x of our image is different\n",
-                     __func__, pg);
-        ++pg;
-    }
-
-    DBG("%s: marking 0x%x - 0x%x\n", __func__,
-        0 << PAGE_SHIFT, 3 << PAGE_SHIFT);
-    /* First for pages (where the vectors are) should be left alone as well */
-    set_bit(0, mem_available_pages);
-    set_bit(1, mem_available_pages);
-    set_bit(2, mem_available_pages);
-    set_bit(3, mem_available_pages);
-}
-
-#ifdef BOOT_OF_FREE
-/* this is here in case we ever need a free call at a later date */
-static void boot_of_free(ulong addr, ulong size)
-{
-    ulong bits;
-    ulong pos;
-    ulong i;
-
-    size = ALIGN_UP(size, PAGE_SIZE);
-    bits = size >> PAGE_SHIFT;
-    pos = addr >> PAGE_SHIFT;
-
-    for (i = 0; i < bits; i++) {
-        if (!test_and_clear_bit(pos + i, mem_available_pages))
-            of_panic("%s: pg :0x%lx was never allocated\n",
-                     __func__, pos + i);
-    }
-}
-#endif
-
-static ulong boot_of_alloc(ulong size)
-{
-    ulong bits;
-    ulong pos;
-
-    if (size == 0)
-        return 0;
-
-    DBG("%s(0x%lx)\n", __func__, size);
-
-    size = ALIGN_UP(size, PAGE_SIZE);
-    bits = size >> PAGE_SHIFT;
-    pos = 0;
-    for (;;) {
-        ulong i;
-
-        pos = find_next_zero_bit(mem_available_pages,
-                                 MEM_AVAILABLE_PAGES, pos);
-        DBG("%s: found start bit at: 0x%lx\n", __func__, pos);
-
-        /* found nothing */
-        if ((pos + bits) > MEM_AVAILABLE_PAGES) {
-            of_printf("%s: allocation of size: 0x%lx failed\n",
-                     __func__, size);
-            return 0;
-        }
-
-        /* find a set that fits */
-        DBG("%s: checking for 0x%lx bits: 0x%lx\n", __func__, bits, pos);
-
-        i = find_next_bit(mem_available_pages, MEM_AVAILABLE_PAGES, pos);  
-        if (i - pos >= bits) {
-            uint addr = pos << PAGE_SHIFT;
-
-            /* make sure OF is happy with our choice */
-            if (of_claim(addr, size, 0) != OF_FAILURE) {
-                for (i = 0; i < bits; i++)
-                    set_bit(pos + i, mem_available_pages);
-
-                DBG("%s: 0x%lx is good returning 0x%x\n",
-                    __func__, pos, addr);
-                return addr;
-            }
-            /* if OF did not like the address then simply start from
-             * the next bit */
-            i = 1;
-        }
-
-        pos = pos + i;
-    }
-}
-
-int boot_of_mem_avail(int pos, ulong *startpage, ulong *endpage)
-{
-    ulong freebit;
-    ulong usedbit;
-
-    if (pos >= MEM_AVAILABLE_PAGES)
-        /* Stop iterating. */
-        return -1;
-
-    /* Find first free page. */
-    freebit = find_next_zero_bit(mem_available_pages, MEM_AVAILABLE_PAGES, 
pos);
-    if (freebit >= MEM_AVAILABLE_PAGES) {
-        /* We know everything after MEM_AVAILABLE_PAGES is still free. */
-        *startpage = MEM_AVAILABLE_PAGES << PAGE_SHIFT;
-        *endpage = ~0UL;
-        return freebit;
-    }
-    *startpage = freebit << PAGE_SHIFT;
-
-    /* Now find first used page after that. */
-    usedbit = find_next_bit(mem_available_pages, MEM_AVAILABLE_PAGES, freebit);
-    if (usedbit >= MEM_AVAILABLE_PAGES) {
-        /* We know everything after MEM_AVAILABLE_PAGES is still free. */
-        *endpage = ~0UL;
-        return usedbit;
-    }
-
-    *endpage = usedbit << PAGE_SHIFT;
-    return usedbit;
-}
-
-static ulong boot_of_mem_init(void)
-{
-    int root;
-    int p;
-    int rc;
-    uint addr_cells;
-    uint size_cells;
-
-    root = of_finddevice("/");
-    p = of_getchild(root);
-
-    /* code is writen to assume sizes of 1 */
-    of_getprop(root, "#address-cells", &addr_cells,
-               sizeof (addr_cells));
-    of_getprop(root, "#size-cells", &size_cells,
-               sizeof (size_cells));
-    DBG("%s: address_cells=%d  size_cells=%d\n",
-                    __func__, addr_cells, size_cells);
-
-    /* We do ream memory discovery later, for now we only want to find
-     * the first LMB */
-    do {
-        const char memory[] = "memory";
-        char type[32];
-
-        type[0] = '\0';
-
-        of_getprop(p, "device_type", type, sizeof (type));
-        if (strncmp(type, memory, sizeof (memory)) == 0) {
-            uint reg[48];  
-            u64 start;
-            u64 size;
-            int r;
-            int l;
-
-            rc = of_getprop(p, "reg", reg, sizeof (reg));
-            if (rc == OF_FAILURE) {
-                of_panic("no reg property for memory node: 0x%x.\n", p);
-            }
-
-            l = rc / sizeof(reg[0]); /* number reg element */
-            DBG("%s: number of bytes in property 'reg' %d\n",
-                            __func__, rc);
-            
-            r = 0;
-            while (r < l) {
-                start = reg[r++];
-                if (addr_cells == 2 && (r < l) )
-                    start = (start << 32) | reg[r++];
-
-                if (r >= l)
-                    break;  /* partial line.  Skip */
-
-                if (start > 0) {
-                    /* this is not the first LMB so we skip it */
-                    break;
-                }
-
-                size = reg[r++];
-                if (size_cells == 2 && (r < l) )
-                    size = (size << 32) | reg[r++];
-                
-                if (r > l)
-                    break;  /* partial line.  Skip */
-
-                boot_of_alloc_init(p, addr_cells, size_cells);
-                
-                eomem = size;
-                return size;
-            }
-        }
-        p = of_getpeer(p);
-    } while (p != OF_FAILURE && p != 0);
-
-    return 0;
-}
-
-static int save_props(void *m, ofdn_t n, int pkg)
-{
-    int ret;
-    char name[128];
-    int result = 1;
-    int found_name = 0;
-    int found_device_type = 0;
-    const char name_str[] = "name";
-    const char devtype_str[] = "device_type";
-
-    /* get first */
-    result = of_nextprop(pkg, 0, name);
-
-    while (result > 0) {
-        int sz;
-        u64 obj[1024];
-
-        sz = of_getproplen(pkg, name);
-        if (sz >= 0) {
-            ret = OF_SUCCESS;
-        } else {
-            ret = OF_FAILURE;
-        }
-
-        if (ret == OF_SUCCESS) {
-            int actual = 0;
-            ofdn_t pos;
-
-            if (sz > 0) {
-                if (sz > sizeof (obj)) {
-                    of_panic("obj array not big enough for 0x%x\n", sz);
-                }
-                actual = of_getprop(pkg, name, obj, sz);
-                if (actual > sz)
-                    of_panic("obj too small");
-            }
-
-            if (strncmp(name, name_str, sizeof(name_str)) == 0) {
-                found_name = 1;
-            }
-
-            if (strncmp(name, devtype_str, sizeof(devtype_str)) == 0) {
-                found_device_type = 1;
-            }
-
-            pos = ofd_prop_add(m, n, name, obj, actual);
-            if (pos == 0)
-                of_panic("prop_create");
-        }
-
-        result = of_nextprop(pkg, name, name);
-    }
-
-    return 1;
-}
-
-
-static void do_pkg(void *m, ofdn_t n, int p, char *path, size_t psz)
-{
-    int pnext;
-    ofdn_t nnext;
-    int sz;
-
-retry:
-    save_props(m, n, p);
-
-    /* do children first */
-    pnext = of_getchild(p);
-
-    if (pnext != 0) {
-        sz = of_package_to_path(pnext, path, psz);
-        if (sz == OF_FAILURE)
-            of_panic("bad path\n");
-
-        nnext = ofd_node_child_create(m, n, path, sz);
-        if (nnext == 0)
-            of_panic("out of mem\n");
-
-        do_pkg(m, nnext, pnext, path, psz);
-    }
-
-    /* do peer */
-    pnext = of_getpeer(p);
-
-    if (pnext != 0) {
-        sz = of_package_to_path(pnext, path, psz);
-
-        nnext = ofd_node_peer_create(m, n, path, sz);
-        if (nnext <= 0)
-            of_panic("out of space in OFD tree.\n");
-
-        n = nnext;
-        p = pnext;
-        goto retry;
-    }
-}
-
-static long pkg_save(void *mem)
-{
-    int root;
-    char path[256];
-    int r;
-
-    path[0]='/';
-    path[1]='\0';
-
-    /* get root */
-    root = of_getpeer(0);
-    if (root == OF_FAILURE)
-        of_panic("no root package\n");
-
-    do_pkg(mem, OFD_ROOT, root, path, sizeof(path));
-
-    r = ofd_size(mem);
-
-    of_printf("%s: saved device tree in 0x%x bytes\n", __func__, r);
-
-    return r;
-}
-
-static int boot_of_fixup_refs(void *mem)
-{
-    static const char *fixup_props[] = {
-        "interrupt-parent",
-    };
-    int i;
-    int count = 0;
-
-    for (i = 0; i < ARRAY_SIZE(fixup_props); i++) {
-        ofdn_t c;
-        const char *name = fixup_props[i];
-
-        c = ofd_node_find_by_prop(mem, OFD_ROOT, name, NULL, 0);
-        while (c > 0) {
-            const char *path;
-            int rp;
-            int ref;
-            ofdn_t dp;
-            int rc;
-            ofdn_t upd;
-            char ofpath[256];
-
-            path = ofd_node_path(mem, c);
-            if (path == NULL)
-                of_panic("no path to found prop: %s\n", name);
-
-            rp = of_finddevice(path);
-            if (rp == OF_FAILURE)
-                of_panic("no real device for: name %s, path %s\n",
-                          name, path);
-            /* Note: In theory 0 is a valid node handle but it is highly
-             * unlikely.
-             */
-            if (rp == 0) {
-                of_panic("%s: of_finddevice returns 0 for path %s\n",
-                                    __func__, path);
-            } 
-
-            rc = of_getprop(rp, name, &ref, sizeof(ref));
-            if ((rc == OF_FAILURE) || (rc == 0))
-                of_panic("no prop: name %s, path %s, device 0x%x\n",
-                         name, path, rp);
-
-            rc = of_package_to_path(ref, ofpath, sizeof (ofpath));
-            if (rc == OF_FAILURE)
-                of_panic("no package: name %s, path %s, device 0x%x,\n"
-                         "ref 0x%x\n", name, path, rp, ref);
-
-            dp = ofd_node_find(mem, ofpath);
-            if (dp <= 0)
-                of_panic("no ofd node for OF node[0x%x]: %s\n",
-                         ref, ofpath);
-
-            ref = dp;
-
-            upd = ofd_prop_add(mem, c, name, &ref, sizeof(ref));
-            if (upd <= 0)
-                of_panic("update failed: %s\n", name);
-
-#ifdef DEBUG
-            of_printf("%s: %s/%s -> %s\n", __func__,
-                    path, name, ofpath);
-#endif
-            ++count;
-            c = ofd_node_find_next(mem, c);
-        }
-    }
-    return count;
-}
-
-static int boot_of_fixup_chosen(void *mem)
-{
-    int ch;
-    ofdn_t dn;
-    ofdn_t dc;
-    int val;
-    int rc;
-    char ofpath[256];
-
-    ch = of_finddevice("/chosen");
-    if (ch == OF_FAILURE)
-        of_panic("/chosen not found\n");
-
-    rc = of_getprop(ch, "cpu", &val, sizeof (val));
-
-    if (rc != OF_FAILURE) {
-        rc = of_instance_to_path(val, ofpath, sizeof (ofpath));
-
-        if (rc > 0) {
-            dn = ofd_node_find(mem, ofpath);
-            if (dn <= 0)
-                of_panic("no node for: %s\n", ofpath);
-
-            ofd_boot_cpu = dn;
-            val = dn;
-
-            dn = ofd_node_find(mem, "/chosen");
-            if (dn <= 0)
-                of_panic("no /chosen node\n");
-
-            dc = ofd_prop_add(mem, dn, "cpu", &val, sizeof (val));
-            if (dc <= 0)
-                of_panic("could not fix /chosen/cpu\n");
-            rc = 1;
-        } else {
-            of_printf("*** can't find path to booting cpu, "
-                    "SMP is disabled\n");
-            ofd_boot_cpu = -1;
-        }
-    }
-    return rc;
-}
-
-/* PIBS Version 1.05.0000 04/26/2005 has an incorrect /ht/isa/ranges
- * property.  The values are bad, and it doesn't even have the
- * right number of cells. */
-
-static void __init boot_of_fix_maple(void)
-{
-    int isa;
-    const char *ranges = "ranges";
-    u32 isa_ranges[3];
-    const u32 isa_test[] = { 0x00000001, 0xf4000000, 0x00010000 };
-    const u32 isa_fixed[] = {
-        0x00000001,
-        0x00000000,
-        0x00000000, /* 0xf4000000, matt says this */
-        0x00000000,
-        0x00000000,
-        0x00010000
-    };
-
-    isa = of_finddevice("/ht@0/isa@4");
-    if (isa != OF_FAILURE) {
-        if (of_getproplen(isa, ranges) == sizeof (isa_test)) {
-            of_getprop(isa, ranges, isa_ranges, sizeof (isa_ranges));
-            if (memcmp(isa_ranges, isa_test, sizeof (isa_test)) == 0) {
-                int rc;
-
-                of_printf("OF: fixing bogus ISA range on maple\n");
-                rc = of_setprop(isa, ranges, isa_fixed, sizeof (isa_fixed));
-                if (rc == OF_FAILURE) {
-                    of_panic("of_setprop() failed\n");
-                }
-            }
-        }
-    }
-}
-
-void __init boot_of_serial(void *oft)
-{
-    int n;
-    int p;
-    int rc;
-    u32 val[3];
-    char buf[128];
-
-    n = of_instance_to_package(of_out);
-    if (n == OF_FAILURE) {
-        of_panic("instance-to-package of /chosen/stdout: failed\n");
-    }
-    
-    /* Prune all serial devices from the device tree, including the
-     * one pointed to by /chosen/stdout, because a guest domain can
-     * initialize them and in so doing corrupt our console output.
-     */
-    for (p = n; p > 0; p = of_getpeer(p)) {
-        char type[32];
-
-        rc = of_package_to_path(p, buf, sizeof(buf));
-        if (rc == OF_FAILURE)
-            of_panic("package-to-path failed\n");
-
-        rc = of_getprop(p, "device_type", type, sizeof (type));
-        if (rc == OF_FAILURE) {
-            of_printf("%s: fetching type of `%s' failed\n", __func__, buf);
-            continue;
-        }
-
-        if (strcmp(type, "serial") != 0)
-            continue;
-
-        of_printf("pruning `%s' from devtree\n", buf);
-        rc = ofd_prune_path(oft, buf);
-        if (rc < 0)
-            of_panic("prune of `%s' failed\n", buf);
-    }
-
-    p = of_getparent(n);
-    if (p == OF_FAILURE) {
-        of_panic("no parent for: 0x%x\n", n);
-    }
-
-    buf[0] = '\0';
-    of_getprop(p, "device_type", buf, sizeof (buf));
-    if (strstr(buf, "isa") == NULL) {
-        of_panic("only ISA UARTS supported\n");
-    }
-
-    /* should get this from devtree */
-    isa_io_base = 0xf4000000;
-    of_printf("%s: ISA base: 0x%lx\n", __func__, isa_io_base);
-
-    buf[0] = '\0';
-    of_getprop(n, "device_type", buf, sizeof (buf));
-    if (strstr(buf, "serial") == NULL) {
-        of_panic("only UARTS supported\n");
-    }
-
-    rc = of_getprop(n, "reg", val, sizeof (val));
-    if (rc == OF_FAILURE) {
-        of_panic("%s: no location for serial port\n", __func__);
-    }
-
-    ns16550.baud = BAUD_AUTO;
-    ns16550.data_bits = 8;
-    ns16550.parity = 'n';
-    ns16550.stop_bits = 1;
-
-    rc = of_getprop(n, "interrupts", val, sizeof (val));
-    if (rc == OF_FAILURE) {
-        of_printf("%s: no ISRC, forcing poll mode\n", __func__);
-        ns16550.irq = 0;
-    } else {
-        ns16550.irq = val[0];
-        of_printf("%s: ISRC=0x%x, but forcing poll mode\n",
-                  __func__, ns16550.irq);
-        ns16550.irq = 0;
-    }
-}
-
-static int __init boot_of_rtas(void)
-{
-    int rtas_node;
-    int rtas_instance;
-    uint size = 0;
-    int res[2];
-    int mem;
-    int ret;
-
-    rtas_node = of_finddevice("/rtas");
-
-    if (rtas_node <= 0) {
-        of_printf("No RTAS, Xen has no power control\n");
-        return 0;
-    }
-    of_getprop(rtas_node, "rtas-size", &size, sizeof (size));
-    if (size == 0) {
-        of_printf("RTAS, has no size\n");
-        return 0;
-    }
-
-    rtas_instance = of_open("/rtas");
-    if (rtas_instance == OF_FAILURE) {
-        of_printf("RTAS, could not open\n");
-        return 0;
-    }
-
-    size = ALIGN_UP(size, PAGE_SIZE);
-    
-    mem = boot_of_alloc(size);
-    if (mem == 0)
-        of_panic("Could not allocate RTAS tree\n");
-
-    of_printf("instantiating RTAS at: 0x%x\n", mem);
-
-    ret = of_call("call-method", 3, 2, res,
-                  "instantiate-rtas", rtas_instance, mem);
-    if (ret == OF_FAILURE) {
-        of_printf("RTAS, could not open\n");
-        return 0;
-    }
-    
-    rtas_entry = res[1];
-    rtas_base = mem;
-    rtas_end = mem + size;
-    rtas_msr = of_msr;
-
-    return 1;
-}
-
-void __init *boot_of_devtree(void)
-{
-    void *oft;
-    ulong oft_sz = 48 * PAGE_SIZE;
-    ulong alloc_sz = 32 << 10;    /* 32KiB should be plenty */
-    ulong sz;
-
-    /* snapshot the tree */
-    oft = (void *)boot_of_alloc(alloc_sz);
-    if (oft == NULL)
-        of_panic("Could not allocate OFD tree\n");
-
-    of_printf("creating oftree at: 0x%p\n", oft);
-    of_test("package-to-path");
-    oft = ofd_create(oft, alloc_sz);
-    pkg_save(oft);
-    sz = ofd_size(oft);
-
-    if (sz > alloc_sz)
-        of_panic("Could not fit all of native devtree in 0x%lx of memory\n",
-            alloc_sz);
-
-    boot_of_fixup_refs(oft);
-    boot_of_fixup_chosen(oft);
-
-    if (sz > alloc_sz)
-         of_panic("Could not fit all devtree fixupsin 0x%lx of memory\n",
-            alloc_sz);
-
-    ofd_walk(oft, __func__, OFD_ROOT, /* add_hype_props */ NULL, 2);
-
-    oftree = (ulong)oft;
-    oftree = (ulong)oft + oft_sz;
-    oftree_len = oft_sz; 
-
-    return oft;
-}
-
-static int __init boot_of_cpus(void)
-{
-    int cpus_node, cpu_node;
-    int bootcpu_instance, bootcpu_node;
-    int logical;
-    int result;
-    s32 cpuid;
-    u32 cpu_clock[2];
-    extern uint cpu_hard_id[NR_CPUS];
-    u32 tbf;
-
-    /* Look up which CPU we are running on right now and get all info
-     * from there */
-    result = of_getprop(bof_chosen, "cpu",
-                        &bootcpu_instance, sizeof (bootcpu_instance));
-    if (result == OF_FAILURE)
-        of_panic("Failed to look up boot cpu instance\n");
-
-    bootcpu_node = of_instance_to_package(bootcpu_instance);
-    if (result == OF_FAILURE)
-        of_panic("Failed to look up boot cpu package\n");
-
-    cpu_node = bootcpu_node;
-
-    result = of_getprop(cpu_node, "timebase-frequency", &tbf, sizeof(tbf));
-    timebase_freq = tbf;
-    if (result == OF_FAILURE) {
-        of_panic("Couldn't get timebase frequency!\n");
-    }
-    of_printf("OF: timebase-frequency = %ld Hz\n", timebase_freq);
-
-    result = of_getprop(cpu_node, "clock-frequency",
-                        &cpu_clock, sizeof(cpu_clock));
-    if (result == OF_FAILURE || (result !=4 && result != 8)) {
-        of_panic("Couldn't get clock frequency!\n");
-    }
-    cpu_khz = cpu_clock[0];
-    if (result == 8) {
-        cpu_khz <<= 32;
-        cpu_khz |= cpu_clock[1];
-    }
-    cpu_khz /= 1000;
-    of_printf("OF: clock-frequency = %ld KHz\n", cpu_khz);
-
-    /* We want a continuous logical cpu number space and we'll make
-     * the booting CPU logical 0.  */
-    cpu_set(0, cpu_present_map);
-    cpu_set(0, cpu_online_map);
-    cpu_set(0, cpu_possible_map);
-
-    result = of_getprop(cpu_node, "reg", &cpuid, sizeof(cpuid));
-    cpu_hard_id[0] = cpuid;
-
-    /* Spin up all CPUS, even if there are more than NR_CPUS or we are
-     * runnign nosmp, because Open Firmware has them spinning on cache
-     * lines which will eventually be scrubbed, which could lead to
-     * random CPU activation.
-     */
-
-    /* Find the base of the multi-CPU package node */
-    cpus_node = of_finddevice("/cpus");
-    if (cpus_node <= 0) {
-        of_printf("Single Processor System\n");
-        return 1;
-    }
-    /* Start with the first child */
-    cpu_node = of_getchild(cpus_node);
-
-    for (logical = 1; cpu_node > 0; logical++) {
-        unsigned int ping, pong;
-        unsigned long now, then, timeout;
-        
-        if (cpu_node == bootcpu_node) {
-            /* same CPU as boot CPU shich we have already made 0 so
-             * reduce the logical count */
-            --logical;
-        } else {
-            result = of_getprop(cpu_node, "reg", &cpuid, sizeof(cpuid));
-            if (result == OF_FAILURE)
-                of_panic("cpuid lookup failed\n");
-
-            cpu_hard_id[logical] = cpuid;
-
-            of_printf("spinning up secondary processor #%d: ", logical);
-
-            __spin_ack = ~0x0;
-            ping = __spin_ack;
-            pong = __spin_ack;
-            of_printf("ping = 0x%x: ", ping);
-
-            mb();
-            result = of_start_cpu(cpu_node, (ulong)spin_start, logical);
-            if (result == OF_FAILURE)
-                of_panic("start cpu failed\n");
-
-            /* We will give the secondary processor five seconds to reply.  */
-            then = mftb();
-            timeout = then + (5 * timebase_freq);
-
-            do {
-                now = mftb();
-                if (now >= timeout) {
-                    of_printf("BROKEN: ");
-                    break;
-                }
-
-                mb();
-                pong = __spin_ack;
-            } while (pong == ping);
-            of_printf("pong = 0x%x\n", pong);
-
-            if (pong != ping) {
-                cpu_set(logical, cpu_present_map);
-                cpu_set(logical, cpu_possible_map);
-            }
-        }
-        cpu_node = of_getpeer(cpu_node);
-    }
-    return 1;
-}
-
-void __init boot_of_init(ulong vec, ulong orig_msr)
-{
-    int r;
-
-    of_vec = vec;
-    of_msr = orig_msr;
-
-    if (is_kernel(vec)) {
-        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));
-
-    of_printf("%s\n", "---------------------------------------------------");
-    of_printf("OF: Xen/PPC version %d.%d%s (%s@%s) (%s) %s\n",
-              xen_major_version(), xen_minor_version(), xen_extra_version(),
-              xen_compile_by(), xen_compile_domain(),
-              xen_compiler(), xen_compile_date());
-
-    boot_of_fix_maple();
-    r = boot_of_mem_init();
-    if (r == 0)
-        of_panic("failure to initialize memory allocator");
-
-    boot_of_rtas();
-    boot_of_cpus();
-}
-
-void __init boot_of_finish(void)
-{
-    /* end of OF */
-    of_printf("Quiescing Open Firmware ...\n");
-    of_call("quiesce", 0, 0, NULL);
-}
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/cmdline.c
--- a/xen/arch/powerpc/cmdline.c        Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * 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 (C) IBM Corp. 2006
- *
- * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
- */
-
-#include <asm/config.h>
-
-char builtin_cmdline[CONFIG_CMDLINE_SIZE] 
-        __attribute__((section("__builtin_cmdline"))) = CMDLINE;
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/crash.c
--- a/xen/arch/powerpc/crash.c  Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-#include <xen/lib.h>       /* for printk() used in stub */
-#include <xen/types.h>
-#include <xen/kexec.h>
-#include <public/kexec.h>
-
-void machine_crash_shutdown(void)
-{
-    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
-}
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
-
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/dart.c
--- a/xen/arch/powerpc/dart.c   Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,297 +0,0 @@
-/*
- * 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 (C) IBM Corp. 2005
- *
- * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- */
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/mm.h>
-#include <asm/cache.h>
-#include <xen/init.h>
-#include "tce.h"
-#include "iommu.h"
-#include "dart.h"
-#include "oftree.h"
-#include "of-devtree.h"
-
-#undef DEBUG
-#ifdef DEBUG
-#define DBG(fmt...) printk(fmt)
-static int dbg_after;
-#define DBG_SET_AFTER dbg_after = 1;
-#define DBG_AFTER(fmt...) if (dbg_after) DBG(fmt)
-#else
-#define DBG(fmt...)
-#define DBG_SET_AFTER
-#define DBG_AFTER(fmt...)
-#endif
-
-/* Max size of 512 pages */
-#define U3_LOG_MAX_PAGES 9
-
-#define DART_DEF_BASE   0xf8033000UL
-#define DART_NONE 0
-#define DART_U3 3
-#define DART_U4 4
-#define DART_WRITE 0x1
-#define DART_READ 0x2
-
-static ulong dummy_page;
-static ulong dart_entries;
-static struct dart_ops *dops;
-static u32 *dart_table;
-
-union dart_entry {
-    u32 de_word;
-    struct {
-        u32 de_v:1;             /* valid */
-        u32 de_rp:1;             /* read protected */
-        u32 de_wp:1;             /* write protected */
-        u32 _de_res:5;
-        u32 de_ppn:24;         /* 24 bit Physical Page Number
-                                 * representing address [28:51] */
-    } de_bits;
-};
-
-struct dma_window {
-    u32 dw_liobn;
-    u32 dw_base_hi;
-    u64 dw_base;
-    u64 dw_size;
-};
-
-struct dart_info {
-    struct dma_window di_window;
-    ulong di_base;
-    int di_model;
-};
-
-static u32 dart_encode(int perm, ulong rpn)
-{
-    union dart_entry e;
-
-    e.de_word = 0;
-    e.de_bits.de_v = 1;
-    e.de_bits.de_ppn = rpn;
-
-    /* protect the page */
-    e.de_bits.de_rp = 1;
-    e.de_bits.de_wp = 1;
-    if (perm & DART_READ) {
-        e.de_bits.de_rp = 0;
-    }
-    if (perm & DART_WRITE) {
-        e.de_bits.de_wp = 0;
-    }
-    return e.de_word;
-}
-
-static void dart_fill(ulong index, int perm, ulong rpg, ulong num_pg)
-{
-    u32 volatile *entry = dart_table + index;
-    ulong i = 0;
-    ulong last_flush = 0;
-
-    while (1) {
-        entry[i] = dart_encode(perm, rpg);
-        ++i;
-        ++rpg;
-        if (i == num_pg) break;
-
-        if ((((ulong)&entry[i]) % cpu_caches.dline_size) == 0) {
-            last_flush = (ulong)&entry[i - 1];
-            dcbst(last_flush);
-        }
-    }
-    dcbst((ulong) &entry[i - 1]);
-}
-
-static void dart_clear(ulong index, ulong num_pg)
-{
-    u32 *entry = dart_table + index;
-    ulong i = 0;
-    ulong rpg = dummy_page;
-    ulong last_flush = 0;
-
-    while (1) {
-        entry[i] = dart_encode(DART_READ | DART_WRITE, rpg);
-        ++i;
-        if (i == num_pg) break;
-
-        if ((((ulong)&entry[i]) % cpu_caches.dline_size) == 0) {
-            last_flush = (ulong)&entry[i - 1];
-            dcbst(last_flush);
-        }
-    }
-    dcbst((ulong)&entry[i - 1]);
-}
-
-static int dart_put(ulong ioba, union tce tce)
-{
-    ulong index = ioba >> PAGE_SHIFT;
-
-    if (index > dart_entries) {
-        return -1;
-    }
-
-    if (tce.tce_bits.tce_vlps  != 0 || tce.tce_bits.tce_lpx != 0) {
-        panic("no support for large TCEs\n");
-    }
-
-    if (tce.tce_bits.tce_read == 0 &&
-        tce.tce_bits.tce_write == 0) {
-        /* the TCE table is inited by the domain by a bunch of 0
-         * perminssion puts.  We are only interesting in debugging the
-         * ones after the first put */
-        DBG_AFTER(">DART[0x%lx] clear\n", index);
-        dart_clear(index, 1);
-    } else {
-        unsigned perm = 0;
-
-        if (tce.tce_bits.tce_read)
-            perm |= DART_READ;
-        if (tce.tce_bits.tce_write)
-            perm |= DART_WRITE;
-
-        DBG("<DART[0x%lx]: ioba: 0x%lx perm:%x[%c%c] rpn:0x%lx\n",
-            index, ioba, perm,
-            (perm & DART_READ) ? 'R' : '-',
-            (perm & DART_WRITE) ? 'W' : '-',
-            (ulong)tce.tce_bits.tce_rpn);
-        DBG_SET_AFTER;
-
-        dart_fill(index, perm, tce.tce_bits.tce_rpn, 1);
-    }
-    dops->do_inv_entry(tce.tce_bits.tce_rpn);
-    
-    return 0;
-}
-
-static int find_dart(struct dart_info *di)
-{
-    int rc;
-    void *ofd_p;
-    ofdn_t n;
-    char compat[128];
-
-    if (on_systemsim()) {
-        DBG("%s: systemsim does not support a dart\n", __func__);
-        return -1;
-    }
-
-    ofd_p = (void *)oftree;
-    n = ofd_node_find(ofd_p, "/ht");
-    if (n <= 0)
-        return -1;
-
-    /* get the defaults from the HT node model */
-    rc = ofd_getprop(ofd_p, n, "compatible", compat, sizeof (compat));
-    if (rc <= 0)
-        return -1;
-
-    if (ofd_strstr(compat, rc, "u4"))
-        di->di_model = DART_U4;
-    else if (ofd_strstr(compat, rc, "u3"))
-        di->di_model = DART_U3;
-    else {
-        DBG("%s: not a U3 or U4\n", __func__);
-        return -1;
-    }
-        
-    di->di_base = DART_DEF_BASE;
-
-    /* FIXME: this should actually be the HT reg value */
-    di->di_window.dw_liobn = 0;
-    di->di_window.dw_base_hi = 0;
-    di->di_window.dw_base = 0;
-
-    /* lets see if the devtree has more info */
-    n = ofd_node_find(ofd_p, "/dart");
-    if (n > 0) {
-        ulong base;
-
-        rc = ofd_getprop(ofd_p, n, "compatible", compat, sizeof (compat));
-        if (rc > 0) {
-            if (strstr(compat, "u4")) {
-                di->di_model = DART_U4;
-            }
-        }
-
-        rc = ofd_getprop(ofd_p, n, "reg", &base, sizeof (base));
-        if (rc > 0) {
-            di->di_base = base;
-        }
-    }
-    return 0;
-}
-
-static int init_dart(void)
-{
-    ulong log_pgs;
-    void *ofd_p;
-    ofdn_t n;
-    struct dart_info di;
-
-    if (find_dart(&di))
-        return 0;
-
-    /* Max size of 512 pages == 2MB == 1<<21. That siz is good enough for U4 */
-    log_pgs = U3_LOG_MAX_PAGES;
-    dart_table = alloc_xenheap_pages(log_pgs);
-    BUG_ON(dart_table == NULL);
-
-    dart_entries = (1UL << (log_pgs + PAGE_SHIFT)) / sizeof (union dart_entry);
-    di.di_window.dw_size = dart_entries << PAGE_SHIFT;
-
-    /* Linux uses a dummy page, filling "empty" DART entries with a
-       reference to this page to capture stray DMA's */
-    dummy_page = (ulong)alloc_xenheap_pages(0);
-    clear_page((void *)dummy_page);
-    dummy_page >>= PAGE_SHIFT;
-
-    printk("Initializing DART 0x%lx: tbl: %p[0x%lx] entries: 0x%lx\n",
-           di.di_base, dart_table, 1UL << log_pgs, dart_entries);
-           
-    /* register this iommu */
-    iommu_register(di.di_window.dw_liobn, dart_put);
-
-    switch (di.di_model) {
-    case DART_U3:
-        dops = u3_init(di.di_base, (ulong)dart_table, 1UL << log_pgs);
-        break;
-    case DART_U4:
-        dops = u4_init(di.di_base, (ulong)dart_table, 1UL << log_pgs);
-        break;
-    }
-
-    dart_clear(0, dart_entries);
-    dops->do_inv_all();
-
-    /* fix up the devtree */
-    ofd_p = (void *)oftree;
-    n = ofd_node_find(ofd_p, "/ht");
-    if (n > 0) {
-        di.di_window.dw_size = dart_entries << PAGE_SHIFT;
-        ofd_prop_add(ofd_p, n, "ibm,dma-window", &di.di_window,
-                     sizeof (di.di_window));
-    } else {
-        panic("%s: no /ht node\n", __func__);
-    }
-    return 0;
-}
-__initcall(init_dart);
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/dart.h
--- a/xen/arch/powerpc/dart.h   Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * 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 (C) IBM Corp. 2005
- *
- * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- */
-
-#ifndef _DART_H
-#define _DART_H
-
-#include <xen/config.h>
-#include <xen/types.h>
-
-struct dart_ops {
-    void (*do_inv_all)(void);
-    void (*do_inv_entry)(ulong pg);
-};
-
-extern struct dart_ops *u3_init(ulong base, ulong table, ulong dart_pages);
-extern struct dart_ops *u4_init(ulong base, ulong table, ulong dart_pages);
-
-#endif /* _DART_H */
-
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/dart_u3.c
--- a/xen/arch/powerpc/dart_u3.c        Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
- * 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 (C) IBM Corp. 2005
- *
- * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- */
-
-#undef DEBUG
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/sched.h>
-#include <xen/mm.h>
-#include <public/xen.h>
-#include <asm/io.h>
-#include <asm/current.h>
-#include "tce.h"
-#include "iommu.h"
-#include "dart.h"
-
-union dart_ctl {
-    u32 dc_word;
-    struct {
-        u32 dc_base:20;
-        u32 dc_stop_access:1;
-        u32 dc_invtlb:1;
-        u32 dc_enable:1;
-        u32 dc_size:9;
-    } reg;
-};
-
-static u32 volatile *dart_ctl_reg;
-
-static void u3_inv_all(void)
-{
-    union dart_ctl dc;
-    ulong r = 0;
-    int l = 0;
-
-    for (;;) {
-        dc.dc_word = in_32(dart_ctl_reg);
-        dc.reg.dc_invtlb = 1;
-        out_32(dart_ctl_reg, dc.dc_word);
-
-        do {
-            dc.dc_word = in_32(dart_ctl_reg);
-            r++;
-        } while ((dc.reg.dc_invtlb == 1) && (r < (1 << l)));
-
-        if (r == (1 << l)) {
-            if (l < 4) {
-                l++;
-                dc.dc_word = in_32(dart_ctl_reg);
-                dc.reg.dc_invtlb = 0;
-                out_32(dart_ctl_reg, dc.dc_word);
-                continue;
-            } else {
-                panic(" broken U3???\n");
-            }
-        }
-        return;
-    }
-}
-
-static void u3_inv_entry(ulong pg)
-{
-    /* sadly single entry invalidation has been reported not to work */
-    u3_inv_all();
-}
-
-static struct dart_ops u3_ops = {
-    .do_inv_all = u3_inv_all,
-    .do_inv_entry = u3_inv_entry,
-};
-
-struct dart_ops *u3_init(ulong base, ulong table, ulong dart_pages)
-{
-    union dart_ctl dc;
-
-    dart_ctl_reg = (u32 *)base;
-
-    dc.dc_word = 0;
-
-    dc.reg.dc_base = table >> PAGE_SHIFT;
-    dc.reg.dc_size = dart_pages;
-    dc.reg.dc_enable = 1;
-
-
-    printk("Initializing DART Model U3: reg: %p word: %x\n",
-           dart_ctl_reg, dc.dc_word);
-
-    out_32(dart_ctl_reg, dc.dc_word);
-
-    return &u3_ops;
-}
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/dart_u4.c
--- a/xen/arch/powerpc/dart_u4.c        Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-/*
- * 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 (C) IBM Corp. 2005
- *
- * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- */
-
-#undef DEBUG
-#define INVALIDATE_ALL
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/sched.h>
-#include <xen/init.h>
-#include <xen/mm.h>
-#include <public/xen.h>
-#include <asm/io.h>
-#include <asm/current.h>
-#include "tce.h"
-#include "iommu.h"
-#include "dart.h"
-
-#define TOO_MANY_RETRIES ~0
-
-union dart_ctl {
-    u32 dc_word;
-    struct {
-        u32 dc_darten:1;      /* DART Enable (0:disabled) */
-        u32 dc_ione:1;        /* Invalidate one DART TLB entry (using ILPN) */
-        u32 dc_iall:1;        /* Invalidate all DART TLB entries */
-        u32 dc_idle:1;        /* DART is idle */
-        u32 dc_peen:1;        /* Parity Checking is enabled */
-        u32 dc_ilpn:27;       /* 27-bit Logical Page Address for 
-                               * invalidating one TLB entry */
-    } dc_bits;
-};
-
-union dart_base {
-    u32 db_word;
-    struct {
-        u32 _db_resv:8;
-        u32 db_dartbase:24;     /* Base Address of DART (4K byte Alignment) */
-    } db_bits;
-};
-
-union dart_size {
-    u32 ds_word;
-    struct {
-        u32 _ds_resv:15;
-        u32 ds_dartsize:17;     /* Size of Dart in 4K-Byte Pages */
-    } ds_bits;
-};
-
-union dart_excp {
-    u32 de_word;
-    struct {
-        u32 de_rqsrc:1;    /* Request Source.  [0:PCIE, 1:HT] */
-        u32 de_lpn:27;     /* 27Ðbit Logical Address of Exception [25:51] */
-        u32 de_rqop:1;     /* Request operation.  [0:Read, 1:Write] */
-        u32 de_xcd:3;      /* Exception code */
-    } de_bits;
-};
-
-struct dart {
-    /* 0x00 */
-    union dart_ctl d_dartcntl;
-    u32 _pad0x04_0x10[3];
-    /* 0x10 */
-    union dart_base d_dartbase;
-    u32 _pad0x14_0x20[3];
-    /* 0x20 */
-    union dart_size d_dartsize;
-    u32 _pad0x24_0x30[3];
-    /* 0x30 */
-    union dart_excp d_dartexcp;
-    u32 _pad0x34_0x40[3];
-};
-
-static volatile struct dart *dart;
-
-static void u4_inv_all(void)
-{
-    union dart_ctl dc;
-    ulong r = 0;
-    int l = 0;
-
-    for (;;) {
-        dc.dc_word = in_32(&dart->d_dartcntl.dc_word);
-        dc.dc_bits.dc_iall = 1;
-        out_32(&dart->d_dartcntl.dc_word, dc.dc_word);
-
-        do {
-            dc.dc_word = in_32(&dart->d_dartcntl.dc_word);
-            r++;
-        } while ((dc.dc_bits.dc_iall == 1) && (r < (1 << l)));
-
-        if (r == (1 << l)) {
-            if (l < 4) {
-                l++;
-                dc.dc_word = in_32(&dart->d_dartcntl.dc_word);
-                dc.dc_bits.dc_iall = 0;
-                out_32(&dart->d_dartcntl.dc_word, dc.dc_word);
-                continue;
-            } else {
-                panic(" broken U4???\n");
-            }
-        }
-        return;
-    }
-}
-
-static void u4_inv_entry(ulong pgn)
-{
-#ifdef INVALIDATE_ALL
-    return u4_inv_all();
-#else
-    union dart_ctl dc;
-    ulong retries = 0;
-
-    return u4_inv_all();
-
-    dc.dc_word = in_32(&dart->d_dartcntl.dc_word);
-    dc.dc_bits.dc_ilpn = pgn;
-    dc.dc_bits.dc_ione = 1;
-    out_32(&dart->d_dartcntl.dc_word, dc.dc_word);
-
-    /* wait for completion */
-    /* FIXME: since we do this from the HV do we need to wait?! */
-    do {
-        dc.dc_word = in_32(&dart->d_dartcntl.dc_word);
-        retries++;
-        if (retries > 1000000)
-            panic("WAY! too long\n");
-    } while (dc.dc_bits.dc_ione != 0);
-#endif
-}
-
-static struct dart_ops u4_ops = {
-    .do_inv_all = u4_inv_all,
-    .do_inv_entry = u4_inv_entry,
-};
-
-struct dart_ops *u4_init(ulong base, ulong table, ulong dart_pages)
-{
-    union dart_base db;
-    union dart_size ds;
-    union dart_ctl dc;
-
-    dart = (struct dart *)base;
-
-    db.db_word = 0;
-    db.db_bits.db_dartbase = table >> PAGE_SHIFT;
-
-    ds.ds_word = 0;
-    ds.ds_bits.ds_dartsize = dart_pages;
-
-    dc.dc_word = in_32(&dart->d_dartcntl.dc_word);
-    if (dc.dc_bits.dc_darten == 1) {
-        panic("%s: dart is already enabled: 0x%x\n", __func__, dc.dc_word);
-    }
-    dc.dc_bits.dc_darten = 1;   /* enable it */
-
-    printk("Initializing DART Model U4: ctl: 0x%x base: 0x%x size: 0x%x\n",
-           dc.dc_word, db.db_word, ds.ds_word);
-
-    out_32(&dart->d_dartbase.db_word, db.db_word);
-    out_32(&dart->d_dartsize.ds_word, ds.ds_word);
-    out_32(&dart->d_dartcntl.dc_word, dc.dc_word);
-
-    return &u4_ops;
-}
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/domain.c
--- a/xen/arch/powerpc/domain.c Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,357 +0,0 @@
-/*
- * 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. 2005, 2006, 2007
- *
- * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- *          Ryan Harper <ryanh@xxxxxxxxxx>
- *          Hollis Blanchard <hollisb@xxxxxxxxxx>
- */
-
-#include <stdarg.h>
-#include <xen/config.h>
-#include <xen/lib.h>
-#include <xen/sched.h>
-#include <xen/mm.h>
-#include <xen/serial.h>
-#include <xen/domain.h>
-#include <xen/console.h>
-#include <xen/shutdown.h>
-#include <xen/paging.h>
-#include <xen/mm.h>
-#include <xen/softirq.h>
-#include <asm/htab.h>
-#include <asm/current.h>
-#include <asm/hcalls.h>
-#include "rtas.h"
-#include "exceptions.h"
-
-#define next_arg(fmt, args) ({                                              \
-    unsigned long __arg;                                                    \
-    switch ( *(fmt)++ )                                                     \
-    {                                                                       \
-    case 'i': __arg = (unsigned long)va_arg(args, unsigned int);  break;    \
-    case 'l': __arg = (unsigned long)va_arg(args, unsigned long); break;    \
-    case 'p': __arg = (unsigned long)va_arg(args, void *);        break;    \
-    case 'h': __arg = (unsigned long)va_arg(args, void *);        break;    \
-    default:  __arg = 0; BUG();                                             \
-    }                                                                       \
-    __arg;                                                                  \
-})
-
-unsigned long hypercall_create_continuation(unsigned int op,
-        const char *format, ...)
-{
-    struct cpu_user_regs *regs = guest_cpu_user_regs();
-    const char *p = format;
-    va_list args;
-    int gprnum = 4;
-    int i;
-
-    va_start(args, format);
-
-    regs->pc -= 4; /* re-execute 'sc' */
-
-    for (i = 0; *p != '\0'; i++) {
-        regs->gprs[gprnum++] = next_arg(p, args);
-    }
-
-    va_end(args);
-
-    /* As luck would have it, we use the same register for hcall opcodes and
-     * for hcall return values. The return value from this function is placed
-     * in r3 on return, so modifying regs->gprs[3] would have no effect. */
-    return XEN_MARK(op);
-}
-
-int arch_domain_create(struct domain *d, unsigned int domcr_flags)
-{
-    if (d->domain_id == IDLE_DOMAIN_ID) {
-        d->shared_info = (void *)alloc_xenheap_page();
-        clear_page(d->shared_info);
-
-        return 0;
-    }
-
-    d->arch.large_page_sizes = cpu_large_page_orders(
-        d->arch.large_page_order, ARRAY_SIZE(d->arch.large_page_order));
-
-    d->arch.foreign_mfn_count = 2048;
-    d->arch.foreign_mfns = xmalloc_array(uint, d->arch.foreign_mfn_count);
-    BUG_ON(d->arch.foreign_mfns == NULL);
-
-    memset(d->arch.foreign_mfns, -1, d->arch.foreign_mfn_count * sizeof(uint));
-
-    return 0;
-}
-
-void arch_domain_destroy(struct domain *d)
-{
-    shadow_teardown(d);
-    /* shared_info is part of the RMA so no need to release it */
-}
-
-static void machine_fail(const char *s)
-{
-    printk("%s failed, manual powercycle required!\n"
-           "  spinning....\n", s);
-    for (;;)
-        sleep();
-}
-void machine_halt(void)
-{
-    console_start_sync();
-    printk("%s called\n", __func__);
-    rtas_halt();
-
-    machine_fail(__func__);
-}
-
-void machine_restart(void)
-{
-    console_start_sync();
-    printk("%s called\n", __func__);
-    rtas_reboot();
-    machine_fail(__func__);
-}
-
-struct vcpu *alloc_vcpu_struct(void)
-{
-    struct vcpu *v;
-    if ( (v = xmalloc(struct vcpu)) != NULL )
-        memset(v, 0, sizeof(*v));
-    return v;
-}
-
-void free_vcpu_struct(struct vcpu *v)
-{
-    xfree(v);
-}
-
-int vcpu_initialise(struct vcpu *v)
-{
-    /* Guests by default have a 100Hz ticker. */
-    v->periodic_period = MILLISECS(10);
-    return 0;
-}
-
-void vcpu_destroy(struct vcpu *v)
-{
-}
-
-int arch_set_info_guest(struct vcpu *v, vcpu_guest_context_u c)
-{ 
-    struct domain *d = v->domain;
-
-    memcpy(&v->arch.ctxt, &c.nat->user_regs, sizeof(c.nat->user_regs));
-
-    printk("Domain[%d].%d: initializing\n", d->domain_id, v->vcpu_id);
-
-    if (d->arch.htab.order == 0)
-        panic("Page table never allocated for Domain: %d\n", d->domain_id);
-    if (d->arch.rma_order == 0)
-        panic("RMA never allocated for Domain: %d\n", d->domain_id);
-
-    d->shared_info->wc_sec = dom0->shared_info->wc_sec;
-    d->shared_info->wc_nsec = dom0->shared_info->wc_nsec;
-    d->shared_info->arch.boot_timebase = dom0->shared_info->arch.boot_timebase;
-
-    if ( !v->is_initialised )
-    {
-        v->is_initialised = 1;
-        /* Auto-online VCPU0 when it is initialised. */
-        if ( v->vcpu_id == 0 )
-            clear_bit(_VPF_down, &v->pause_flags);
-    }
-
-    cpu_init_vcpu(v);
-
-    return 0;
-}
-
-int arch_vcpu_reset(struct vcpu *v)
-{
-    panic("%s: called for Dom%d[%d]\n",
-          __func__, v->domain->domain_id, v->vcpu_id);
-    return 0;
-}
-
-void dump_pageframe_info(struct domain *d)
-{
-    struct page_info *page;
-
-    printk("Memory pages belonging to domain %u:\n", d->domain_id);
-
-    if ( d->tot_pages >= 10 )
-    {
-        printk("    DomPage list too long to display\n");
-    }
-    else
-    {
-        list_for_each_entry ( page, &d->page_list, list )
-        {
-            printk("    DomPage %p: mfn=%p, caf=%016lx, taf=%" PRtype_info 
"\n",
-                   _p(page_to_maddr(page)), _p(page_to_mfn(page)),
-                   page->count_info, page->u.inuse.type_info);
-        }
-    }
-
-    list_for_each_entry ( page, &d->xenpage_list, list )
-    {
-        printk("    XenPage %p: mfn=%p, caf=%016lx, taf=%" PRtype_info "\n",
-               _p(page_to_maddr(page)), _p(page_to_mfn(page)),
-               page->count_info, page->u.inuse.type_info);
-    }
-}
-
-void context_switch(struct vcpu *prev, struct vcpu *next)
-{
-    struct cpu_user_regs *stack_regs = guest_cpu_user_regs();
-    cpumask_t dirty_mask = next->vcpu_dirty_cpumask;
-    unsigned int cpu = smp_processor_id();
-
-#if 0
-    printk("%s: dom %x to dom %x\n", __func__, prev->domain->domain_id,
-            next->domain->domain_id);
-#endif
-
-    /* Allow at most one CPU at a time to be dirty. */
-    ASSERT(cpus_weight(dirty_mask) <= 1);
-    if (unlikely(!cpu_isset(cpu, dirty_mask) && !cpus_empty(dirty_mask)))
-    {
-        /* Other cpus call __sync_lazy_execstate from flush ipi handler. */
-        if (!cpus_empty(next->vcpu_dirty_cpumask))
-            flush_tlb_mask(next->vcpu_dirty_cpumask);
-    }
-
-    /* copy prev guest state off the stack into its vcpu */
-    memcpy(&prev->arch.ctxt, stack_regs, sizeof(struct cpu_user_regs));
-
-    set_current(next);
-
-    /* copy next guest state onto the stack */
-    memcpy(stack_regs, &next->arch.ctxt, sizeof(struct cpu_user_regs));
-
-    /* save old domain state */
-    save_sprs(prev);
-    save_float(prev);
-    save_segments(prev);
-
-    context_saved(prev);
-
-    /* load up new domain */
-    load_sprs(next);
-    load_float(next);
-    load_segments(next);
-
-    mtsdr1(next->domain->arch.htab.sdr1);
-    local_flush_tlb(); /* XXX maybe flush_tlb_mask? */
-    cpu_flush_icache();
-
-    if (is_idle_vcpu(next)) {
-        reset_stack_and_jump(idle_loop);
-    }
-
-    reset_stack_and_jump(full_resume);
-    /* not reached */
-}
-
-void continue_running(struct vcpu *same)
-{
-    /* nothing to do */
-    return;
-}
-
-void sync_vcpu_execstate(struct vcpu *v)
-{
-    /* do nothing */
-    return;
-}
-
-static void relinquish_memory(struct domain *d, struct list_head *list)
-{
-    struct list_head *ent;
-    struct page_info  *page;
-
-    /* Use a recursive lock, as we may enter 'free_domheap_page'. */
-    spin_lock_recursive(&d->page_alloc_lock);
-
-    ent = list->next;
-    while ( ent != list )
-    {
-        page = list_entry(ent, struct page_info, list);
-
-        /* Grab a reference to the page so it won't disappear from under us. */
-        if ( unlikely(!get_page(page, d)) )
-        {
-            /* Couldn't get a reference -- someone is freeing this page. */
-            ent = ent->next;
-            continue;
-        }
-        if ( test_and_clear_bit(_PGT_pinned, &page->u.inuse.type_info) )
-            put_page_and_type(page);
-
-        if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
-            put_page(page);
-
-        /* Follow the list chain and /then/ potentially free the page. */
-        ent = ent->next;
-        put_page(page);
-    }
-    spin_unlock_recursive(&d->page_alloc_lock);
-}
-
-int domain_relinquish_resources(struct domain *d)
-{
-    relinquish_memory(d, &d->xenpage_list);
-    relinquish_memory(d, &d->page_list);
-    xfree(d->arch.foreign_mfns);
-    xfree(d->arch.p2m);
-    return 0;
-}
-
-void arch_dump_domain_info(struct domain *d)
-{
-}
-
-void arch_dump_vcpu_info(struct vcpu *v)
-{
-}
-
-static void safe_halt(void)
-{
-    int cpu = smp_processor_id();
-
-    while (!softirq_pending(cpu))
-        sleep();
-}
-
-static void default_idle(void)
-{
-    local_irq_disable();
-    if ( !softirq_pending(smp_processor_id()) )
-        safe_halt();
-    else
-        local_irq_enable();
-}
-
-void idle_loop(void)
-{
-    for ( ; ; ) {
-        page_scrub_schedule_work();
-        default_idle();
-        do_softirq();
-    }
-}
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/domain_build.c
--- a/xen/arch/powerpc/domain_build.c   Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,297 +0,0 @@
-/*
- * 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. 2005, 2007
- *
- * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- *          Ryan Harper <ryanh@xxxxxxxxxx>
- *          Hollis Blanchard <hollisb@xxxxxxxxxx>
- */
-
-#include <xen/config.h>
-#include <xen/lib.h>
-#include <xen/sched.h>
-#include <xen/init.h>
-#include <xen/ctype.h>
-#include <xen/iocap.h>
-#include <xen/domain.h>
-#include <xen/version.h>
-#include <xen/paging.h>
-#include <asm/processor.h>
-#include <asm/platform.h>
-#include <asm/papr.h>
-#include <public/arch-powerpc.h>
-#include <public/libelf.h>
-#include "oftree.h"
-
-/* opt_dom0_mem: memory allocated to domain 0. */
-static unsigned int dom0_nrpages;
-static void parse_dom0_mem(char *s)
-{
-    unsigned long long bytes;
-
-    bytes = parse_size_and_unit(s, NULL);
-    dom0_nrpages = bytes >> PAGE_SHIFT;
-}
-custom_param("dom0_mem", parse_dom0_mem);
-
-static unsigned int opt_dom0_max_vcpus;
-integer_param("dom0_max_vcpus", opt_dom0_max_vcpus);
-
-static unsigned int opt_dom0_shadow;
-boolean_param("dom0_shadow", opt_dom0_shadow);
-
-/* adapted from common/elf.c */
-#define RM_MASK(a,l) ((a) & ((1UL << (l)) - 1))
-
-int construct_dom0(struct domain *d,
-                   unsigned long image_start, unsigned long image_len, 
-                   unsigned long initrd_start, unsigned long initrd_len,
-                   char *cmdline)
-{
-    struct elf_binary elf;
-    struct elf_dom_parms parms;
-    int rc;
-    struct vcpu *v;
-    ulong dst;
-    u64 *ofh_tree;
-    ulong firmware_base;
-    uint rma_nrpages = 1 << cpu_default_rma_order_pages();
-    ulong rma_sz;
-    ulong rma;
-    ulong eomem;
-    int preempt = 0;
-    int vcpu;
-    ulong mod_start = 0;
-    ulong mod_len = 0;
-    ulong shared_info_addr;
-    uint extent_size = 1 << cpu_extent_order();
-    ulong sz;
-
-    /* Sanity! */
-    BUG_ON(d->domain_id != 0);
-
-    if (image_len == 0)
-        panic("No Dom0 image supplied\n");
-
-    printk("*** LOADING DOMAIN 0 ***\n");
-
-    /* default is the max(1/16th of memory, CONFIG_MIN_DOM0_PAGES) */
-    if (dom0_nrpages == 0) {
-        dom0_nrpages = total_pages >> 4;
-
-        if (dom0_nrpages < CONFIG_MIN_DOM0_PAGES)
-            dom0_nrpages = CONFIG_MIN_DOM0_PAGES;
-    }
-
-    /* Dom0 has to be at least RMA size. */
-    if (dom0_nrpages < rma_nrpages) {
-        dom0_nrpages = rma_nrpages;
-        printk("Increasing DOM0 memory size to %u MiB for RMA.\n", 
-                ((rma_nrpages << PAGE_SHIFT) >> 20));
-    }
-
-    /* Ensure Dom0 is cpu_extent_order aligned. Round up if 
-       not and let user know we did so. */
-    if (dom0_nrpages != ALIGN_UP(dom0_nrpages, extent_size)) {
-        dom0_nrpages = ALIGN_UP(dom0_nrpages, extent_size);
-        printk("Increasing DOM0 memory size to %u MiB for large pages.\n", 
-                ((dom0_nrpages << PAGE_SHIFT) >> 20));
-    }
-
-    /* XXX Dom0 currently can't extend past the IO hole. */
-    if (dom0_nrpages > (platform_iohole_base() >> PAGE_SHIFT)) {
-        dom0_nrpages = (platform_iohole_base() >> PAGE_SHIFT);
-        printk("Limiting DOM0 memory size to %u MiB to avoid IO hole.\n", 
-                ((dom0_nrpages << PAGE_SHIFT) >> 20));
-    }
-
-    /* Set Dom0 max mem, triggering p2m table creation. */
-    if ((guest_physmap_max_mem_pages(d, dom0_nrpages)) != 0)
-        panic("Failed to set DOM0 max mem pages value\n");
-
-    d->max_pages = dom0_nrpages;
-    if (0 > allocate_rma(d, cpu_default_rma_order_pages()))
-        panic("Error allocating domain 0 RMA\n");
-
-    rma_sz = rma_size(d->arch.rma_order);
-    rma = page_to_maddr(d->arch.rma_page);
-
-    /* If we are bigger than RMA, allocate extents. */
-    if (dom0_nrpages > rma_nrpages)
-        dom0_nrpages = allocate_extents(d, dom0_nrpages, rma_nrpages);
-
-    ASSERT(d->tot_pages == dom0_nrpages);
-    ASSERT(d->tot_pages >= rma_nrpages);
-
-    if (opt_dom0_shadow == 0) {
-        /* 1/64 of memory  */
-        opt_dom0_shadow = (d->tot_pages >> 6) >> (20 - PAGE_SHIFT);
-    }
-
-    do {
-        shadow_set_allocation(d, opt_dom0_shadow, &preempt);
-    } while (preempt);
-    if (shadow_get_allocation(d) == 0)
-        panic("shadow allocation failed: %dMib\n", opt_dom0_shadow);
-
-    ASSERT( image_len < rma_sz );
-
-    eomem = ((ulong)d->shared_info) - rma;
-    printk("shared_info: 0x%lx,%p\n", eomem, d->shared_info);
-
-    /* startup secondary processors */
-    if ( opt_dom0_max_vcpus == 0 )
-        opt_dom0_max_vcpus = num_online_cpus();
-    if ( opt_dom0_max_vcpus > num_online_cpus() )
-        opt_dom0_max_vcpus = num_online_cpus();
-    if ( opt_dom0_max_vcpus > MAX_VIRT_CPUS )
-        opt_dom0_max_vcpus = MAX_VIRT_CPUS;
-#ifdef BITS_PER_GUEST_LONG
-    if ( opt_dom0_max_vcpus > BITS_PER_GUEST_LONG(d) )
-        opt_dom0_max_vcpus = BITS_PER_GUEST_LONG(d);
-#endif
-    printk("Dom0 has maximum %u VCPUs\n", opt_dom0_max_vcpus);
-
-    for (vcpu = 0; vcpu < opt_dom0_max_vcpus; vcpu++) {
-        if (NULL == alloc_vcpu(dom0, vcpu, vcpu))
-            panic("Error creating domain 0 vcpu %d\n", vcpu);
-        /* for now we pin Dom0 VCPUs to their coresponding CPUs */
-        if (cpu_isset(vcpu, cpu_online_map))
-            dom0->vcpu[vcpu]->cpu_affinity = cpumask_of_cpu(vcpu);
-    }
-
-    /* Init VCPU0. */
-    v = d->vcpu[0];
-    cpu_init_vcpu(v);
-
-    /* convert xen pointer shared_info into guest physical */
-    shared_info_addr = (ulong)d->shared_info - page_to_maddr(d->arch.rma_page);
-
-    /* start loading stuff */
-    rc = elf_init(&elf, (void *)image_start, image_len);
-    if (rc)
-        return rc;
-#ifdef VERBOSE
-    elf_set_verbose(&elf);
-#endif
-    elf_parse_binary(&elf);
-    if (0 != (elf_xen_parse(&elf, &parms)))
-        return rc;
-
-    printk("Dom0 kernel: %s, paddr 0x%" PRIx64 " -> 0x%" PRIx64 "\n",
-            elf_64bit(&elf) ? "64-bit" : "32-bit",
-            elf.pstart, elf.pend);
-
-    /* elf contains virtual addresses that can have the upper bits
-     * masked while running in real mode, so we do the masking as well
-     * as well */
-    parms.virt_kend = RM_MASK(parms.virt_kend, 42);
-    parms.virt_entry = RM_MASK(parms.virt_entry, 42);
-
-    /* set the MSR bit correctly */
-    if (elf_64bit(&elf))
-        v->arch.ctxt.msr = MSR_SF;
-    else
-        v->arch.ctxt.msr = 0;
-
-    /* Load the dom0 kernel. */
-    elf.dest = (void *)(parms.virt_kstart + rma);
-
-    elf_load_binary(&elf);
-    v->arch.ctxt.pc = parms.virt_entry;
-
-    dst = ALIGN_UP(parms.virt_kend + rma, PAGE_SIZE);
-
-    /* Load the initrd. */
-    if (initrd_len > 0) {
-        ASSERT((dst - rma) + image_len < eomem);
-
-        printk("loading initrd: 0x%lx, 0x%lx\n", dst, initrd_len);
-        memcpy((void *)dst, (void *)initrd_start, initrd_len);
-
-        mod_start = dst - rma;
-        mod_len = image_len;
-
-        dst = ALIGN_UP(dst + initrd_len, PAGE_SIZE);
-    } else {
-        printk("no initrd\n");
-    }
-
-    v->arch.ctxt.gprs[3] = mod_start;
-    v->arch.ctxt.gprs[4] = mod_len;
-
-    /* OF usually sits here:
-     *   - Linux needs it to be loaded before the vmlinux or initrd
-     *   - AIX demands it to be @ 32M.
-     */
-    firmware_base = (32 << 20);
-    if (dst - rma > firmware_base)
-    panic("Firmware [0x%lx] will over-write images ending: 0x%lx\n",
-          firmware_base, dst - rma);
-    dst = firmware_base + rma;
-
-    /* Put stack below firmware. */
-    v->arch.ctxt.gprs[1] = dst - rma - STACK_FRAME_OVERHEAD;
-    v->arch.ctxt.gprs[2] = 0;
-
-    ASSERT((dst - rma) + (ulong)firmware_image_size < eomem);
-    printk("loading OFH: 0x%lx, RMA: 0x%lx\n", dst, dst - rma);
-    memcpy((void *)dst, firmware_image_start, (ulong)firmware_image_size);
-
-    v->arch.ctxt.gprs[5] = (dst - rma);
-    ofh_tree = (u64 *)(dst + 0x10);
-    ASSERT(*ofh_tree == 0xdeadbeef00000000);
-
-    /* accomodate for a modest bss section */
-    dst = ALIGN_UP(dst + (ulong)firmware_image_size + PAGE_SIZE, PAGE_SIZE);
-
-    ASSERT((dst - rma) + oftree_len < eomem);
-
-    *ofh_tree = dst - rma;
-    printk("loading OFD: 0x%lx RMA: 0x%lx, 0x%lx\n", dst, dst - rma,
-           oftree_len);
-    memcpy((void *)dst, (void *)oftree, oftree_len);
-
-    /* fixup and add stuff for dom0 */
-    sz = ofd_dom0_fixup(d, *ofh_tree + rma, cmdline, shared_info_addr);
-    printk("modified OFD size: 0x%lx\n", sz);
-    dst = ALIGN_UP(dst + sz + PAGE_SIZE, PAGE_SIZE);
-
-       printk("dom0 initial register state:\n"
-                       "    pc %016lx msr %016lx\n"
-                       "    r1 %016lx r2 %016lx r3 %016lx\n"
-                       "    r4 %016lx r5 %016lx\n",
-                       v->arch.ctxt.pc,
-                       v->arch.ctxt.msr,
-                       v->arch.ctxt.gprs[1],
-                       v->arch.ctxt.gprs[2],
-                       v->arch.ctxt.gprs[3],
-                       v->arch.ctxt.gprs[4],
-                       v->arch.ctxt.gprs[5]);
-
-    v->is_initialised = 1;
-    clear_bit(_VPF_down, &v->pause_flags);
-
-    rc = 0;
-
-    /* DOM0 is permitted full I/O capabilities. */
-    rc |= iomem_permit_access(dom0, 0UL, ~0UL);
-    rc |= irqs_permit_access(dom0, 0, NR_IRQS-1);
-
-    BUG_ON(rc != 0);
-
-    return 0;
-}
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/domctl.c
--- a/xen/arch/powerpc/domctl.c Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*
- * 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. 2005, 2007
- *
- * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- *          Ryan Harper <ryanh@xxxxxxxxxx>
- */
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/lib.h>
-#include <xen/sched.h>
-#include <xen/domain.h>
-#include <xen/guest_access.h>
-#include <xen/paging.h>
-#include <public/xen.h>
-#include <public/domctl.h>
-#include <public/sysctl.h>
-#include <asm/processor.h>
-
-void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
-{ 
-    memcpy(&c.nat->user_regs, &v->arch.ctxt, sizeof(struct cpu_user_regs));
-    /* XXX fill in rest of vcpu_guest_context_t */
-}
-
-long arch_do_domctl(struct xen_domctl *domctl,
-                    XEN_GUEST_HANDLE(xen_domctl_t) u_domctl);
-long arch_do_domctl(struct xen_domctl *domctl,
-                    XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
-{
-    long ret = 0;
-
-    switch (domctl->cmd) {
-    case XEN_DOMCTL_getmemlist:
-    {
-        int i;
-        struct domain *d = get_domain_by_id(domctl->domain);
-        unsigned long max_pfns = domctl->u.getmemlist.max_pfns;
-        uint64_t mfn;
-
-        ret = -EINVAL;
-        if ( d != NULL )
-        {
-            ret = 0;
-
-            spin_lock(&d->page_alloc_lock);
-            for (i = 0; i < max_pfns; i++) {
-                /* bail if index is beyond p2m size */
-                if (i >= d->arch.p2m_entries)
-                    break;
-
-                /* translate */
-                mfn = d->arch.p2m[i];
-
-                if (copy_to_guest_offset(domctl->u.getmemlist.buffer,
-                                          i, &mfn, 1))
-                {
-                    ret = -EFAULT;
-                    break;
-                }
-            }
-            spin_unlock(&d->page_alloc_lock);
-
-            domctl->u.getmemlist.num_pfns = i;
-            copy_to_guest(u_domctl, domctl, 1);
-            
-            put_domain(d);
-        }
-    }
-    break;
-    case XEN_DOMCTL_shadow_op:
-    {
-        struct domain *d;
-        ret = -ESRCH;
-        d = get_domain_by_id(domctl->domain);
-        if ( d != NULL )
-        {
-            ret = shadow_domctl(d, &domctl->u.shadow_op, u_domctl);
-            put_domain(d);
-            copy_to_guest(u_domctl, domctl, 1);
-        } 
-    }
-    break;
-    case XEN_DOMCTL_real_mode_area:
-    {
-        struct domain *d;
-        unsigned int order = domctl->u.real_mode_area.log - PAGE_SHIFT;
-
-        ret = -ESRCH;
-        d = get_domain_by_id(domctl->domain);
-        if (d != NULL) {
-            ret = -EINVAL;
-            if (cpu_rma_valid(order))
-                ret = allocate_rma(d, order);
-            put_domain(d);
-        }
-    }
-    break;
-
-    default:
-        ret = -ENOSYS;
-        break;
-    }
-
-    return ret;
-}
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/exceptions.c
--- a/xen/arch/powerpc/exceptions.c     Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * 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 (C) IBM Corp. 2005, 2006
- *
- * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
- *          Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- */
-
-#include <xen/config.h>
-#include <xen/softirq.h>
-#include <xen/sched.h>
-#include <xen/serial.h>
-#include <xen/gdbstub.h>
-#include <xen/console.h>
-#include <xen/shutdown.h>
-#include <asm/time.h>
-#include <asm/processor.h>
-#include <asm/debugger.h>
-
-#undef DEBUG
-
-extern ulong ppc_do_softirq(ulong orig_msr);
-extern void do_timer(struct cpu_user_regs *regs);
-extern void do_dec(struct cpu_user_regs *regs);
-extern void program_exception(struct cpu_user_regs *regs,
-                              unsigned long cookie);
-extern int reprogram_timer(s_time_t timeout); 
-
-int hdec_sample = 0;
-
-void do_timer(struct cpu_user_regs *regs)
-{
-    /* Set HDEC high so it stops firing and can be reprogrammed by
-     * set_preempt() */
-    /* FIXME! HACK ALERT!
-     *
-     * We have a bug in that if we switch domains in schedule() we
-     * switch right away regardless of whatever else is pending.  This
-     * means that if the timer goes off while in schedule(), the next
-     * domain will be preempted by the interval defined below.  So
-     * until we fix our cotnext_switch(), the follow workaround will
-     * make sure that the domain we switch to does not run for to long
-     * so we can continue to service the other timers in the timer
-     * queue and that the value is long enough to escape this
-     * particular timer event.
-     */
-    reprogram_timer(NOW() + MILLISECS(1));
-
-    raise_softirq(TIMER_SOFTIRQ);
-}
-
-void do_dec(struct cpu_user_regs *regs)
-{
-    if (!(regs->msr & MSR_HV)) {
-        panic("HV dec from domain\n");
-    }
-    printk("DEC_HV: pc: 0x%lx lr: 0x%lx \n", regs->pc, regs->lr);
-    mtdec(INT_MAX);
-}
-
-void program_exception(struct cpu_user_regs *regs, unsigned long cookie)
-{
-    if (cookie == 0x200) {
-        if (cpu_machinecheck(regs))
-            return;
-
-        printk("%s: machine check\n", __func__);
-    } else {
-#ifdef CRASH_DEBUG
-        if (__trap_to_gdb(regs, cookie) == 0)
-            return;
-#endif /* CRASH_DEBUG */
-
-        printk("%s: type: 0x%lx\n", __func__, cookie);
-        show_backtrace_regs(regs);
-    }
-    machine_halt();
-}
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/exceptions.h
--- a/xen/arch/powerpc/exceptions.h     Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * 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. 2005, 2007
- *
- * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
- */
-
-#ifndef _ARCH_PPC_EXCEPTIONS_H_
-#define _ARCH_PPC_EXCEPTIONS_H_
-
-#include <xen/types.h>
-#include <public/xen.h>
-#include <xen/multiboot.h>
-
-extern void do_hcall(struct cpu_user_regs *regs);
-extern void do_IRQ(struct cpu_user_regs *regs);
-extern void deliver_ee(struct cpu_user_regs *regs);
-extern void do_external(struct cpu_user_regs *regs);
-extern void init_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 do_timer(struct cpu_user_regs *regs);
-extern void do_dec(struct cpu_user_regs *regs);
-extern void do_perfmon(struct cpu_user_regs *regs);
-extern void program_exception(
-    struct cpu_user_regs *regs, unsigned long cookie);
-
-extern long xen_hvcall_jump(struct cpu_user_regs *regs, ulong address);
-
-extern void sleep(void);
-extern void idle_loop(void);
-
-extern ulong *__hypercall_table[];
-
-extern char exception_vectors[];
-extern char exception_vectors_end[];
-extern int spin_start[];
-extern void secondary_cpu_init(int cpuid, unsigned long r4);
-#endif
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/external.c
--- a/xen/arch/powerpc/external.c       Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,202 +0,0 @@
-/*
- * 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 (C) IBM Corp. 2005, 2006
- *
- * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- */
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/sched.h>
-#include <xen/lib.h>
-#include <xen/event.h>
-#include <xen/irq.h>
-#include <public/xen.h>
-#include <asm/current.h>
-#include <asm/hardirq.h>
-#include <asm/mpic.h>
-#include "mpic_init.h"
-#include "exceptions.h"
-
-#undef DEBUG
-#ifdef DEBUG
-#define DBG(fmt...) printk(fmt)
-#else
-#define DBG(fmt...)
-#endif
-
-int vector_irq[NR_VECTORS] __read_mostly = { [0 ... NR_VECTORS - 1] = -1};
-
-unsigned long io_apic_irqs;
-int ioapic_ack_new = 1;
-
-/* deliver_ee: called with interrupts off when resuming every vcpu */
-void deliver_ee(struct cpu_user_regs *regs)
-{
-    const ulong srr_mask = ~(MSR_IR | MSR_DR | MSR_FE0 | MSR_FE1 | MSR_EE |
-                             MSR_RI |
-                             MSR_BE | MSR_FP | MSR_PMM | MSR_PR | MSR_SE);
-
-    BUG_ON(mfmsr() & MSR_EE);
-    BUG_ON(regs->msr & MSR_HV);
-
-    if (!local_events_need_delivery())
-        return;
-
-    /* XXX OS error: EE was set but RI was not. We could trigger a machine
-     * check, or kill the domain... for now just crash Xen so we notice. */
-    BUG_ON(!(regs->msr & MSR_RI));
-
-    regs->srr0 = regs->pc;
-    /* zero SRR1[33:36] and SRR1[42:47] */
-    regs->srr1 = regs->msr & ~0x00000000783f0000;
-    regs->pc = 0x500;
-    regs->msr &= srr_mask;
-    regs->msr |= MSR_SF | MSR_ME;
-
-    DBG("<HV: pc=0x%lx, msr=0x%lx\n", regs->pc, regs->msr);
-}
-
-void do_external(struct cpu_user_regs *regs)
-{
-    int vec;
-    static unsigned spur_count;
-
-    BUG_ON(!(regs->msr & MSR_EE));
-    BUG_ON(mfmsr() & MSR_EE);
-
-    vec = xen_mpic_get_irq(regs);
-    DBG(">HV: vec=%d, pc=0x%lx, msr=0x%lx\n", vec, regs->pc, regs->msr);
-
-    if (irq_desc[vec].status & IRQ_PER_CPU) {
-        /* x86 do_IRQ does not respect the per cpu flag.  */
-        irq_desc_t *desc = &irq_desc[vec];
-        regs->entry_vector = vec;
-        desc->handler->ack(vec);
-        desc->action->handler(vector_to_irq(vec), desc->action->dev_id, regs);
-        desc->handler->end(vec);
-    } else if (vec != -1) {
-        regs->entry_vector = vec;
-        do_IRQ(regs);
-
-        BUG_ON(mfmsr() & MSR_EE);
-        spur_count = 0;
-    } else {
-        ++spur_count;
-        if (spur_count > 100)
-            panic("Too many (%d) spurrious interrupts in a row\n"
-                  "  Known problem, please halt and let machine idle/cool "
-                  "  then reboot\n",
-                  100);
-    }
-}
-
-void init_IRQ(void)
-{
-    xen_mpic_init();
-}
-
-void ack_APIC_irq(void)
-{
-    panic("%s: EOI the whole MPIC?\n", __func__);
-}
-
-void ack_bad_irq(unsigned int irq)
-{
-    printk("unexpected IRQ trap at vector %02x\n", irq);
-    /*
-     * Currently unexpected vectors happen only on SMP and APIC.
-     * We _must_ ack these because every local APIC has only N
-     * irq slots per priority level, and a 'hanging, unacked' IRQ
-     * holds up an irq slot - in excessive cases (when multiple
-     * unexpected vectors occur) that might lock up the APIC
-     * completely.
-     */
-    ack_APIC_irq();
-}
-
-extern void dump_ioapic_irq_info(void);
-void dump_ioapic_irq_info(void)
-{
-    printk("%s: can't dump yet\n", __func__);
-}
-
-/* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */
-u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 };
-int assign_irq_vector(int irq)
-{
-    static int current_vector = FIRST_DEVICE_VECTOR, offset = 0;
-
-    BUG_ON(irq >= NR_IRQ_VECTORS);
-    if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0)
-        return IO_APIC_VECTOR(irq);
-next:
-    current_vector += 8;
-
-    /* Skip the hypercall vector. */
-    if (current_vector == HYPERCALL_VECTOR)
-        goto next;
-
-    /* Skip the Linux/BSD fast-trap vector. */
-    if (current_vector == FAST_TRAP)
-        goto next;
-
-    if (current_vector >= FIRST_SYSTEM_VECTOR) {
-        offset++;
-        if (!(offset%8))
-            return -ENOSPC;
-        current_vector = FIRST_DEVICE_VECTOR + offset;
-    }
-
-    vector_irq[current_vector] = irq;
-    if (irq != AUTO_ASSIGN)
-        IO_APIC_VECTOR(irq) = current_vector;
-
-    return current_vector;
-}
-
-int ioapic_guest_read(unsigned long physbase, unsigned int reg, u32 *pval)
-{
-    BUG_ON(pval != pval);
-    return 0;
-}
-
-int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val)
-{
-    BUG_ON(val != val);
-    return 0;
-}
-
-void send_IPI_mask(cpumask_t mask, int vector)
-{
-    unsigned int cpus;
-    int const bits = 8 * sizeof(cpus);
-
-    switch(vector) {
-    case CALL_FUNCTION_VECTOR:
-    case EVENT_CHECK_VECTOR:
-        break;
-    default:
-        BUG();
-        return;
-    }
-
-    BUG_ON(NR_CPUS > bits);
-    BUG_ON(fls(mask.bits[0]) > bits);
-
-    cpus = mask.bits[0];
-    mpic_send_ipi(vector, cpus);
-}
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/float.S
--- a/xen/arch/powerpc/float.S  Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,243 +0,0 @@
-/*
- * Copyright (C) 2005 Jimi Xenidis <jimix@xxxxxxxxxxxxxx>, IBM Corporation
- *
- * 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, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- */
-
-#include <asm/config.h>
-#include <asm/asm-offsets.h>
-#include <asm/reg_defs.h>
-#include <asm/msr.h>
-#include <asm/processor.h>
-
-#ifdef HAS_FLOAT
-save_fp:
-       addi    r4, r3, VCPU_fprs - FPR_WIDTH
-       stfdu   fr0,FPR_WIDTH(r4)
-       stfdu   fr1,FPR_WIDTH(r4)
-       stfdu   fr2,FPR_WIDTH(r4)
-       stfdu   fr3,FPR_WIDTH(r4)
-       stfdu   fr4,FPR_WIDTH(r4)
-       stfdu   fr5,FPR_WIDTH(r4)
-       stfdu   fr6,FPR_WIDTH(r4)
-       stfdu   fr7,FPR_WIDTH(r4)
-       stfdu   fr8,FPR_WIDTH(r4)
-       stfdu   fr9,FPR_WIDTH(r4)
-       stfdu   fr10,FPR_WIDTH(r4)
-       stfdu   fr11,FPR_WIDTH(r4)
-       stfdu   fr12,FPR_WIDTH(r4)
-       stfdu   fr13,FPR_WIDTH(r4)
-       stfdu   fr14,FPR_WIDTH(r4)
-       stfdu   fr15,FPR_WIDTH(r4)
-       stfdu   fr16,FPR_WIDTH(r4)
-       stfdu   fr17,FPR_WIDTH(r4)
-       stfdu   fr18,FPR_WIDTH(r4)
-       stfdu   fr19,FPR_WIDTH(r4)
-       stfdu   fr20,FPR_WIDTH(r4)
-       stfdu   fr21,FPR_WIDTH(r4)
-       stfdu   fr22,FPR_WIDTH(r4)
-       stfdu   fr23,FPR_WIDTH(r4)
-       stfdu   fr24,FPR_WIDTH(r4)
-       stfdu   fr25,FPR_WIDTH(r4)
-       stfdu   fr26,FPR_WIDTH(r4)
-       stfdu   fr27,FPR_WIDTH(r4)
-       stfdu   fr28,FPR_WIDTH(r4)
-       stfdu   fr29,FPR_WIDTH(r4)
-       stfdu   fr30,FPR_WIDTH(r4)
-       stfdu   fr31,FPR_WIDTH(r4)
-       mffs    fr0
-       stfd    fr0,VCPU_fpscr(r3)
-       blr
-
-load_fp:
-       lfd     fr0,VCPU_fpscr(r3)
-       mtfsf   0xff,fr0
-
-       addi    r4, r3, VCPU_fprs - FPR_WIDTH
-       lfdu    fr0,FPR_WIDTH(r4)
-       lfdu    fr1,FPR_WIDTH(r4)
-       lfdu    fr2,FPR_WIDTH(r4)
-       lfdu    fr3,FPR_WIDTH(r4)
-       lfdu    fr4,FPR_WIDTH(r4)
-       lfdu    fr5,FPR_WIDTH(r4)
-       lfdu    fr6,FPR_WIDTH(r4)
-       lfdu    fr7,FPR_WIDTH(r4)
-       lfdu    fr8,FPR_WIDTH(r4)
-       lfdu    fr9,FPR_WIDTH(r4)
-       lfdu    fr10,FPR_WIDTH(r4)
-       lfdu    fr11,FPR_WIDTH(r4)
-       lfdu    fr12,FPR_WIDTH(r4)
-       lfdu    fr13,FPR_WIDTH(r4)
-       lfdu    fr14,FPR_WIDTH(r4)
-       lfdu    fr15,FPR_WIDTH(r4)
-       lfdu    fr16,FPR_WIDTH(r4)
-       lfdu    fr17,FPR_WIDTH(r4)
-       lfdu    fr18,FPR_WIDTH(r4)
-       lfdu    fr19,FPR_WIDTH(r4)
-       lfdu    fr20,FPR_WIDTH(r4)
-       lfdu    fr21,FPR_WIDTH(r4)
-       lfdu    fr22,FPR_WIDTH(r4)
-       lfdu    fr23,FPR_WIDTH(r4)
-       lfdu    fr24,FPR_WIDTH(r4)
-       lfdu    fr25,FPR_WIDTH(r4)
-       lfdu    fr26,FPR_WIDTH(r4)
-       lfdu    fr27,FPR_WIDTH(r4)
-       lfdu    fr28,FPR_WIDTH(r4)
-       lfdu    fr29,FPR_WIDTH(r4)
-       lfdu    fr30,FPR_WIDTH(r4)
-       lfdu    fr31,FPR_WIDTH(r4)
-       blr
-#endif /* HAS_FLOAT */
-
-#ifdef HAS_VMX
-
-#define VCPU_vr(n) (VCPU_vrs + ((n) * 16))
-
-/*
- * We cannot rely on the domain to correctly use VRSAVE
- * so it is required that all VMX registers are saved and restored.
- */
-save_vmx:
-       mfspr   r0,SPRN_VRSAVE
-       stw     r0,VCPU_vrsave(r3)
-
-       addi r0,r3,VCPU_vr(0);  stvxl   vr0,0,r0
-       addi r0,r3,VCPU_vr(1);  stvxl   vr1,0,r0
-       addi r0,r3,VCPU_vr(2);  stvxl   vr2,0,r0
-       addi r0,r3,VCPU_vr(3);  stvxl   vr3,0,r0
-       addi r0,r3,VCPU_vr(4);  stvxl   vr4,0,r0
-       addi r0,r3,VCPU_vr(5);  stvxl   vr5,0,r0
-       addi r0,r3,VCPU_vr(6);  stvxl   vr6,0,r0
-       addi r0,r3,VCPU_vr(7);  stvxl   vr7,0,r0
-       addi r0,r3,VCPU_vr(8);  stvxl   vr8,0,r0
-
-       /*
-        * By now vr0 should be pushed out so now is a good time to
-        * get the VRSCR which can take a long time and has no dependcies
-        * on the following operations.
-        */
-       mfvscr  vr0
-       addi r0,r3,VCPU_vscr ;  stvxl   vr0,0,r0
-
-       addi r0,r3,VCPU_vr(9);  stvxl   vr9,0,r0
-       addi r0,r3,VCPU_vr(10); stvxl   vr10,0,r0
-       addi r0,r3,VCPU_vr(11); stvxl   vr11,0,r0
-       addi r0,r3,VCPU_vr(12); stvxl   vr12,0,r0
-       addi r0,r3,VCPU_vr(13); stvxl   vr13,0,r0
-       addi r0,r3,VCPU_vr(14); stvxl   vr14,0,r0
-       addi r0,r3,VCPU_vr(15); stvxl   vr15,0,r0
-       addi r0,r3,VCPU_vr(16); stvxl   vr16,0,r0
-       addi r0,r3,VCPU_vr(17); stvxl   vr17,0,r0
-       addi r0,r3,VCPU_vr(18); stvxl   vr18,0,r0
-       addi r0,r3,VCPU_vr(19); stvxl   vr19,0,r0
-       addi r0,r3,VCPU_vr(20); stvxl   vr20,0,r0
-       addi r0,r3,VCPU_vr(21); stvxl   vr21,0,r0
-       addi r0,r3,VCPU_vr(22); stvxl   vr22,0,r0
-       addi r0,r3,VCPU_vr(23); stvxl   vr23,0,r0
-       addi r0,r3,VCPU_vr(24); stvxl   vr24,0,r0
-       addi r0,r3,VCPU_vr(25); stvxl   vr25,0,r0
-       addi r0,r3,VCPU_vr(26); stvxl   vr26,0,r0
-       addi r0,r3,VCPU_vr(27); stvxl   vr27,0,r0
-       addi r0,r3,VCPU_vr(28); stvxl   vr28,0,r0
-       addi r0,r3,VCPU_vr(29); stvxl   vr29,0,r0
-       addi r0,r3,VCPU_vr(30); stvxl   vr30,0,r0
-       addi r0,r3,VCPU_vr(31); stvxl   vr31,0,r0
-       blr
-
-load_vmx:
-       lwz     r0,VCPU_vrsave(r3)
-       mtspr   SPRN_VRSAVE,r0
-
-       /*
-        * This operation can take a long time so we use vr31 to
-        * eliminate the depency on r0 for the next load
-        */
-       addi r0,r3,VCPU_vscr ;  lvxl    vr31,0,r0
-       mtvscr  vr31
-
-       addi r0,r3,VCPU_vr(0);  lvxl    vr0,0,r0
-       addi r0,r3,VCPU_vr(1);  lvxl    vr1,0,r0
-       addi r0,r3,VCPU_vr(2);  lvxl    vr2,0,r0
-       addi r0,r3,VCPU_vr(3);  lvxl    vr3,0,r0
-       addi r0,r3,VCPU_vr(4);  lvxl    vr4,0,r0
-       addi r0,r3,VCPU_vr(5);  lvxl    vr5,0,r0
-       addi r0,r3,VCPU_vr(6);  lvxl    vr6,0,r0
-       addi r0,r3,VCPU_vr(7);  lvxl    vr7,0,r0
-       addi r0,r3,VCPU_vr(8);  lvxl    vr8,0,r0
-       addi r0,r3,VCPU_vr(9);  lvxl    vr9,0,r0
-       addi r0,r3,VCPU_vr(10); lvxl    vr10,0,r0
-       addi r0,r3,VCPU_vr(11); lvxl    vr11,0,r0
-       addi r0,r3,VCPU_vr(12); lvxl    vr12,0,r0
-       addi r0,r3,VCPU_vr(13); lvxl    vr13,0,r0
-       addi r0,r3,VCPU_vr(14); lvxl    vr14,0,r0
-       addi r0,r3,VCPU_vr(15); lvxl    vr15,0,r0
-       addi r0,r3,VCPU_vr(16); lvxl    vr16,0,r0
-       addi r0,r3,VCPU_vr(17); lvxl    vr17,0,r0
-       addi r0,r3,VCPU_vr(18); lvxl    vr18,0,r0
-       addi r0,r3,VCPU_vr(19); lvxl    vr19,0,r0
-       addi r0,r3,VCPU_vr(20); lvxl    vr20,0,r0
-       addi r0,r3,VCPU_vr(21); lvxl    vr21,0,r0
-       addi r0,r3,VCPU_vr(22); lvxl    vr22,0,r0
-       addi r0,r3,VCPU_vr(23); lvxl    vr23,0,r0
-       addi r0,r3,VCPU_vr(24); lvxl    vr24,0,r0
-       addi r0,r3,VCPU_vr(25); lvxl    vr25,0,r0
-       addi r0,r3,VCPU_vr(26); lvxl    vr26,0,r0
-       addi r0,r3,VCPU_vr(27); lvxl    vr27,0,r0
-       addi r0,r3,VCPU_vr(28); lvxl    vr28,0,r0
-       addi r0,r3,VCPU_vr(29); lvxl    vr29,0,r0
-       addi r0,r3,VCPU_vr(30); lvxl    vr30,0,r0
-       addi r0,r3,VCPU_vr(31); lvxl    vr31,0,r0
-       blr
-#endif /* HAS_VMX */
-
-/* void save_float(struct exec_domain *ed) */
-_GLOBAL(save_float)
-       mflr    r8
-#ifdef HAS_FLOAT
-       mfmsr   r9              # save msr
-       ori     r0,r9,MSR_FP    # turn on FPU
-       mtmsr   r0
-       bl      save_fp         # uses r3, r4
-       mtmsr   r9              # restore msr
-#endif /* HAS_FLOAT */
-#ifdef HAS_VMX
-       mfmsr   r9              # save msr
-       oris    r0,r9,MSR_VMX@h # turn on VMX
-       mtmsr   r0
-       bl      save_vmx        # uses r3
-       mtmsr   r9              # restore msr
-#endif /* HAS_VMX */
-       mtlr    r8
-       blr
-
-/* void load_float(struct exec_domain *ed) */
-_GLOBAL(load_float)
-       mflr    r8
-#ifdef HAS_FLOAT
-       mfmsr   r9              # save msr
-       ori     r0,r9,MSR_FP    # turn on FPU
-       mtmsr   r0
-       bl      load_fp # uses r3, r4
-       mtmsr   r9              # restore msr
-#endif /* HAS_FLOAT */
-#ifdef HAS_VMX
-       mfmsr   r9              # save msr
-       oris    r0,r9,MSR_VMX@h # turn on VMX
-       mtmsr   r0
-       bl      load_vmx        # uses r3
-       mtmsr   r9              # restore msr
-#endif /* HAS_VMX */
-       mtlr    r8
-       blr
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/gdbstub.c
--- a/xen/arch/powerpc/gdbstub.c        Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,216 +0,0 @@
-/*
- * 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 (C) IBM Corp. 2005
- *
- * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
- */
-
-#include <xen/types.h>
-#include <xen/lib.h>
-#include <xen/gdbstub.h>
-#include <public/xen.h>
-#include <asm/msr.h>
-#include <asm/bitops.h>
-#include <asm/cache.h>
-#include <asm/debugger.h>
-#include <asm/processor.h>
-
-asm(".globl trap_instruction\n"
-        "trap_instruction:\n"
-        "trap\n");
-extern u32 trap_instruction[];
-
-static unsigned int dec_entry;
-static unsigned int hdec_entry;
-
-static inline ulong
-gdb_ppc_0x700(struct cpu_user_regs *state)
-{
-    ulong instr;
-
-    switch (state->msr & MSR_TRAP_BITS) {
-        case MSR_TRAP_FE:
-            return SIGFPE;
-        case MSR_TRAP_IOP:
-        case MSR_TRAP_PRIV:
-            return SIGILL;
-        case MSR_TRAP:
-            instr = *((u32 *)state->pc);
-
-            /* if this was a hardcoded trap in the source, step past it */
-            if (instr == *trap_instruction) {
-                state->pc += sizeof (u32);
-            }
-            return SIGTRAP;
-    }
-    return SIGBUS;
-}
-
-u16 gdb_arch_signal_num(struct cpu_user_regs *regs, unsigned long cookie)
-{
-    /* exception type identifies, trap or bad address */
-    switch (cookie) {
-        case 0x200: /* Machine Check */
-            return SIGTERM;
-        case 0x300: /* DSI */
-        case 0x380: /* Data SLB */
-        case 0x400: /* ISI */
-        case 0x480: /* Instruction SLB */
-            return SIGSEGV;
-        case 0x600: /* Alignment SLB */
-            return SIGBUS;
-        case 0x700: /* Program */
-            return gdb_ppc_0x700(regs);
-        case 0x800: /* Float */
-            return SIGFPE;
-        case 0x900: /* Decrementer */
-            return SIGALRM; /* is this right? */
-        case 0xd00: /* TRAP */
-            return SIGTRAP;
-        case 0xe00: /* FP */
-            return SIGFPE;
-    }
-    return SIGBUS;
-}
-
-void
-gdb_arch_resume(struct cpu_user_regs *regs,
-                unsigned long addr, unsigned long type,
-                struct gdb_context *ctx)
-{
-    if (addr != ~((ulong)0)) {
-        regs->pc = addr;
-    }
-
-    if (type == GDB_CONTINUE) {
-        regs->msr &= ~MSR_SE;
-    } else {
-        regs->msr |= MSR_SE;
-    }
-}
-
-void 
-gdb_arch_read_reg(unsigned long regnum, struct cpu_user_regs *regs,
-                  struct gdb_context *ctx)
-{
-    unimplemented();
-    gdb_send_reply("", ctx);
-}
-
-void
-gdb_arch_read_reg_array(struct cpu_user_regs *state, struct gdb_context *ctx)
-{
-    ulong i = 0;
-
-    for (i = 0; i < 32; ++i) {
-        gdb_write_to_packet_hex(state->gprs[i], sizeof(state->gprs[i]), ctx);
-    }
-    /* Avoid floating point for now */
-    for (i = 0; i < 32; ++i) {
-        gdb_write_to_packet_hex(0, sizeof(u64), ctx);
-    }
-    gdb_write_to_packet_hex(state->pc, sizeof (state->pc), ctx);
-    gdb_write_to_packet_hex(state->msr, sizeof (state->msr), ctx);
-    gdb_write_to_packet_hex(state->cr, sizeof (state->cr), ctx);
-    gdb_write_to_packet_hex(state->lr, sizeof (state->lr), ctx);
-    gdb_write_to_packet_hex(state->ctr, sizeof (state->ctr), ctx);
-    gdb_write_to_packet_hex(state->xer, sizeof (u32), ctx);
-    gdb_write_to_packet_hex(0, sizeof(u32), ctx); /* fpscr */
-    gdb_send_packet(ctx);
-}
-
-void 
-gdb_arch_write_reg(unsigned long regnum, unsigned long val, 
-                    struct cpu_user_regs *regs, struct gdb_context *ctx)
-{
-    unimplemented();
-    gdb_send_reply("", ctx);
-}
- 
-void
-gdb_arch_write_reg_array(struct cpu_user_regs *regs, const char *buf,
-                         struct gdb_context *ctx)
-{
-    ulong i;
-
-    for (i = 0; i < 32; ++i) {
-        regs->gprs[i] = str2ulong(buf, sizeof (ulong));
-        buf += sizeof (regs->gprs[0]) * 2;
-    }
-    /* Avoid floating point for now */
-    for (i = 0; i < 32; ++i) {
-        buf += sizeof (u64) * 2;
-    }
-
-    regs->pc = str2ulong(buf, sizeof (regs->pc));
-    buf += sizeof (regs->pc) * 2;
-    regs->msr = str2ulong(buf, sizeof (regs->msr));
-    buf += sizeof (regs->msr) * 2;
-    regs->cr = str2ulong(buf, sizeof (regs->cr));
-    buf += sizeof (regs->cr) * 2;
-    regs->lr = str2ulong(buf, sizeof (regs->lr));
-    buf += sizeof (regs->lr) * 2;
-    regs->ctr = str2ulong(buf, sizeof (regs->ctr));
-    buf += sizeof (regs->ctr) * 2;
-    regs->xer = str2ulong(buf, sizeof (u32));
-    buf += sizeof (u32) * 2;
-}
-
-unsigned int
-gdb_arch_copy_from_user(void *dest, const void *src, unsigned len)
-{
-    memcpy(dest, src, len);
-    return 0;
-}
-
-unsigned int
-gdb_arch_copy_to_user(void *dest, const void *src, unsigned len)
-{
-    memcpy(dest, src, len);
-    synchronize_caches((ulong)dest, len);
-    return 0;
-}
-
-void
-gdb_arch_print_state(struct cpu_user_regs *state)
-{
-    int i = 0;
-    printk("PC: 0x%016lx MSR: 0x%016lx\n", state->pc, state->msr);
-    printk("LR: 0x%016lx CTR: 0x%016lx\n", state->lr, state->ctr);
-    /* XXX
-       printk("DAR: 0x%016lx DSISR: 0x%016lx\n", state->dar, state->dsisr);
-       */
-    printk("CR: 0x%08x XER: 0x%016lx\n", state->cr, state->xer);
-    for (; i < 32; i+=4) {
-        printk("%02d: 0x%016lx 0x%016lx 0x%016lx 0x%016lx\n",
-                i, state->gprs[i], state->gprs[i+1],
-                state->gprs[i+2], state->gprs[i+3]);
-    }
-}
-
-void
-gdb_arch_enter(struct cpu_user_regs *state)
-{
-    dec_entry = mfdec();
-    hdec_entry = mfhdec();
-}
-
-void
-gdb_arch_exit(struct cpu_user_regs *state)
-{
-    mtdec(dec_entry);
-    mthdec(hdec_entry);
-}
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/hcalls.c
--- a/xen/arch/powerpc/hcalls.c Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-/*
- * 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. 2005, 2006, 2007
- *
- * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
- */
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/sched.h>
-#include <xen/lib.h>
-#include <xen/init.h>
-#include <xen/multicall.h>
-#include <public/xen.h>
-#include <asm/current.h>
-#include <asm/papr.h>
-#include <asm/hcalls.h>
-#include <asm/debugger.h>
-#include <asm/msr.h>
-#include "exceptions.h"
-
-u32 *papr_hcalls;               /* PAPR Hypervisor Calls */
-u32 *hypercall_table;           /* Xen Hypervisor Calls */
-
-static void hcall_papr(ulong num, struct cpu_user_regs *regs)
-{
-    u32 address;
-
-    if (regs->msr & MSR_PR) {
-        regs->gprs[3] = H_Privilege;
-        return;
-    }
-
-    if ((num & 0x3) || (num > RPA_HCALL_END)) {
-        regs->gprs[3] = H_Parameter;
-        return;
-    }
-
-    address = papr_hcalls[num/4];
-    papr_hcall_jump(regs, address);
-}
-
-static void hcall_xen(ulong num, struct cpu_user_regs *regs)
-{
-    u32 address;
-
-    if (regs->msr & MSR_PR) {
-        regs->gprs[3] = -EPERM;
-        return;
-    }
-
-    if ((num >= NR_hypercalls)) {
-        regs->gprs[3] = -ENOSYS;
-        return;
-    }
-    address = hypercall_table[num];
-    if (address == 0) {
-        printk("unsupported Xen hypercall: 0x%lx\n", num);
-        regs->gprs[3] = -ENOSYS;
-        return;
-    }
-
-    regs->gprs[3] = xen_hvcall_jump(regs, address);
-}
-
-void do_multicall_call(multicall_entry_t *call)
-{
-    struct cpu_user_regs regs;
-
-    regs.gprs[3] = call->args[0];
-    regs.gprs[4] = call->args[1];
-    regs.gprs[5] = call->args[2];
-    regs.gprs[6] = call->args[3];
-    regs.gprs[7] = call->args[4];
-    regs.gprs[8] = call->args[5];
-
-    hcall_xen(call->op, &regs);
-
-    call->result = regs.gprs[3];
-}
-
-void do_hcall(struct cpu_user_regs *regs)
-{
-    ulong num = regs->gprs[3];
-
-    local_irq_enable();
-
-    if ((num & XEN_MARK(0)) == XEN_MARK(0)) {
-        /* it's a Xen call */
-        num &= ~XEN_MARK(0);
-        hcall_xen(num, regs);
-    } else {
-        /* it's a PAPR call */
-        hcall_papr(num, regs);
-    }
-}
-
-static void do_ni_papr_hypercall(struct cpu_user_regs *regs)
-{
-    struct vcpu *v = get_current();
-
-    printk("unsupported PAPR hcall 0x%lx was called by dom0x%x\n",
-            regs->gprs[3], v->domain->domain_id);
-
-    regs->gprs[3] = H_Parameter;
-}
-
-/* store low 32 bits of 64-bit address in hcall table (this is safe because we
- * know we will not link above 4GB). We don't need to preserve the TOC
- * because that only changes when calling dynamically linked objects. */
-static void register_papr_hcall(ulong num, hcall_handler_t handler)
-{
-    int index = num/4;
-
-    papr_hcalls[index] = (u32)(*(u64 *)handler);
-}
-
-static void init_papr_hcalls(void)
-{
-    init_hcall_t *hcall;
-    int i;
-
-    /* initialize PAPR hcall table */
-    papr_hcalls = xmalloc_array(u32, RPA_HCALL_END/4);
-    ASSERT(papr_hcalls != NULL);
-    for (i = 0; i <= RPA_HCALL_END; i += 4)
-        register_papr_hcall(i, do_ni_papr_hypercall);
-
-    /* register the PAPR hcalls */
-    for (hcall = &__init_hcall_start; hcall < &__init_hcall_end; hcall++) {
-        register_papr_hcall(hcall->number, hcall->handler);
-    }
-}
-
-static void init_hypercall_table(void)
-{
-    int i;
-
-    hypercall_table = xmalloc_array(u32, NR_hypercalls);
-    ASSERT(hypercall_table != NULL);
-
-    for (i = 0; i < NR_hypercalls; i++) {
-        if (__hypercall_table[i] == NULL ) {
-            hypercall_table[i] = 0;
-        } else {
-            hypercall_table[i] = (u32)(*__hypercall_table[i]);
-        }
-    }
-}
-
-static int init_hcalls(void)
-{
-    init_papr_hcalls();
-    init_hypercall_table();
-
-    return 0;
-}
-__initcall(init_hcalls);
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/iommu.c
--- a/xen/arch/powerpc/iommu.c  Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
- * 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. 2005, 2007
- *
- * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- */
-
-#undef DEBUG
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/sched.h>
-#include <xen/init.h>
-#include <xen/mm.h>
-#include <asm/current.h>
-#include <asm/papr.h>
-#include <asm/hcalls.h>
-#include <public/xen.h>
-#include "tce.h"
-#include "iommu.h"
-
-#ifdef DEBUG
-#define DBG(fmt...) printk(fmt)
-#else
-#define DBG(fmt...)
-#endif
-
-struct iommu_funcs {
-    int (*iommu_put)(ulong, union tce);
-};
-
-/* individual host bridges */
-static struct iommu_funcs iommu_phbs[16];
-static u32 iommu_phbs_num = ARRAY_SIZE(iommu_phbs);
-
-int iommu_put(u32 buid, ulong ioba, union tce tce)
-{
-    struct vcpu *v = get_current();
-    struct domain *d = v->domain;
-
-    if (buid < iommu_phbs_num && iommu_phbs[buid].iommu_put != NULL) {
-        ulong gmfn;
-        ulong mfn;
-        int mtype;
-
-        gmfn = tce.tce_bits.tce_rpn;
-
-        
-        mfn = pfn2mfn(d, gmfn, &mtype);
-        if (mfn != INVALID_MFN) {
-            switch (mtype) {
-            case PFN_TYPE_LOGICAL:
-                break;
-            case PFN_TYPE_FOREIGN:
-                DBG("%s: assigning to Foriegn page: "
-                    "gmfn: 0x%lx mfn: 0x%lx\n",  __func__, gmfn, mfn);
-                break;
-            default:
-                printk("%s: unsupported type[%d]: gmfn: 0x%lx mfn: 0x%lx\n",
-                       __func__, mtype, gmfn, mfn);
-                return -1;
-            break;
-            }
-            DBG("%s: ioba=0x%lx gmfn=0x%lx mfn=0x%lx\n", __func__,
-                ioba, gmfn, mfn);
-            tce.tce_bits.tce_rpn = mfn;
-            return iommu_phbs[buid].iommu_put(ioba, tce);
-        }
-    }
-    return -1;
-}
-
-int iommu_register(u32 buid, int (*put)(ulong ioba, union tce ltce))
-{
-
-    if (buid < iommu_phbs_num && iommu_phbs[buid].iommu_put == NULL) {
-        iommu_phbs[0].iommu_put = put;
-        return 0;
-    }
-    panic("bad IOMMU registration\n");
-    return -1;
-}
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/iommu.h
--- a/xen/arch/powerpc/iommu.h  Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * 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 (C) IBM Corp. 2005
- *
- * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- */
-
-#ifndef _IOMMU_H
-#define _IOMMU_H
-
-extern int iommu_put(u32 buid, ulong ioba, union tce tce);
-extern int iommu_register(u32 buid, int (*put)(ulong, union tce));
-
-#endif /* _IOMMU_H */
-
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/irq.c
--- a/xen/arch/powerpc/irq.c    Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-/*
- * 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 (C) IBM Corp. 2005
- *
- * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- */
-
-#include "exceptions.h"
-#include "../x86/irq.c"
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/machine_kexec.c
--- a/xen/arch/powerpc/machine_kexec.c  Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-#include <xen/lib.h>       /* for printk() used in stubs */
-#include <xen/types.h>
-#include <xen/kexec.h>
-#include <public/kexec.h>
-
-int machine_kexec_load(int type, int slot, xen_kexec_image_t *image)
-{
-    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
-    return -1;
-}
-
-void machine_kexec_unload(int type, int slot, xen_kexec_image_t *image)
-{
-    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
-}
-
-void machine_reboot_kexec(xen_kexec_image_t *image)
-{
-    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
-}
-
-void machine_kexec(xen_kexec_image_t *image)
-{
-    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
-}
-
-int machine_kexec_get(xen_kexec_image_t *image)
-{
-    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
-    return -1;
-}
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/memory.c
--- a/xen/arch/powerpc/memory.c Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,224 +0,0 @@
-/*
- * 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: Dan Poff <poff@xxxxxxxxxx>
- *          Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- */
-#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"
-
-#define DEBUG
-#ifdef DEBUG
-#define DBG(fmt...) printk(fmt)
-#else
-#define DBG(fmt...)
-#endif
-
-/*
- * opt_xenheap_megabytes: Size of Xen heap in megabytes, excluding the
- * page_info table and allocation bitmap.
- */
-static unsigned int opt_xenheap_megabytes = XENHEAP_DEFAULT_MB;
-integer_param("xenheap_megabytes", opt_xenheap_megabytes);
-
-unsigned long xenheap_phys_end;
-static uint nr_pages;
-static ulong xenheap_size;
-
-struct membuf {
-    ulong start;
-    ulong size;
-};
-
-typedef void (*walk_mem_fn)(struct membuf *, uint);
-
-static void set_max_page(struct membuf *mb, uint entries)
-{
-    int i;
-
-    for (i = 0; i < entries; i++) {
-        ulong end_page;
-
-        printk("  %016lx: %016lx\n", mb[i].start, mb[i].size);
-        nr_pages += mb[i].size >> PAGE_SHIFT;
-
-        end_page = (mb[i].start + mb[i].size) >> PAGE_SHIFT;
-        if (end_page > max_page)
-            max_page = end_page;
-    }
-}
-
-/* mark all memory from modules onward as unused */
-static void heap_init(struct membuf *mb, uint entries)
-{
-    int i;
-    ulong start_blk;
-    ulong end_blk = 0;
-
-    for (i = 0; i < entries; i++) {
-        start_blk = mb[i].start;
-        end_blk = start_blk + mb[i].size;
-
-        if (start_blk < xenheap_phys_end) {
-            if (xenheap_phys_end > end_blk) {
-                panic("xenheap spans LMB\n");
-            }
-            if (xenheap_phys_end == end_blk)
-                continue;
-
-            start_blk = xenheap_phys_end;
-        }
-
-        DBG("boot free: %016lx - %016lx\n", start_blk, end_blk);
-        init_boot_pages(start_blk, end_blk);
-        total_pages += (end_blk - start_blk) >> PAGE_SHIFT;
-    }
-}
-
-static void ofd_walk_mem(void *m, walk_mem_fn fn)
-{
-    ofdn_t n;
-    uint p_len;
-    struct membuf mb[8];
-    static char name[] = "memory";
-
-    n = ofd_node_find_by_prop(m, OFD_ROOT, "device_type", name, sizeof(name));
-    while (n > 0) {
-
-        p_len = ofd_getprop(m, n, "reg", mb, sizeof (mb));
-        if (p_len <= 0) {
-            panic("ofd_getprop(): failed\n");
-        }
-        if (p_len > sizeof(mb))
-            panic("%s: buffer is not big enuff for this firmware: "
-                  "0x%lx < 0x%x\n", __func__, sizeof(mb), p_len);
-
-        fn(mb, p_len / sizeof(mb[0]));
-        n = ofd_node_find_next(m, n);
-    }
-}
-
-void memory_init(void)
-{
-    ulong eomem;
-    ulong bitmap_start = ~0UL;
-    ulong bitmap_end = 0;
-    ulong bitmap_size;
-    ulong xh_pages;
-    ulong start;
-    ulong end;
-    int pos;
-
-    /* lets find out how much memory there is and set max_page */
-    max_page = 0;
-    printk("Physical RAM map:\n");
-    ofd_walk_mem((void *)oftree, set_max_page);
-    eomem = max_page << PAGE_SHIFT;
-    if (eomem == 0) {
-        panic("ofd_walk_mem() failed\n");
-    }
-
-    xh_pages = opt_xenheap_megabytes << (20 - PAGE_SHIFT);
-
-    /* While we are allocating HTABS from The Xen Heap we need it to
-     * be larger */
-    xh_pages += nr_pages >> 5;
-
-    xenheap_phys_end = xh_pages << PAGE_SHIFT;
-    printk("End of Xen Area: %luMiB (%luKiB)\n",
-           xenheap_phys_end >> 20, xenheap_phys_end >> 10);
-
-    printk("End of RAM: %luMiB (%luKiB)\n", eomem >> 20, eomem >> 10);
-
-    /* The boot allocator requires one bit per page. Find a spot for it. */
-    bitmap_size = max_page / 8;
-    pos = boot_of_mem_avail(0, &start, &end);
-    while (pos >= 0) {
-        if (end - start >= bitmap_size) {
-            bitmap_start = start;
-            bitmap_end = init_boot_allocator(bitmap_start);
-            printk("boot allocator @ %lx - %lx\n", bitmap_start, bitmap_end);
-            break;
-        }
-        pos = boot_of_mem_avail(pos, &start, &end);
-    }
-    if (bitmap_start == ~0UL)
-        panic("Couldn't find 0x%lx bytes for boot allocator.", bitmap_size);
-
-    /* allow everything else to be allocated */
-    total_pages = 0;
-    ofd_walk_mem((void *)oftree, heap_init);
-    if (total_pages == 0)
-        panic("heap_init: failed");
-
-    if (total_pages > max_page)
-        panic("total_pages > max_page: 0x%lx > 0x%lx\n",
-              total_pages, max_page);
-
-    DBG("total_pages: 0x%016lx\n", total_pages);
-
-    init_frametable();
-    init_machine_to_phys_table();
-
-    numa_initmem_init(0, max_page);
-
-    /* Domain heap gets all the unclaimed memory. */
-    end_boot_allocator();
-
-    /* Create initial xen heap by finding non-reserved memory. */
-    pos = boot_of_mem_avail(0, &start, &end);
-    while (pos >= 0) {
-        if (end == ~0UL)
-            end = xenheap_phys_end;
-
-        /* Problem: the bitmap itself is not reserved. */
-        if ((start >= bitmap_start) && (start < bitmap_end)) {
-            /* Start is inside bitmap. */
-            start = bitmap_end;
-        }
-        if ((end > bitmap_start) && (end <= bitmap_end)) {
-            /* End is inside bitmap. */
-            end = bitmap_start;
-        }
-        if ((start < bitmap_start) && (end > bitmap_end)) {
-            /* Range encompasses bitmap. First free low part, then high. */
-            xenheap_size += bitmap_start - start;
-            DBG("xenheap: %016lx - %016lx\n", start, bitmap_start);
-            init_xenheap_pages(start, bitmap_start);
-            start = bitmap_end;
-        }
-
-        xenheap_size += end - start;
-        DBG("xenheap: %016lx - %016lx\n", start, end);
-        init_xenheap_pages(start, end);
-
-        pos = boot_of_mem_avail(pos, &start, &end);
-    }
-
-    printk("Xen Heap: %luMiB (%luKiB)\n",
-           xenheap_size >> 20, xenheap_size >> 10);
-
-    eomem = avail_domheap_pages();
-    printk("Dom Heap: %luMiB (%luKiB)\n",
-           (eomem << PAGE_SHIFT) >> 20,
-           (eomem << PAGE_SHIFT) >> 10);
-}
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c     Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,617 +0,0 @@
-/*
- * 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 (C) IBM Corp. 2005, 2006
- *
- * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
- *          Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- *          Ryan Harper <ryanh@xxxxxxxxxx>
- */
-
-#include <xen/config.h>
-#include <xen/mm.h>
-#include <xen/paging.h>
-#include <xen/kernel.h>
-#include <xen/sched.h>
-#include <xen/perfc.h>
-#include <asm/init.h>
-#include <asm/page.h>
-#include <asm/platform.h>
-#include <asm/string.h>
-#include <asm/platform.h>
-#include <public/arch-powerpc.h>
-
-#ifdef VERBOSE
-#define MEM_LOG(_f, _a...)                                  \
-  printk("DOM%u: (file=mm.c, line=%d) " _f "\n",            \
-         current->domain->domain_id , __LINE__ , ## _a )
-#else
-#define MEM_LOG(_f, _a...) ((void)0)
-#endif
-
-/* Frame table and its size in pages. */
-struct page_info *frame_table;
-unsigned long max_page;
-unsigned long total_pages;
-
-/* machine to phys mapping to used by all domains */
-unsigned long *machine_phys_mapping;
-
-void __init init_frametable(void)
-{
-    unsigned long p;
-    unsigned long nr_pages;
-    int i;
-
-    nr_pages = PFN_UP(max_page * sizeof(struct page_info));
-
-    p = alloc_boot_pages(nr_pages, 1);
-    if (p == 0)
-        panic("Not enough memory for frame table\n");
-
-    frame_table = (struct page_info *)(p << PAGE_SHIFT);
-    for (i = 0; i < nr_pages; i += 1)
-        clear_page((void *)((p + i) << PAGE_SHIFT));
-}
-
-/* Array of PFNs, indexed by MFN. */
-void __init init_machine_to_phys_table(void)
-{
-    unsigned long p;
-    unsigned long nr_pages;
-    int i;
-
-    nr_pages = PFN_UP(max_page * sizeof(unsigned long));
-
-    p = alloc_boot_pages(nr_pages, 1);
-    if (p == 0)
-        panic("Not enough memory for machine phys mapping table\n");
-
-    machine_phys_mapping = (unsigned long *)(p << PAGE_SHIFT);
-    for (i = 0; i < nr_pages; i += 1)
-        clear_page((void *)((p + i) << PAGE_SHIFT));
-}
-
-void share_xen_page_with_guest(
-    struct page_info *page, struct domain *d, int readonly)
-{
-    if ( page_get_owner(page) == d )
-        return;
-
-    /* this causes us to leak pages in the Domain and reuslts in
-     * Zombie domains, I think we are missing a piece, until we find
-     * it we disable the following code */
-    set_gpfn_from_mfn(page_to_mfn(page), INVALID_M2P_ENTRY);
-
-    spin_lock(&d->page_alloc_lock);
-
-    /* The incremented type count pins as writable or read-only. */
-    page->u.inuse.type_info  = (readonly ? PGT_none : PGT_writable_page);
-    page->u.inuse.type_info |= PGT_validated | 1;
-
-    page_set_owner(page, d);
-    wmb(); /* install valid domain ptr before updating refcnt. */
-    ASSERT(page->count_info == 0);
-
-    /* Only add to the allocation list if the domain isn't dying. */
-    if ( !d->is_dying )
-    {
-        page->count_info |= PGC_allocated | 1;
-        if ( unlikely(d->xenheap_pages++ == 0) )
-            get_knownalive_domain(d);
-        list_add_tail(&page->list, &d->xenpage_list);
-    }
-
-    spin_unlock(&d->page_alloc_lock);
-}
-
-void share_xen_page_with_privileged_guests(
-    struct page_info *page, int readonly)
-{
-        unimplemented();
-}
-
-static ulong foreign_to_mfn(struct domain *d, ulong pfn)
-{
-
-    pfn -= 1UL << cpu_foreign_map_order();
-
-    BUG_ON(pfn >= d->arch.foreign_mfn_count);
-
-    return d->arch.foreign_mfns[pfn];
-}
-
-static int set_foreign(struct domain *d, ulong pfn, ulong mfn)
-{
-    pfn -= 1UL << cpu_foreign_map_order();
-
-    BUG_ON(pfn >= d->arch.foreign_mfn_count);
-    d->arch.foreign_mfns[pfn] = mfn;
-
-    return 0;
-}
-
-static int create_grant_va_mapping(
-    unsigned long va, unsigned long frame, struct vcpu *v)
-{
-    if (v->domain->domain_id != 0) {
-        printk("only Dom0 can map a grant entry\n");
-        BUG();
-        return GNTST_permission_denied;
-    }
-    set_foreign(v->domain, va >> PAGE_SHIFT, frame);
-    return GNTST_okay;
-}
-
-static int destroy_grant_va_mapping(
-    unsigned long addr, unsigned long frame, struct domain *d)
-{
-    if (d->domain_id != 0) {
-        printk("only Dom0 can map a grant entry\n");
-        BUG();
-        return GNTST_permission_denied;
-    }
-    set_foreign(d, addr >> PAGE_SHIFT, ~0UL);
-    return GNTST_okay;
-}
-
-int create_grant_host_mapping(
-    unsigned long addr, unsigned long frame, unsigned int flags, unsigned int 
cache_flags)
-{
-    if (flags & GNTMAP_application_map) {
-        printk("%s: GNTMAP_application_map not supported\n", __func__);
-        BUG();
-        return GNTST_general_error;
-    }
-    if (flags & GNTMAP_contains_pte) {
-        printk("%s: GNTMAP_contains_pte not supported\n", __func__);
-        BUG();
-        return GNTST_general_error;
-    }
-    if (cache_flags) {
-        printk("%s: cache_flags not supported\n", __func__);
-        BUG();
-        return GNTST_general_error;
-    }
-    return create_grant_va_mapping(addr, frame, current);
-}
-
-int replace_grant_host_mapping(
-    unsigned long addr, unsigned long frame, unsigned long new_addr,
-    unsigned int flags)
-{
-    if (new_addr) {
-        printk("%s: new_addr not supported\n", __func__);
-        BUG();
-        return GNTST_general_error;
-    }
-
-    if (flags & GNTMAP_contains_pte) {
-        printk("%s: GNTMAP_contains_pte not supported\n", __func__);
-        BUG();
-        return GNTST_general_error;
-    }
-
-    /* may have force the remove here */
-    return destroy_grant_va_mapping(addr, frame, current->domain);
-}
-
-int steal_page(struct domain *d, struct page_info *page, unsigned int memflags)
-{
-    panic("%s called\n", __func__);
-    return 1;
-}
-
-void put_page_type(struct page_info *page)
-{
-    unsigned long nx, x, y = page->u.inuse.type_info;
-
-    do {
-        x  = y;
-        nx = x - 1;
-
-        ASSERT((x & PGT_count_mask) != 0);
-
-        /*
-         * The page should always be validated while a reference is held. The 
-         * exception is during domain destruction, when we forcibly invalidate 
-         * page-table pages if we detect a referential loop.
-         * See domain.c:relinquish_list().
-         */
-        ASSERT((x & PGT_validated) || page_get_owner(page)->is_dying);
-
-        if ( unlikely((nx & PGT_count_mask) == 0) )
-        {
-            /* Record TLB information for flush later. */
-            page->tlbflush_timestamp = tlbflush_current_time();
-        }
-    }
-    while ( unlikely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) != x) );
-}
-
-
-int get_page_type(struct page_info *page, unsigned long type)
-{
-    unsigned long nx, x, y = page->u.inuse.type_info;
-
-    ASSERT(!(type & ~PGT_type_mask));
-
- again:
-    do {
-        x  = y;
-        nx = x + 1;
-        if ( unlikely((nx & PGT_count_mask) == 0) )
-        {
-            MEM_LOG("Type count overflow on pfn %lx", page_to_mfn(page));
-            return 0;
-        }
-        else if ( unlikely((x & PGT_count_mask) == 0) )
-        {
-            if ( (x & PGT_type_mask) != type )
-            {
-                /*
-                 * On type change we check to flush stale TLB entries. This 
-                 * may be unnecessary (e.g., page was GDT/LDT) but those 
-                 * circumstances should be very rare.
-                 */
-                cpumask_t mask =
-                    page_get_owner(page)->domain_dirty_cpumask;
-                tlbflush_filter(mask, page->tlbflush_timestamp);
-
-                if ( unlikely(!cpus_empty(mask)) )
-                {
-                    perfc_incr(need_flush_tlb_flush);
-                    flush_tlb_mask(mask);
-                }
-
-                /* We lose existing type, back pointer, and validity. */
-                nx &= ~(PGT_type_mask | PGT_validated);
-                nx |= type;
-
-                /* No special validation needed for writable pages. */
-                /* Page tables and GDT/LDT need to be scanned for validity. */
-                if ( type == PGT_writable_page )
-                    nx |= PGT_validated;
-            }
-        }
-        else if ( unlikely((x & PGT_type_mask) != type) )
-        {
-            return 0;
-        }
-        else if ( unlikely(!(x & PGT_validated)) )
-        {
-            /* Someone else is updating validation of this page. Wait... */
-            while ( (y = page->u.inuse.type_info) == x )
-                cpu_relax();
-            goto again;
-        }
-    }
-    while ( unlikely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) != x) );
-
-    if ( unlikely(!(nx & PGT_validated)) )
-    {
-        /* Noone else is updating simultaneously. */
-        __set_bit(_PGT_validated, &page->u.inuse.type_info);
-    }
-
-    return 1;
-}
-
-long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg)
-{
-    printk("%s: no PPC specific memory ops\n", __func__);
-    return -ENOSYS;
-}
-
-extern void copy_page(void *dp, void *sp)
-{
-    if (on_systemsim()) {
-        systemsim_memcpy(dp, sp, PAGE_SIZE);
-    } else {
-        memcpy(dp, sp, PAGE_SIZE);
-    }
-}
-
-/* Allocate (rma_nrpages - nrpages) more memory for domain in proper size. */
-uint allocate_extents(struct domain *d, uint nrpages, uint rma_nrpages)
-{
-    struct page_info *pg;
-    ulong mfn;
-    ulong gpfn = rma_nrpages; /* starting PFN at end of RMA */
-    uint ext_order;
-    uint ext_nrpages;
-    uint total_nrpages;
-    int i;
-
-    ext_order = cpu_extent_order();
-    ext_nrpages = 1 << ext_order;
-
-    total_nrpages = rma_nrpages;
-
-    /* We only allocate in nr_extsz chunks so if you are not divisible
-     * you get more than you asked for. */
-    while (total_nrpages < nrpages) {
-        pg = alloc_domheap_pages(d, ext_order, 0);
-        if (pg == NULL)
-            return total_nrpages;
-
-        /* Build p2m mapping for newly allocated extent. */
-        mfn = page_to_mfn(pg);
-        for (i = 0; i < (1 << ext_order); i++)
-            guest_physmap_add_page(d, gpfn + i, mfn + i);
-
-        /* Bump starting PFN by extent size pages. */
-        gpfn += ext_nrpages;
-
-        total_nrpages += ext_nrpages;
-    }
-
-    return total_nrpages;
-}
-
-int allocate_rma(struct domain *d, unsigned int order)
-{
-    struct vcpu *v;
-    ulong rma_base;
-    ulong rma_sz;
-    ulong mfn;
-    int i;
-
-    if (d->arch.rma_page)
-        return -EINVAL;
-
-    d->arch.rma_page = alloc_domheap_pages(d, order, 0);
-    if (d->arch.rma_page == NULL) {
-        gdprintk(XENLOG_INFO, "Could not allocate order=%d RMA for domain 
%u\n",
-                order, d->domain_id);
-        return -ENOMEM;
-    }
-    d->arch.rma_order = order;
-
-    rma_base = page_to_maddr(d->arch.rma_page);
-    rma_sz = rma_size(d->arch.rma_order);
-
-    BUG_ON(rma_base & (rma_sz - 1)); /* check alignment */
-
-    printk("allocated RMA for Dom[%d]: 0x%lx[0x%lx]\n",
-           d->domain_id, rma_base, rma_sz);
-
-    mfn = page_to_mfn(d->arch.rma_page);
-
-    for (i = 0; i < (1 << d->arch.rma_order); i++ ) {
-        d->arch.rma_page[i].count_info |= PGC_page_RMA;
-        clear_page((void *)page_to_maddr(&d->arch.rma_page[i]));
-
-        /* Set up p2m mapping for RMA. */
-        guest_physmap_add_page(d, i, mfn+i);
-    }
-
-    /* shared_info uses last page of RMA */
-    d->shared_info = (shared_info_t *) (rma_base + rma_sz - PAGE_SIZE);
-
-    /* if there are already running vcpus, adjust v->vcpu_info */
-    /* XXX untested */
-    for_each_vcpu(d, v) {
-        v->vcpu_info = &d->shared_info->vcpu_info[v->vcpu_id];
-    }
-
-    return 0;
-}
-
-void free_rma_check(struct page_info *page)
-{
-    if (test_bit(_PGC_page_RMA, &page->count_info)) {
-        if (!page_get_owner(page)->is_dying) {
-            panic("Attempt to free an RMA page: 0x%lx\n", page_to_mfn(page));
-        } else {
-            clear_bit(_PGC_page_RMA, &page->count_info);
-        }
-    }
-}
-
-ulong pfn2mfn(struct domain *d, ulong pfn, int *type)
-{
-    ulong mfn = INVALID_MFN;
-    int t = PFN_TYPE_NONE;
-    ulong foreign_map_pfn = 1UL << cpu_foreign_map_order();
-
-    /* quick tests first */
-    if (pfn & foreign_map_pfn) {
-        t = PFN_TYPE_FOREIGN;
-        mfn = foreign_to_mfn(d, pfn);
-    } else if (pfn >= max_page && pfn <
-              (max_page + nr_grant_frames(d->grant_table))) {
-        /* XXX access d->grant_table->nr_grant_frames without lock.
-         * Currently on powerpc dynamic expanding grant table is
-         * inhibited by setting max_nr_grant_frames = INITIAL_NR_GRANT_FRAMES
-         * so that this access is safe.
-         */
-        /* Its a grant table access */
-        t = PFN_TYPE_GNTTAB;
-        mfn = gnttab_shared_mfn(d, d->grant_table, (pfn - max_page));
-    } else if (d->is_privileged && platform_io_mfn(pfn)) {
-        t = PFN_TYPE_IO;
-        mfn = pfn;
-    } else {
-        if (pfn < d->arch.p2m_entries) {
-            t = PFN_TYPE_LOGICAL;
-            mfn = d->arch.p2m[pfn];
-        }
-#ifdef DEBUG
-        if (t != PFN_TYPE_NONE && d->is_dying &&
-            page_get_owner(mfn_to_page(mfn)) != d) {
-            printk("%s: page type: %d owner Dom[%d]:%p expected Dom[%d]:%p\n",
-                   __func__, t,
-                   page_get_owner(mfn_to_page(mfn))->domain_id,
-                   page_get_owner(mfn_to_page(mfn)),
-                   d->domain_id, d);
-            BUG();
-        }
-#endif
-    }
-
-    if (t == PFN_TYPE_NONE) {
-        /* This hack allows dom0 to map all memory, necessary to
-         * initialize domU state. */
-        if (d->is_privileged && mfn_valid(pfn)) {
-            struct page_info *pg;
-
-            /* page better be allocated to some domain but not the caller */
-            pg = mfn_to_page(pfn);
-            if (!(pg->count_info & PGC_allocated))
-                panic("Foreign page: 0x%lx is not owned by any domain\n",
-                      mfn);
-            if (page_get_owner(pg) == d)
-                panic("Foreign page: 0x%lx is owned by this domain\n",
-                      mfn);
-                
-            t = PFN_TYPE_FOREIGN;
-            mfn = pfn;
-        }
-    }
-
-    if (mfn == INVALID_MFN) {
-        printk("%s: Dom[%d] pfn 0x%lx is not a valid page\n",
-               __func__, d->domain_id, pfn);
-    }
-
-    if (type)
-        *type = t;
-
-    return mfn;
-}
-
-unsigned long mfn_to_gmfn(struct domain *d, unsigned long mfn)
-{
-    struct page_info *pg = mfn_to_page(mfn);
-    ulong gnttab_mfn;
-
-    /* is this our mfn? */
-    if (page_get_owner(pg) != d)
-        return INVALID_M2P_ENTRY;
-
-    /* XXX access d->grant_table->nr_grant_frames without lock.
-     * Currently on powerpc dynamic expanding grant table is
-     * inhibited by setting max_nr_grant_frames = INITIAL_NR_GRANT_FRAMES
-     * so that this access is safe.
-     */
-    /* grant? */
-    gnttab_mfn = gnttab_shared_mfn(d, d->grant_table, 0);
-    if (mfn >= gnttab_mfn && mfn <
-       (gnttab_mfn + nr_grant_frames(d->grant_table)))
-        return max_page + (mfn - gnttab_mfn);
-
-    /* IO? */
-    if (d->is_privileged && platform_io_mfn(mfn))
-        return mfn;
-
-    /* check m2p table */
-    return get_gpfn_from_mfn(mfn);
-}
-
-/* NB: caller holds d->page_alloc lock, sets d->max_pages = new_max */
-int guest_physmap_max_mem_pages(struct domain *d, unsigned long new_max_pages)
-{
-    u32 *p2m_array = NULL;
-    u32 *p2m_old = NULL;
-    ulong i;
-
-    /* XXX We probably could, but right now we don't shrink the p2m array.
-     * NB: d->max_pages >= d->arch.p2m_entries */
-    if (new_max_pages < d->max_pages) {
-        printk("Can't shrink DOM%d max memory pages\n", d->domain_id);
-        return -EINVAL;
-    }
-
-    /* Allocate one u32 per page. */
-    p2m_array = xmalloc_array(u32, new_max_pages);
-    if (p2m_array == NULL)
-        return -ENOMEM;
-
-    /* Copy old mappings into new array. */
-    if (d->arch.p2m != NULL) {
-        /* XXX This could take a long time; we should use a continuation. */
-        memcpy(p2m_array, d->arch.p2m, d->arch.p2m_entries * sizeof(u32));
-        p2m_old = d->arch.p2m;
-    }
-
-    /* Mark new mfns as invalid. */
-    for (i = d->arch.p2m_entries; i < new_max_pages; i++)
-        p2m_array[i] = INVALID_MFN;
-
-    /* Set new p2m pointer and size. */
-    d->arch.p2m = p2m_array;
-    d->arch.p2m_entries = new_max_pages;
-
-    /* Free old p2m array if present. */
-    if (p2m_old)
-        xfree(p2m_old);
-
-    return 0;
-}
-
-void guest_physmap_add_page(
-    struct domain *d, unsigned long gpfn, unsigned long mfn)
-{
-    if (page_get_owner(mfn_to_page(mfn)) != d) {
-        printk("Won't map foreign MFN 0x%lx for DOM%d\n", mfn, d->domain_id);
-        return;
-    }
-
-    /* Check that pfn is within guest table. */
-    if (gpfn >= d->arch.p2m_entries) {
-        printk("Won't map invalid PFN 0x%lx for DOM%d\n", gpfn, d->domain_id);
-        return;
-    }
-
-    /* Warn if there is an existing mapping. */
-    /* XXX: probably shouldn't let this happen, but
-       current interface doesn't throw errors.  =( */
-    if (d->arch.p2m[gpfn] != INVALID_MFN)
-        printk("Ack! PFN aliased. PFN%lx, old MFN=%x, new MFN=%lx\n",
-                gpfn, d->arch.p2m[gpfn], mfn);
-
-    /* PFN and MFN ok, map in p2m table. */
-    d->arch.p2m[gpfn] = mfn;
-
-    /* Map in m2p table. */
-    set_gpfn_from_mfn(mfn, gpfn);
-}
-
-void guest_physmap_remove_page(
-    struct domain *d, unsigned long gpfn, unsigned long mfn)
-{
-    if (page_get_owner(mfn_to_page(mfn)) != d) {
-        printk("Won't unmap foreign MFN 0x%lx for DOM%d\n", mfn, d->domain_id);
-        return;
-    }
-
-    /* check that pfn is within guest table */
-    if (gpfn >= d->arch.p2m_entries) {
-        printk("Won't unmap invalid PFN 0x%lx for DOM%d\n", gpfn, 
d->domain_id);
-        return;
-    }
-
-    /* PFN and MFN ok, unmap from p2m table. */
-    d->arch.p2m[gpfn] = INVALID_MFN;
-
-    /* Unmap from m2p table. */
-    set_gpfn_from_mfn(mfn, INVALID_M2P_ENTRY);
-}
-
-void shadow_drop_references(
-    struct domain *d, struct page_info *page)
-{
-}
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/mpic.c
--- a/xen/arch/powerpc/mpic.c   Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,1100 +0,0 @@
-/*
- *  arch/powerpc/kernel/mpic.c
- *
- *  Driver for interrupt controllers following the OpenPIC standard, the
- *  common implementation beeing IBM's MPIC. This driver also can deal
- *  with various broken implementations of this HW.
- *
- *  Copyright (C) 2004 Benjamin Herrenschmidt, IBM Corp.
- *
- *  This file is subject to the terms and conditions of the GNU General Public
- *  License.  See the file COPYING in the main directory of this archive
- *  for more details.
- */
-
-/* XXX Xen hacks ... */
-/* make this generic */
-
-#define le32_to_cpu(x)                                          \
-    ({                                                          \
-        __u32 __x = (x);                                        \
-        ((__u32)(                                               \
-             (((__u32)(__x) & (__u32)0x000000ffUL) << 24) |     \
-             (((__u32)(__x) & (__u32)0x0000ff00UL) <<  8) |     \
-             (((__u32)(__x) & (__u32)0x00ff0000UL) >>  8) |     \
-             (((__u32)(__x) & (__u32)0xff000000UL) >> 24) ));   \
-    })
-
-
-#define alloc_bootmem(x) xmalloc_bytes(x)
-
-#define IRQ_NONE       (0)
-#define IRQ_HANDLED    (1)
-#define IRQ_RETVAL(x)  ((x) != 0)
-
-#define IRQ_SENSE_MASK         0x1
-#define IRQ_SENSE_LEVEL                0x1     /* interrupt on active level */
-#define IRQ_SENSE_EDGE         0x0     /* interrupt triggered by edge */
-
-#define IRQ_POLARITY_MASK      0x2
-#define IRQ_POLARITY_POSITIVE  0x2     /* high level or low->high edge */
-#define IRQ_POLARITY_NEGATIVE  0x0     /* low level or high->low edge */
-
-#define CONFIG_IRQ_ALL_CPUS 0
-#define distribute_irqs        CONFIG_IRQ_ALL_CPUS
-#define CONFIG_MPIC_BROKEN_U3
-
-#define PCI_DEVFN(slot,func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))
-#define PCI_FUNC(devfn) ((devfn) & 0x07)
-#define PCI_HEADER_TYPE                0x0e    /* 8 bits */
-#define PCI_VENDOR_ID          0x00    /* 16 bits */
-#define PCI_VENDOR_ID_AMD 0x1022
-#define PCI_CAPABILITY_LIST    0x34    /* Offset of first capability list 
entry */
-#define PCI_CAP_LIST_NEXT      1       /* Next capability in the list */
-#define PCI_CAP_LIST_ID                0       /* Capability ID */
-#define  PCI_CAP_ID_HT_IRQCONF 0x08    /* HyperTransport IRQ Configuration */
-#define PCI_STATUS             0x06    /* 16 bits */
-#define  PCI_STATUS_CAP_LIST   0x10    /* Support Capability List */
-#define MSG_ALL 0x8001
-#define MSG_ALL_BUT_SELF 0x8000
-
-/* keeps file even closer to the original */
-#define pt_regs cpu_user_regs
-/* XXX ... Xen hacks */
-
-#undef DEBUG
-#undef DEBUG_IPI
-#undef DEBUG_IRQ
-#undef DEBUG_LOW
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/kernel.h>
-#include <xen/init.h>
-#include <xen/irq.h>
-#include <xen/smp.h>
-#ifndef __XEN__ 
-#include <linux/interrupt.h>
-#include <linux/bootmem.h>
-#endif
-#include <xen/spinlock.h>
-#ifndef __XEN__
-#include <asm/pci.h>
-
-#include <asm/ptrace.h>
-#include <asm/signal.h>
-#endif
-#include <asm/io.h>
-#ifndef __XEN__
-#include <asm/pgtable.h>
-#include <asm/irq.h>
-#include <asm/machdep.h>
-#endif
-#include <asm/mpic.h>
-#include <asm/smp.h>
-
-#ifdef DEBUG
-#define DBG(fmt...) printk(fmt)
-#else
-#define DBG(fmt...)
-#endif
-
-static struct mpic *mpics;
-static struct mpic *mpic_primary;
-static DEFINE_SPINLOCK(mpic_lock);
-
-#ifdef CONFIG_PPC32    /* XXX for now */
-#ifdef CONFIG_IRQ_ALL_CPUS
-#define distribute_irqs        (1)
-#else
-#define distribute_irqs        (0)
-#endif
-#endif
-
-/*
- * Register accessor functions
- */
-
-
-static inline u32 _mpic_read(unsigned int be, volatile u32 __iomem *base,
-                             unsigned int reg)
-{
-       if (be)
-               return in_be32(base + (reg >> 2));
-       else
-               return in_le32(base + (reg >> 2));
-}
-
-static inline void _mpic_write(unsigned int be, volatile u32 __iomem *base,
-                               unsigned int reg, u32 value)
-{
-       if (be)
-               out_be32(base + (reg >> 2), value);
-       else
-               out_le32(base + (reg >> 2), value);
-}
-
-static inline u32 _mpic_ipi_read(struct mpic *mpic, unsigned int ipi)
-{
-       unsigned int be = (mpic->flags & MPIC_BIG_ENDIAN) != 0;
-       unsigned int offset = MPIC_GREG_IPI_VECTOR_PRI_0 + (ipi * 0x10);
-
-       if (mpic->flags & MPIC_BROKEN_IPI)
-               be = !be;
-       return _mpic_read(be, mpic->gregs, offset);
-}
-
-static inline void _mpic_ipi_write(struct mpic *mpic, unsigned int ipi, u32 
value)
-{
-       unsigned int offset = MPIC_GREG_IPI_VECTOR_PRI_0 + (ipi * 0x10);
-
-       _mpic_write(mpic->flags & MPIC_BIG_ENDIAN, mpic->gregs, offset, value);
-}
-
-static inline u32 _mpic_cpu_read(struct mpic *mpic, unsigned int reg)
-{
-       unsigned int cpu = 0;
-
-       if (mpic->flags & MPIC_PRIMARY)
-               cpu = hard_smp_processor_id();
-
-       return _mpic_read(mpic->flags & MPIC_BIG_ENDIAN, mpic->cpuregs[cpu], 
reg);
-}
-
-static inline void _mpic_cpu_write(struct mpic *mpic, unsigned int reg, u32 
value)
-{
-       unsigned int cpu = 0;
-
-       if (mpic->flags & MPIC_PRIMARY)
-               cpu = hard_smp_processor_id();
-
-       _mpic_write(mpic->flags & MPIC_BIG_ENDIAN, mpic->cpuregs[cpu], reg, 
value);
-}
-
-static inline u32 _mpic_irq_read(struct mpic *mpic, unsigned int src_no, 
unsigned int reg)
-{
-       unsigned int    isu = src_no >> mpic->isu_shift;
-       unsigned int    idx = src_no & mpic->isu_mask;
-
-       return _mpic_read(mpic->flags & MPIC_BIG_ENDIAN, mpic->isus[isu],
-                      reg + (idx * MPIC_IRQ_STRIDE));
-}
-
-static inline void _mpic_irq_write(struct mpic *mpic, unsigned int src_no,
-                                   unsigned int reg, u32 value)
-{
-       unsigned int    isu = src_no >> mpic->isu_shift;
-       unsigned int    idx = src_no & mpic->isu_mask;
-
-       _mpic_write(mpic->flags & MPIC_BIG_ENDIAN, mpic->isus[isu],
-                reg + (idx * MPIC_IRQ_STRIDE), value);
-}
-
-#define mpic_read(b,r)         _mpic_read(mpic->flags & 
MPIC_BIG_ENDIAN,(b),(r))
-#define mpic_write(b,r,v)      _mpic_write(mpic->flags & 
MPIC_BIG_ENDIAN,(b),(r),(v))
-#define mpic_ipi_read(i)       _mpic_ipi_read(mpic,(i))
-#define mpic_ipi_write(i,v)    _mpic_ipi_write(mpic,(i),(v))
-#define mpic_cpu_read(i)       _mpic_cpu_read(mpic,(i))
-#define mpic_cpu_write(i,v)    _mpic_cpu_write(mpic,(i),(v))
-#define mpic_irq_read(s,r)     _mpic_irq_read(mpic,(s),(r))
-#define mpic_irq_write(s,r,v)  _mpic_irq_write(mpic,(s),(r),(v))
-
-
-/*
- * Low level utility functions
- */
-
-
-
-/* Check if we have one of those nice broken MPICs with a flipped endian on
- * reads from IPI registers
- */
-static void __init mpic_test_broken_ipi(struct mpic *mpic)
-{
-       u32 r;
-
-       mpic_write(mpic->gregs, MPIC_GREG_IPI_VECTOR_PRI_0, MPIC_VECPRI_MASK);
-       r = mpic_read(mpic->gregs, MPIC_GREG_IPI_VECTOR_PRI_0);
-
-       if (r == le32_to_cpu(MPIC_VECPRI_MASK)) {
-               printk(KERN_INFO "mpic: Detected reversed IPI registers\n");
-               mpic->flags |= MPIC_BROKEN_IPI;
-       }
-}
-
-#ifdef CONFIG_MPIC_BROKEN_U3
-
-/* Test if an interrupt is sourced from HyperTransport (used on broken U3s)
- * to force the edge setting on the MPIC and do the ack workaround.
- */
-static inline int mpic_is_ht_interrupt(struct mpic *mpic, unsigned int source)
-{
-       if (source >= 128 || !mpic->fixups)
-               return 0;
-       return mpic->fixups[source].base != NULL;
-}
-
-
-static inline void mpic_ht_end_irq(struct mpic *mpic, unsigned int source)
-{
-       struct mpic_irq_fixup *fixup = &mpic->fixups[source];
-
-       if (fixup->applebase) {
-               unsigned int soff = (fixup->index >> 3) & ~3;
-               unsigned int mask = 1U << (fixup->index & 0x1f);
-               writel(mask, fixup->applebase + soff);
-       } else {
-               spin_lock(&mpic->fixup_lock);
-               writeb(0x11 + 2 * fixup->index, fixup->base + 2);
-               writel(fixup->data, fixup->base + 4);
-               spin_unlock(&mpic->fixup_lock);
-       }
-}
-
-static void mpic_startup_ht_interrupt(struct mpic *mpic, unsigned int source,
-                                      unsigned int irqflags)
-{
-       struct mpic_irq_fixup *fixup = &mpic->fixups[source];
-       unsigned long flags;
-       u32 tmp;
-
-       if (fixup->base == NULL)
-               return;
-
-       DBG("startup_ht_interrupt(%u, %u) index: %d\n",
-           source, irqflags, fixup->index);
-       spin_lock_irqsave(&mpic->fixup_lock, flags);
-       /* Enable and configure */
-       writeb(0x10 + 2 * fixup->index, fixup->base + 2);
-       tmp = readl(fixup->base + 4);
-       tmp &= ~(0x23U);
-       if (irqflags & IRQ_LEVEL)
-               tmp |= 0x22;
-       writel(tmp, fixup->base + 4);
-       spin_unlock_irqrestore(&mpic->fixup_lock, flags);
-}
-
-static void mpic_shutdown_ht_interrupt(struct mpic *mpic, unsigned int source,
-                                       unsigned int irqflags)
-{
-       struct mpic_irq_fixup *fixup = &mpic->fixups[source];
-       unsigned long flags;
-       u32 tmp;
-
-       if (fixup->base == NULL)
-               return;
-
-       DBG("shutdown_ht_interrupt(%u, %u)\n", source, irqflags);
-
-       /* Disable */
-       spin_lock_irqsave(&mpic->fixup_lock, flags);
-       writeb(0x10 + 2 * fixup->index, fixup->base + 2);
-       tmp = readl(fixup->base + 4);
-       tmp |= 1;
-       writel(tmp, fixup->base + 4);
-       spin_unlock_irqrestore(&mpic->fixup_lock, flags);
-}
-
-static void __init mpic_scan_ht_pic(struct mpic *mpic, u8 __iomem *devbase,
-                                    unsigned int devfn, u32 vdid)
-{
-       int i, irq, n;
-       u8 __iomem *base;
-       u32 tmp;
-       u8 pos;
-
-       for (pos = readb(devbase + PCI_CAPABILITY_LIST); pos != 0;
-            pos = readb(devbase + pos + PCI_CAP_LIST_NEXT)) {
-               u8 id = readb(devbase + pos + PCI_CAP_LIST_ID);
-               if (id == PCI_CAP_ID_HT_IRQCONF) {
-                       id = readb(devbase + pos + 3);
-                       if (id == 0x80)
-                               break;
-               }
-       }
-       if (pos == 0)
-               return;
-
-       base = devbase + pos;
-       writeb(0x01, base + 2);
-       n = (readl(base + 4) >> 16) & 0xff;
-
-       printk(KERN_INFO "mpic:   - HT:%02x.%x [0x%02x] vendor %04x device %04x"
-              " has %d irqs\n",
-              devfn >> 3, devfn & 0x7, pos, vdid & 0xffff, vdid >> 16, n + 1);
-
-       for (i = 0; i <= n; i++) {
-               writeb(0x10 + 2 * i, base + 2);
-               tmp = readl(base + 4);
-               irq = (tmp >> 16) & 0xff;
-               DBG("HT PIC index 0x%x, irq 0x%x, tmp: %08x\n", i, irq, tmp);
-               /* mask it , will be unmasked later */
-               tmp |= 0x1;
-               writel(tmp, base + 4);
-               mpic->fixups[irq].index = i;
-               mpic->fixups[irq].base = base;
-               /* Apple HT PIC has a non-standard way of doing EOIs */
-               if ((vdid & 0xffff) == 0x106b)
-                       mpic->fixups[irq].applebase = devbase + 0x60;
-               else
-                       mpic->fixups[irq].applebase = NULL;
-               writeb(0x11 + 2 * i, base + 2);
-               mpic->fixups[irq].data = readl(base + 4) | 0x80000000;
-       }
-}
- 
-
-static void __init mpic_scan_ht_pics(struct mpic *mpic)
-{
-       unsigned int devfn;
-       u8 __iomem *cfgspace;
-
-       printk(KERN_INFO "mpic: Setting up HT PICs workarounds for U3/U4\n");
-
-       /* Allocate fixups array */
-       mpic->fixups = alloc_bootmem(128 * sizeof(struct mpic_irq_fixup));
-       BUG_ON(mpic->fixups == NULL);
-       memset(mpic->fixups, 0, 128 * sizeof(struct mpic_irq_fixup));
-
-       /* Init spinlock */
-       spin_lock_init(&mpic->fixup_lock);
-
-       /* Map U3 config space. We assume all IO-APICs are on the primary bus
-        * so we only need to map 64kB.
-        */
-       cfgspace = ioremap(0xf2000000, 0x10000);
-       BUG_ON(cfgspace == NULL);
-
-       /* Now we scan all slots. We do a very quick scan, we read the header
-        * type, vendor ID and device ID only, that's plenty enough
-        */
-       for (devfn = 0; devfn < 0x100; devfn++) {
-               u8 __iomem *devbase = cfgspace + (devfn << 8);
-               u8 hdr_type = readb(devbase + PCI_HEADER_TYPE);
-               u32 l = readl(devbase + PCI_VENDOR_ID);
-               u16 s;
-
-               DBG("devfn %x, l: %x\n", devfn, l);
-
-               /* If no device, skip */
-               if (l == 0xffffffff || l == 0x00000000 ||
-                   l == 0x0000ffff || l == 0xffff0000)
-                       goto next;
-               /* Check if is supports capability lists */
-               s = readw(devbase + PCI_STATUS);
-               if (!(s & PCI_STATUS_CAP_LIST))
-                       goto next;
-
-               mpic_scan_ht_pic(mpic, devbase, devfn, l);
-
-       next:
-               /* next device, if function 0 */
-               if (PCI_FUNC(devfn) == 0 && (hdr_type & 0x80) == 0)
-                       devfn += 7;
-       }
-}
-
-#endif /* CONFIG_MPIC_BROKEN_U3 */
-
-
-/* Find an mpic associated with a given linux interrupt */
-static struct mpic *mpic_find(unsigned int irq, unsigned int *is_ipi)
-{
-       struct mpic *mpic = mpics;
-
-       while(mpic) {
-               /* search IPIs first since they may override the main 
interrupts */
-               if (irq >= mpic->ipi_offset && irq < (mpic->ipi_offset + 4)) {
-                       if (is_ipi)
-                               *is_ipi = 1;
-                       return mpic;
-               }
-               if (irq >= mpic->irq_offset &&
-                   irq < (mpic->irq_offset + mpic->irq_count)) {
-                       if (is_ipi)
-                               *is_ipi = 0;
-                       return mpic;
-               }
-               mpic = mpic -> next;
-       }
-       return NULL;
-}
-
-/* Convert a cpu mask from logical to physical cpu numbers. */
-static inline u32 mpic_physmask(u32 cpumask)
-{
-       int i;
-       u32 mask = 0;
-
-       for (i = 0; i < NR_CPUS; ++i, cpumask >>= 1)
-               mask |= (cpumask & 1) << get_hard_smp_processor_id(i);
-       return mask;
-}
-
-#ifdef CONFIG_SMP
-/* Get the mpic structure from the IPI number */
-static inline struct mpic * mpic_from_ipi(unsigned int ipi)
-{
-       return container_of(irq_desc[ipi].handler, struct mpic, hc_ipi);
-}
-#endif
-
-/* Get the mpic structure from the irq number */
-static inline struct mpic * mpic_from_irq(unsigned int irq)
-{
-       return container_of(irq_desc[irq].handler, struct mpic, hc_irq);
-}
-
-/* Send an EOI */
-static inline void mpic_eoi(struct mpic *mpic)
-{
-       mpic_cpu_write(MPIC_CPU_EOI, 0);
-       (void)mpic_cpu_read(MPIC_CPU_WHOAMI);
-}
-
-#ifdef CONFIG_SMP
-static irqreturn_t mpic_ipi_action(int irq, void *dev_id, struct pt_regs *regs)
-{
-       struct mpic *mpic = dev_id;
-
-       smp_message_recv(irq - mpic->ipi_offset, regs);
-       return IRQ_HANDLED;
-}
-#endif /* CONFIG_SMP */
-
-/*
- * Linux descriptor level callbacks
- */
-
-
-static void mpic_enable_irq(unsigned int irq)
-{
-       unsigned int loops = 100000;
-       struct mpic *mpic = mpic_from_irq(irq);
-       unsigned int src = irq - mpic->irq_offset;
-
-       DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, irq, src);
-
-       mpic_irq_write(src, MPIC_IRQ_VECTOR_PRI,
-                   mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) &
-                   ~MPIC_VECPRI_MASK);
-
-       /* make sure mask gets to controller before we return to user */
-       do {
-               if (!loops--) {
-                       printk(KERN_ERR "mpic_enable_irq timeout\n");
-                       break;
-               }
-       } while(mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) & MPIC_VECPRI_MASK);    
-
-#ifdef CONFIG_MPIC_BROKEN_U3
-       if (mpic->flags & MPIC_BROKEN_U3) {
-               unsigned int bsrc = irq - mpic->irq_offset;
-               if (mpic_is_ht_interrupt(mpic, bsrc) &&
-                   (irq_desc[irq].status & IRQ_LEVEL))
-                       mpic_ht_end_irq(mpic, bsrc);
-       }
-#endif /* CONFIG_MPIC_BROKEN_U3 */
-}
-
-static unsigned int mpic_startup_irq(unsigned int irq)
-{
-#ifdef CONFIG_MPIC_BROKEN_U3
-       struct mpic *mpic = mpic_from_irq(irq);
-       unsigned int src = irq - mpic->irq_offset;
-#endif /* CONFIG_MPIC_BROKEN_U3 */
-
-       mpic_enable_irq(irq);
-
-#ifdef CONFIG_MPIC_BROKEN_U3
-       if (mpic_is_ht_interrupt(mpic, src))
-               mpic_startup_ht_interrupt(mpic, src, irq_desc[irq].status);
-#endif /* CONFIG_MPIC_BROKEN_U3 */
-
-       return 0;
-}
-
-static void mpic_disable_irq(unsigned int irq)
-{
-       unsigned int loops = 100000;
-       struct mpic *mpic = mpic_from_irq(irq);
-       unsigned int src = irq - mpic->irq_offset;
-
-       DBG("%s: disable_irq: %d (src %d)\n", mpic->name, irq, src);
-
-       mpic_irq_write(src, MPIC_IRQ_VECTOR_PRI,
-                   mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) |
-                   MPIC_VECPRI_MASK);
-
-       /* make sure mask gets to controller before we return to user */
-       do {
-               if (!loops--) {
-                       printk(KERN_ERR "mpic_enable_irq timeout\n");
-                       break;
-               }
-       } while(!(mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) & MPIC_VECPRI_MASK));
-}
-
-static void mpic_shutdown_irq(unsigned int irq)
-{
-#ifdef CONFIG_MPIC_BROKEN_U3
-       struct mpic *mpic = mpic_from_irq(irq);
-       unsigned int src = irq - mpic->irq_offset;
-
-       if (mpic_is_ht_interrupt(mpic, src))
-               mpic_shutdown_ht_interrupt(mpic, src, irq_desc[irq].status);
-
-#endif /* CONFIG_MPIC_BROKEN_U3 */
-
-       mpic_disable_irq(irq);
-}
-
-static void mpic_end_irq(unsigned int irq)
-{
-       struct mpic *mpic = mpic_from_irq(irq);
-
-#ifdef DEBUG_IRQ
-       DBG("%s: end_irq: %d\n", mpic->name, irq);
-#endif
-       /* We always EOI on end_irq() even for edge interrupts since that
-        * should only lower the priority, the MPIC should have properly
-        * latched another edge interrupt coming in anyway
-        */
-
-#ifdef CONFIG_MPIC_BROKEN_U3
-       if (mpic->flags & MPIC_BROKEN_U3) {
-               unsigned int src = irq - mpic->irq_offset;
-               if (mpic_is_ht_interrupt(mpic, src) &&
-                   (irq_desc[irq].status & IRQ_LEVEL))
-                       mpic_ht_end_irq(mpic, src);
-       }
-#endif /* CONFIG_MPIC_BROKEN_U3 */
-
-       mpic_eoi(mpic);
-}
-
-#ifdef CONFIG_SMP
-
-static void mpic_enable_ipi(unsigned int irq)
-{
-       struct mpic *mpic = mpic_from_ipi(irq);
-       unsigned int src = irq - mpic->ipi_offset;
-
-       DBG("%s: enable_ipi: %d (ipi %d)\n", mpic->name, irq, src);
-       mpic_ipi_write(src, mpic_ipi_read(src) & ~MPIC_VECPRI_MASK);
-}
-
-static void mpic_disable_ipi(unsigned int irq)
-{
-       /* NEVER disable an IPI... that's just plain wrong! */
-}
-
-static void mpic_end_ipi(unsigned int irq)
-{
-       struct mpic *mpic = mpic_from_ipi(irq);
-
-       /*
-        * IPIs are marked IRQ_PER_CPU. This has the side effect of
-        * preventing the IRQ_PENDING/IRQ_INPROGRESS logic from
-        * applying to them. We EOI them late to avoid re-entering.
-        * We mark IPI's with SA_INTERRUPT as they must run with
-        * irqs disabled.
-        */
-       mpic_eoi(mpic);
-}
-
-#endif /* CONFIG_SMP */
-
-static void mpic_set_affinity(unsigned int irq, cpumask_t cpumask)
-{
-       struct mpic *mpic = mpic_from_irq(irq);
-
-       cpumask_t tmp;
-
-       cpus_and(tmp, cpumask, cpu_online_map);
-
-       mpic_irq_write(irq - mpic->irq_offset, MPIC_IRQ_DESTINATION,
-                   mpic_physmask(cpus_addr(tmp)[0]));  
-}
-
-
-/*
- * Exported functions
- */
-
-
-struct mpic * __init mpic_alloc(unsigned long phys_addr,
-                                unsigned int flags,
-                                unsigned int isu_size,
-                                unsigned int irq_offset,
-                                unsigned int irq_count,
-                                unsigned int ipi_offset,
-                                unsigned char *senses,
-                                unsigned int senses_count,
-                                const char *name)
-{
-       struct mpic     *mpic;
-       u32             reg;
-       const char      *vers;
-       int             i;
-
-       mpic = alloc_bootmem(sizeof(struct mpic));
-       if (mpic == NULL)
-               return NULL;
-       
-
-       memset(mpic, 0, sizeof(struct mpic));
-       mpic->name = name;
-
-       mpic->hc_irq.typename = name;
-       mpic->hc_irq.startup = mpic_startup_irq;
-       mpic->hc_irq.shutdown = mpic_shutdown_irq;
-       mpic->hc_irq.enable = mpic_enable_irq;
-       mpic->hc_irq.disable = mpic_disable_irq;
-       mpic->hc_irq.end = mpic_end_irq;
-       if (flags & MPIC_PRIMARY)
-               mpic->hc_irq.set_affinity = mpic_set_affinity;
-#ifdef CONFIG_SMP
-       mpic->hc_ipi.typename = name;
-       mpic->hc_ipi.enable = mpic_enable_ipi;
-       mpic->hc_ipi.disable = mpic_disable_ipi;
-       mpic->hc_ipi.end = mpic_end_ipi;
-#endif /* CONFIG_SMP */
-
-       mpic->flags = flags;
-       mpic->isu_size = isu_size;
-       mpic->irq_offset = irq_offset;
-       mpic->irq_count = irq_count;
-       mpic->ipi_offset = ipi_offset;
-       mpic->num_sources = 0; /* so far */
-       mpic->senses = senses;
-       mpic->senses_count = senses_count;
-
-       /* Map the global registers */
-       mpic->gregs = ioremap(phys_addr + MPIC_GREG_BASE, 0x1000);
-       mpic->tmregs = mpic->gregs + ((MPIC_TIMER_BASE - MPIC_GREG_BASE) >> 2);
-       BUG_ON(mpic->gregs == NULL);
-
-       /* Reset */
-       if (flags & MPIC_WANTS_RESET) {
-               mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_0,
-                   mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_0)
-                   | MPIC_GREG_GCONF_RESET);
-               while( mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_0)
-                      & MPIC_GREG_GCONF_RESET)
-                       mb();
-       }
-
-       /* Read feature register, calculate num CPUs and, for non-ISU
-        * MPICs, num sources as well. On ISU MPICs, sources are counted
-        * as ISUs are added
-        */
-       reg = mpic_read(mpic->gregs, MPIC_GREG_FEATURE_0);
-       mpic->num_cpus = ((reg & MPIC_GREG_FEATURE_LAST_CPU_MASK)
-                      >> MPIC_GREG_FEATURE_LAST_CPU_SHIFT) + 1;
-       if (isu_size == 0)
-               mpic->num_sources = ((reg & MPIC_GREG_FEATURE_LAST_SRC_MASK)
-                             >> MPIC_GREG_FEATURE_LAST_SRC_SHIFT) + 1;
-
-       /* Map the per-CPU registers */
-       for (i = 0; i < mpic->num_cpus; i++) {
-               mpic->cpuregs[i] = ioremap(phys_addr + MPIC_CPU_BASE +
-                                   i * MPIC_CPU_STRIDE, 0x1000);
-               BUG_ON(mpic->cpuregs[i] == NULL);
-       }
-
-       /* Initialize main ISU if none provided */
-       if (mpic->isu_size == 0) {
-               mpic->isu_size = mpic->num_sources;
-               mpic->isus[0] = ioremap(phys_addr + MPIC_IRQ_BASE,
-                                MPIC_IRQ_STRIDE * mpic->isu_size);
-               BUG_ON(mpic->isus[0] == NULL);
-       }
-       mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1);
-       mpic->isu_mask = (1 << mpic->isu_shift) - 1;
-
-       /* Display version */
-       switch (reg & MPIC_GREG_FEATURE_VERSION_MASK) {
-       case 1:
-               vers = "1.0";
-               break;
-       case 2:
-               vers = "1.2";
-               break;
-       case 3:
-               vers = "1.3";
-               break;
-       default:
-               vers = "<unknown>";
-               break;
-       }
-       printk(KERN_INFO "mpic: Setting up MPIC \"%s\" version %s at %lx, max 
%d CPUs\n",
-              name, vers, phys_addr, mpic->num_cpus);
-       printk(KERN_INFO "mpic: ISU size: %d, shift: %d, mask: %x\n", 
mpic->isu_size,
-              mpic->isu_shift, mpic->isu_mask);
-
-       mpic->next = mpics;
-       mpics = mpic;
-
-       if (flags & MPIC_PRIMARY)
-               mpic_primary = mpic;
-
-       return mpic;
-}
-
-void __init mpic_assign_isu(struct mpic *mpic, unsigned int isu_num,
-                            unsigned long phys_addr)
-{
-       unsigned int isu_first = isu_num * mpic->isu_size;
-
-       BUG_ON(isu_num >= MPIC_MAX_ISU);
-
-       mpic->isus[isu_num] = ioremap(phys_addr, MPIC_IRQ_STRIDE * 
mpic->isu_size);
-       if ((isu_first + mpic->isu_size) > mpic->num_sources)
-               mpic->num_sources = isu_first + mpic->isu_size;
-}
-
-void __init mpic_setup_cascade(unsigned int irq, mpic_cascade_t handler,
-                               void *data)
-{
-       struct mpic *mpic = mpic_find(irq, NULL);
-       unsigned long flags;
-
-       /* Synchronization here is a bit dodgy, so don't try to replace cascade
-        * interrupts on the fly too often ... but normally it's set up at boot.
-        */
-       spin_lock_irqsave(&mpic_lock, flags);
-       if (mpic->cascade)             
-               mpic_disable_irq(mpic->cascade_vec + mpic->irq_offset);
-       mpic->cascade = NULL;
-       wmb();
-       mpic->cascade_vec = irq - mpic->irq_offset;
-       mpic->cascade_data = data;
-       wmb();
-       mpic->cascade = handler;
-       mpic_enable_irq(irq);
-       spin_unlock_irqrestore(&mpic_lock, flags);
-}
-
-void __init mpic_init(struct mpic *mpic)
-{
-       int i;
-
-       BUG_ON(mpic->num_sources == 0);
-
-       printk(KERN_INFO "mpic: Initializing for %d sources\n", 
mpic->num_sources);
-
-       /* Set current processor priority to max */
-       mpic_cpu_write(MPIC_CPU_CURRENT_TASK_PRI, 0xf);
-
-       /* Initialize timers: just disable them all */
-       for (i = 0; i < 4; i++) {
-               mpic_write(mpic->tmregs,
-                   i * MPIC_TIMER_STRIDE + MPIC_TIMER_DESTINATION, 0);
-               mpic_write(mpic->tmregs,
-                   i * MPIC_TIMER_STRIDE + MPIC_TIMER_VECTOR_PRI,
-                   MPIC_VECPRI_MASK |
-                   (MPIC_VEC_TIMER_0 + i));
-       }
-
-       /* Initialize IPIs to our reserved vectors and mark them disabled for 
now */
-       mpic_test_broken_ipi(mpic);
-       for (i = 0; i < 4; i++) {
-               mpic_ipi_write(i,
-                       MPIC_VECPRI_MASK |
-                       (10 << MPIC_VECPRI_PRIORITY_SHIFT) |
-                       (MPIC_VEC_IPI_0 + i));
-#ifdef CONFIG_SMP
-               if (!(mpic->flags & MPIC_PRIMARY))
-                       continue;
-               irq_desc[mpic->ipi_offset+i].status |= IRQ_PER_CPU;
-               irq_desc[mpic->ipi_offset+i].handler = &mpic->hc_ipi;
-#endif /* CONFIG_SMP */
-       }
-
-       /* Initialize interrupt sources */
-       if (mpic->irq_count == 0)
-               mpic->irq_count = mpic->num_sources;
-
-#ifdef CONFIG_MPIC_BROKEN_U3
-       /* Do the HT PIC fixups on U3 broken mpic */
-       DBG("MPIC flags: %x\n", mpic->flags);
-       if ((mpic->flags & MPIC_BROKEN_U3) && (mpic->flags & MPIC_PRIMARY))
-               mpic_scan_ht_pics(mpic);
-#endif /* CONFIG_MPIC_BROKEN_U3 */
-
-       for (i = 0; i < mpic->num_sources; i++) {
-               /* start with vector = source number, and masked */
-               u32 vecpri = MPIC_VECPRI_MASK | i | (8 << 
MPIC_VECPRI_PRIORITY_SHIFT);
-               int level = 0;
-               
-               /* if it's an IPI, we skip it */
-               if ((mpic->irq_offset + i) >= (mpic->ipi_offset + i) &&
-                   (mpic->irq_offset + i) <  (mpic->ipi_offset + i + 4))
-                       continue;
-
-               /* do senses munging */
-               if (mpic->senses && i < mpic->senses_count) {
-                       if (mpic->senses[i] & IRQ_SENSE_LEVEL)
-                               vecpri |= MPIC_VECPRI_SENSE_LEVEL;
-                       if (mpic->senses[i] & IRQ_POLARITY_POSITIVE)
-                               vecpri |= MPIC_VECPRI_POLARITY_POSITIVE;
-               } else
-                       vecpri |= MPIC_VECPRI_SENSE_LEVEL;
-
-               /* remember if it was a level interrupts */
-               level = (vecpri & MPIC_VECPRI_SENSE_LEVEL);
-
-               /* deal with broken U3 */
-               if (mpic->flags & MPIC_BROKEN_U3) {
-#ifdef CONFIG_MPIC_BROKEN_U3
-                       if (mpic_is_ht_interrupt(mpic, i)) {
-                               vecpri &= ~(MPIC_VECPRI_SENSE_MASK |
-                            MPIC_VECPRI_POLARITY_MASK);
-                               vecpri |= MPIC_VECPRI_POLARITY_POSITIVE;
-                       }
-#else
-                       printk(KERN_ERR "mpic: BROKEN_U3 set, but CONFIG 
doesn't match\n");
-#endif
-               }
-
-               DBG("setup source %d, vecpri: %08x, level: %d\n", i, vecpri,
-                   (level != 0));
-
-               /* init hw */
-               mpic_irq_write(i, MPIC_IRQ_VECTOR_PRI, vecpri);
-               mpic_irq_write(i, MPIC_IRQ_DESTINATION,
-                       1 << hard_smp_processor_id());
-
-               /* init linux descriptors */
-               if (i < mpic->irq_count) {
-                       irq_desc[mpic->irq_offset+i].status = level ? IRQ_LEVEL 
: 0;
-                       irq_desc[mpic->irq_offset+i].handler = &mpic->hc_irq;
-               }
-       }
-       
-       /* Init spurrious vector */
-       mpic_write(mpic->gregs, MPIC_GREG_SPURIOUS, MPIC_VEC_SPURRIOUS);
-
-       /* Disable 8259 passthrough */
-       mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_0,
-               mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_0)
-               | MPIC_GREG_GCONF_8259_PTHROU_DIS);
-
-       /* Set current processor priority to 0 */
-       mpic_cpu_write(MPIC_CPU_CURRENT_TASK_PRI, 0);
-}
-
-
-
-void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
-{
-       unsigned is_ipi;
-       struct mpic *mpic = mpic_find(irq, &is_ipi);
-       unsigned long flags;
-       u32 reg;
-
-       spin_lock_irqsave(&mpic_lock, flags);
-       if (is_ipi) {
-               reg = mpic_ipi_read(irq - mpic->ipi_offset) &
-                       ~MPIC_VECPRI_PRIORITY_MASK;
-               mpic_ipi_write(irq - mpic->ipi_offset,
-                       reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT));
-       } else {
-               reg = mpic_irq_read(irq - mpic->irq_offset,MPIC_IRQ_VECTOR_PRI)
-                       & ~MPIC_VECPRI_PRIORITY_MASK;
-               mpic_irq_write(irq - mpic->irq_offset, MPIC_IRQ_VECTOR_PRI,
-                       reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT));
-       }
-       spin_unlock_irqrestore(&mpic_lock, flags);
-}
-
-unsigned int mpic_irq_get_priority(unsigned int irq)
-{
-       unsigned is_ipi;
-       struct mpic *mpic = mpic_find(irq, &is_ipi);
-       unsigned long flags;
-       u32 reg;
-
-       spin_lock_irqsave(&mpic_lock, flags);
-       if (is_ipi)
-               reg = mpic_ipi_read(irq - mpic->ipi_offset);
-       else
-               reg = mpic_irq_read(irq - mpic->irq_offset, 
MPIC_IRQ_VECTOR_PRI);
-       spin_unlock_irqrestore(&mpic_lock, flags);
-       return (reg & MPIC_VECPRI_PRIORITY_MASK) >> MPIC_VECPRI_PRIORITY_SHIFT;
-}
-
-void mpic_setup_this_cpu(void)
-{
-#ifdef CONFIG_SMP
-       struct mpic *mpic = mpic_primary;
-       unsigned long flags;
-       u32 msk = 1 << hard_smp_processor_id();
-       unsigned int i;
-
-       BUG_ON(mpic == NULL);
-
-       DBG("%s: setup_this_cpu(%d)\n", mpic->name, hard_smp_processor_id());
-
-       spin_lock_irqsave(&mpic_lock, flags);
-
-       /* let the mpic know we want intrs. default affinity is 0xffffffff
-        * until changed via /proc. That's how it's done on x86. If we want
-        * it differently, then we should make sure we also change the default
-        * values of irq_affinity in irq.c.
-        */
-       if (distribute_irqs) {
-               for (i = 0; i < mpic->num_sources ; i++)
-                       mpic_irq_write(i, MPIC_IRQ_DESTINATION,
-                           mpic_irq_read(i, MPIC_IRQ_DESTINATION) | msk);
-       }
-
-       /* Set current processor priority to 0 */
-       mpic_cpu_write(MPIC_CPU_CURRENT_TASK_PRI, 0);
-
-       spin_unlock_irqrestore(&mpic_lock, flags);
-#endif /* CONFIG_SMP */
-}
-
-int mpic_cpu_get_priority(void)
-{
-       struct mpic *mpic = mpic_primary;
-
-       return mpic_cpu_read(MPIC_CPU_CURRENT_TASK_PRI);
-}
-
-void mpic_cpu_set_priority(int prio)
-{
-       struct mpic *mpic = mpic_primary;
-
-       prio &= MPIC_CPU_TASKPRI_MASK;
-       mpic_cpu_write(MPIC_CPU_CURRENT_TASK_PRI, prio);
-}
-
-/*
- * XXX: someone who knows mpic should check this.
- * do we need to eoi the ipi including for kexec cpu here (see xics comments)?
- * or can we reset the mpic in the new kernel?
- */
-void mpic_teardown_this_cpu(int secondary)
-{
-       struct mpic *mpic = mpic_primary;
-       unsigned long flags;
-       u32 msk = 1 << hard_smp_processor_id();
-       unsigned int i;
-
-       BUG_ON(mpic == NULL);
-
-       DBG("%s: teardown_this_cpu(%d)\n", mpic->name, hard_smp_processor_id());
-       spin_lock_irqsave(&mpic_lock, flags);
-
-       /* let the mpic know we don't want intrs.  */
-       for (i = 0; i < mpic->num_sources ; i++)
-               mpic_irq_write(i, MPIC_IRQ_DESTINATION,
-                       mpic_irq_read(i, MPIC_IRQ_DESTINATION) & ~msk);
-
-       /* Set current processor priority to max */
-       mpic_cpu_write(MPIC_CPU_CURRENT_TASK_PRI, 0xf);
-
-       spin_unlock_irqrestore(&mpic_lock, flags);
-}
-
-
-void mpic_send_ipi(unsigned int ipi_no, unsigned int cpu_mask)
-{
-       struct mpic *mpic = mpic_primary;
-
-       BUG_ON(mpic == NULL);
-
-#ifdef DEBUG_IPI
-       DBG("%s: send_ipi(ipi_no: %d)\n", mpic->name, ipi_no);
-#endif
-
-       mpic_cpu_write(MPIC_CPU_IPI_DISPATCH_0 + ipi_no * 0x10,
-                   mpic_physmask(cpu_mask & cpus_addr(cpu_online_map)[0]));
-}
-
-int mpic_get_one_irq(struct mpic *mpic, struct pt_regs *regs)
-{
-       u32 irq;
-
-       irq = mpic_cpu_read(MPIC_CPU_INTACK) & MPIC_VECPRI_VECTOR_MASK;
-#ifdef DEBUG_LOW
-       DBG("%s: get_one_irq(): %d\n", mpic->name, irq);
-#endif
-       if (mpic->cascade && irq == mpic->cascade_vec) {
-#ifdef DEBUG_LOW
-               DBG("%s: cascading ...\n", mpic->name);
-#endif
-               irq = mpic->cascade(regs, mpic->cascade_data);
-               mpic_eoi(mpic);
-               return irq;
-       }
-       if (unlikely(irq == MPIC_VEC_SPURRIOUS))
-               return -1;
-       if (irq < MPIC_VEC_IPI_0) {
-#ifdef DEBUG_IRQ
-               DBG("%s: irq %d\n", mpic->name, irq + mpic->irq_offset);
-#endif
-               return irq + mpic->irq_offset;
-       }
-#ifdef DEBUG_IPI
-    DBG("%s: ipi %d !\n", mpic->name, irq - MPIC_VEC_IPI_0);
-#endif
-       return irq - MPIC_VEC_IPI_0 + mpic->ipi_offset;
-}
-
-int mpic_get_irq(struct pt_regs *regs)
-{
-       struct mpic *mpic = mpic_primary;
-
-       BUG_ON(mpic == NULL);
-
-       return mpic_get_one_irq(mpic, regs);
-}
-
-
-#ifdef CONFIG_SMP
-void mpic_request_ipis(void)
-{
-       struct mpic *mpic = mpic_primary;
-
-       BUG_ON(mpic == NULL);
-       
-       printk("requesting IPIs ... \n");
-
-       /* IPIs are marked SA_INTERRUPT as they must run with irqs disabled */
-       request_irq(mpic->ipi_offset+0, mpic_ipi_action, SA_INTERRUPT,
-                "IPI0 (call function)", mpic);
-       request_irq(mpic->ipi_offset+1, mpic_ipi_action, SA_INTERRUPT,
-                "IPI1 (reschedule)", mpic);
-       request_irq(mpic->ipi_offset+2, mpic_ipi_action, SA_INTERRUPT,
-                "IPI2 (unused)", mpic);
-       request_irq(mpic->ipi_offset+3, mpic_ipi_action, SA_INTERRUPT,
-                "IPI3 (debugger break)", mpic);
-
-       printk("IPIs requested... \n");
-}
-
-void smp_mpic_message_pass(int target, int msg)
-{
-       /* make sure we're sending something that translates to an IPI */
-       if ((unsigned int)msg > 3) {
-               printk("SMP %d: smp_message_pass: unknown msg %d\n",
-                      smp_processor_id(), msg);
-               return;
-       }
-       switch (target) {
-       case MSG_ALL:
-               mpic_send_ipi(msg, 0xffffffff);
-               break;
-       case MSG_ALL_BUT_SELF:
-               mpic_send_ipi(msg, 0xffffffff & ~(1 << smp_processor_id()));
-               break;
-       default:
-               mpic_send_ipi(msg, 1 << target);
-               break;
-       }
-}
-#endif /* CONFIG_SMP */
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/mpic_init.c
--- a/xen/arch/powerpc/mpic_init.c      Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,416 +0,0 @@
-/*
- * 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 (C) IBM Corp. 2005
- *
- * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- */
-
-#include <xen/config.h>
-#include <xen/init.h>
-#include <xen/lib.h>
-#include <asm/mpic.h>
-#include <errno.h>
-#include "mpic_init.h"
-#include "oftree.h"
-#include "of-devtree.h"
-
-#undef DEBUG
-#define CONFIG_SHARE_MPIC
-
-#ifdef DEBUG
-#define DBG(fmt...) printk(fmt)
-#else
-#define DBG(fmt...)
-#endif
-
-#define PANIC(fmt...) DBG(fmt)
-
-static struct mpic *mpic;
-static unsigned long opic_addr;
-static unsigned int opic_flags;
-
-/*
- * from OF_IEEE_1275
- *
- * pg 175, property "ranges"
- *
- * The number of integers in each size entry is determined by the
- * value of the #size-cells property of this node (the node in which
- * the ranges property appears) or 1 if the #size-cells property is
- * absent.
- *
- *
- * pg 177, property "reg"
- *
- * The number of integers in each size entry is determined by the
- * value of the "#size-cells" property in the parent node.  If the
- * parent node has no such property, the value is one.
- */
-static unsigned long reg2(void *oft_p, ofdn_t c)
-{
-    int rc;
-    /* the struct isa_reg_property is for a value of 2 for
-     * #address-cells and a value of 1 for #size-cells (of the
-     * parent).
-     */
-    struct isa_reg_property {
-        u32 space;
-        u32 address;
-        u32 size;
-    } isa_reg;
-
-    rc = ofd_getprop(oft_p, c, "reg", &isa_reg, sizeof(isa_reg));
-
-    DBG("%s: reg property address=0x%08x  size=0x%08x\n", __func__,
-        isa_reg.address, isa_reg.size);
-    return isa_reg.address;
-}
-
-static unsigned long reg1(void *oft_p, ofdn_t c)
-{
-    int rc;
-    /* the struct reg_property32 is for a value of 1 for
-     * #address-cells and a value of 1 for #size-cells.
-     */
-    struct reg_property32 {
-        u32 address;
-        u32 size;
-    } reg;
-
-    rc = ofd_getprop(oft_p, c, "reg", &reg, sizeof(reg));
-
-    DBG("%s: reg property address=0x%08x  size=0x%08x\n", __func__,
-        reg.address, reg.size);
-    return reg.address;
-}
-
-static unsigned long find_reg_addr_from_node(void *oft_p, ofdn_t c)
-{
-    int p_len;
-    unsigned long reg_addr = 0;
-    u32 size_c = 1;
-    u32 addr_c = 2;
-    ofdn_t parent;
-
-    if (c == OFD_ROOT) {
-        parent = c;
-    } else {
-        parent = ofd_node_parent(oft_p, c);
-    }
-
-    p_len = ofd_getprop(oft_p, parent, "#size-cells", &size_c, sizeof(size_c));
-    DBG("%s size is %d\n", __func__, size_c);
-
-    p_len = ofd_getprop(oft_p, parent, "#address-cells", &addr_c,
-                        sizeof(addr_c));
-    DBG("%s address is %d\n", __func__, addr_c);
-
-    if ( 1 != size_c ) {
-        PANIC("Unsupported size for reg property\n");
-    }
-    
-    if ( 1 == addr_c) {
-        reg_addr = reg1(oft_p, c);
-    } else if ( 2 == addr_c ) {
-        reg_addr = reg2(oft_p, c);
-    } else {
-        PANIC("Unsupported address size for reg property\n");
-    }
-    DBG("%s: address 0x%lx\n", __func__, reg_addr);
-    return reg_addr;
-}
-
-/*
- * from OF_IEEE_1275
- *
- * pg 175, property "ranges"
- * 
- * The ranges property value is a sequence of child-phys parent-phys
- * size specifications. Child-phys is an address, encoded as with
- * encode-phys, in the child address space. Parent-phys is an address
- * (likewise encoded as with encode-phys) in the parent address
- * space. Size is a list of integers, each encoded as with encode-int,
- * denoting the length of the child's address range.
- */
-static unsigned long find_ranges_addr_from_node(void *oft_p, ofdn_t c)
-{
-    unsigned long ranges_addr = 0;
-    int ranges_i;
-    ofdn_t parent;
-    u32 addr_c = 2;
-    u32 ranges[64];
-    int p_len;
-    int i;
-
-    parent = ofd_node_parent(oft_p, c);
-    parent = ofd_node_parent(oft_p, parent);
-
-    p_len = ofd_getprop(oft_p, parent, "ranges", &ranges, sizeof(ranges));
-    DBG("%s: ranges\n", __func__);
-    for (i=0; i<p_len; i++)
-        DBG("%08x ", ranges[i]);
-    DBG("\n");
-
-    p_len = ofd_getprop(oft_p, parent, "#address-cells",
-                        &addr_c, sizeof(addr_c));
-    DBG("%s address is %d\n", __func__, addr_c);
-    ranges_i = addr_c;  /* skip over the child address */
-    
-    DBG("%s address is %d\n", __func__, addr_c);
-    switch (addr_c) {
-    case 1: 
-        ranges_addr = ranges[ranges_i];
-        break;
-    case 2:
-        ranges_addr = (((u64)ranges[ranges_i]) << 32) |
-            ranges[ranges_i + 1];
-        break;
-    case 3:  /* the G5 case, how to squeeze 96 bits into 64 */
-        ranges_addr = (((u64)ranges[ranges_i+1]) << 32) |
-            ranges[ranges_i + 2];
-        break;
-    case 4:
-        ranges_addr = (((u64)ranges[ranges_i+2]) << 32) |
-            ranges[ranges_i + 4];
-        break;
-    default:
-        PANIC("#address-cells out of range\n");
-        break;
-    }
-    
-    DBG("%s: address 0x%lx\n", __func__, ranges_addr);
-    return ranges_addr;
-}
-
-static unsigned long find_pic_address_from_node(void *oft_p, ofdn_t c)
-{
-    unsigned long reg_addr, range_addr, addr;
-
-    /*
-     * The address is the sum of the address in the reg property of this node
-     * and the ranges property of the granparent node.
-     */
-    reg_addr = find_reg_addr_from_node(oft_p, c);
-    range_addr = find_ranges_addr_from_node(oft_p, c);
-    addr = reg_addr + range_addr;
-    DBG("%s: address 0x%lx\n", __func__, addr);
-    return addr;
-}
-
-static unsigned int find_pic_flags_from_node(void *oft_p, ofdn_t c)
-{
-    int be_len;
-    unsigned int flags = 0;
-
-    /* does it have the property big endian? */
-    be_len = ofd_getprop(oft_p, c, "big_endian", NULL, 0);
-    if (be_len >= 0) {
-        DBG("%s: Big Endian found\n", __func__);
-        flags |= MPIC_BIG_ENDIAN;
-    }
-    DBG("%s: flags 0x%x\n", __func__, flags);
-    return flags;
-}
-
-static int find_mpic_simple_probe(void *oft_p)
-{
-    u32 addr_cells;
-    int rc;
-    u32 addr[2];
-
-    rc = ofd_getprop(oft_p, OFD_ROOT, "#address-cells",
-                     &addr_cells, sizeof(addr_cells));
-    if ( rc < 0 ) {
-        /* if the property does not exist use its default value, 2 */
-        addr_cells = 2;
-    }
-
-    rc = ofd_getprop(oft_p, OFD_ROOT, "platform-open-pic", addr, sizeof(addr));
-    if (rc < 0) {
-        return rc;
-    }
-
-    opic_addr = addr[0];
-    if (addr_cells == 2) {
-        opic_addr <<= 32;
-        opic_addr |= addr[1];
-    }
-    DBG("%s: found OpenPIC at: 0x%lx\n", __func__, opic_addr);
-    /* we did not really find the pic device, only its address. 
-     * We use big endian and broken u3 by default.
-     */
-    opic_flags |= MPIC_BIG_ENDIAN | MPIC_BROKEN_U3;
-    return 0;
-}
-
-static int find_mpic_canonical_probe(void *oft_p)
-{
-    ofdn_t c;
-    const char mpic_type[] = "open-pic";
-    /* some paths are special and we cannot find the address
-     * by the usual method */
-    const char *excluded_paths[] = { "/interrupt-controller" };
-
-    /*
-     * Search through the OFD tree for all devices of type 'open_pic'.
-     * We select the one without an 'interrupt' property.
-     */
-    c = ofd_node_find_by_prop(oft_p, OFD_ROOT, "device_type", mpic_type,
-                              sizeof(mpic_type));
-    while (c > 0) {
-        int int_len;
-        int good_mpic;
-        const char * path = ofd_node_path(oft_p, c);
-
-        good_mpic = 0;
-        int_len = ofd_getprop(oft_p, c, "interrupts", NULL, 0);
-        if (int_len < 0) {
-            int i;
-
-            /* there is no property interrupt.  This could be the pic */
-            DBG("%s: potential OpenPIC in: %s\n", __func__, path);
-            good_mpic = 1;
-
-            for (i = 0; i < ARRAY_SIZE(excluded_paths) && good_mpic; i++) {
-                const char *excluded_path = excluded_paths[i];
-                if (!strncmp(path, excluded_path, strlen(excluded_path)))
-                    good_mpic = 0;
-            }
-        }
-
-        if (good_mpic) {
-            DBG("%s: found OpenPIC in: %s\n", __func__, path);
-            opic_addr = find_pic_address_from_node(oft_p, c);
-            opic_flags = find_pic_flags_from_node(oft_p, c);
-            return 0;
-        }
-
-        c = ofd_node_find_next(oft_p, c);
-    }
-
-    DBG("%s: Could not find a pic\n", __func__);
-    return -1;
-}
-
-static int find_mpic(void)
-{
-    void *oft_p;
-    int rc;
-
-    opic_addr = (unsigned long)-1;
-    opic_flags = 0;
-
-    oft_p = (void *)oftree;
-    rc = find_mpic_simple_probe(oft_p);
-
-    if (rc < 0) {
-        DBG("%s: Searching for pic ...\n", __func__);
-        rc = find_mpic_canonical_probe(oft_p);
-    }
-
-    return rc;
-}
-
-static unsigned int mpic_startup_ipi(unsigned int irq)
-{
-    mpic->hc_ipi.enable(irq);
-    return 0;
-}
-
-int request_irq(unsigned int irq,
-                irqreturn_t (*handler)(int, void *, struct cpu_user_regs *),
-                unsigned long irqflags, const char * devname, void *dev_id)
-{
-    int retval;
-    struct irqaction *action;
-    void (*func)(int, void *, struct cpu_user_regs *);
-
-    action = xmalloc(struct irqaction);
-    if (!action) {
-        BUG();
-        return -ENOMEM;
-    }
-
-    /* Xen's handler prototype is slightly different than Linux's.  */
-    func = (void (*)(int, void *, struct cpu_user_regs *))handler;
-
-    action->handler = func;
-    action->name = devname;
-    action->dev_id = dev_id;
-
-    retval = setup_irq(irq, action);
-    if (retval) {
-        BUG();
-        xfree(action);
-    }
-
-    return retval;
-}
-
-static void dummy_ack(unsigned int irq)
-{
-}
-
-void xen_mpic_init(void)
-{
-    unsigned int isu_size;
-    unsigned int irq_offset;
-    unsigned int irq_count;
-    unsigned int ipi_offset;
-    unsigned char *senses;
-    unsigned int senses_count;
-
-    printk("%s: start\n", __func__);
-
-    io_apic_irqs = ~0;  /* all IRQs go through IOAPIC */
-       irq_vector[0] = FIRST_DEVICE_VECTOR;
-       vector_irq[FIRST_DEVICE_VECTOR] = 0;
-
-    isu_size = 0;
-    irq_offset = 0;
-    irq_count = 128;
-    ipi_offset = 128;
-    senses = NULL;
-    senses_count = 0;
-
-    if (find_mpic()) {
-        printk("%s: ERROR: Could not find open pic.\n", __func__);
-        return;
-    }
-
-    mpic = mpic_alloc(opic_addr,
-                      opic_flags | MPIC_PRIMARY | MPIC_WANTS_RESET,
-                      isu_size, irq_offset, irq_count,
-                      ipi_offset, senses, senses_count, "Xen-U3-MPIC");
-
-    BUG_ON(mpic == NULL);
-    mpic_init(mpic);
-
-    printk("%s: success\n", __func__);
-
-    mpic->hc_irq.ack = dummy_ack;
-    mpic->hc_ipi.ack = dummy_ack;
-    mpic->hc_ipi.startup = mpic_startup_ipi;
-    mpic_request_ipis();
-}
-
-/* Note: reading the vector implicitly ACKs it in hardware. */
-int xen_mpic_get_irq(struct cpu_user_regs *regs)
-{
-    BUG_ON(mpic == NULL);
-
-       return mpic_get_one_irq(mpic, regs);
-}
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/mpic_init.h
--- a/xen/arch/powerpc/mpic_init.h      Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * 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 (C) IBM Corp. 2005
- *
- * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- */
-
-#ifndef _MPIC_INIT_H
-#define _MPIC_INIT_H
-
-extern void xen_mpic_init(void);
-extern int xen_mpic_get_irq(struct cpu_user_regs *regs);
-
-#endif  /* #ifndef _MPIC_INIT_H */
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/multiboot2.c
--- a/xen/arch/powerpc/multiboot2.c     Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * 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@xxxxxxxxxx>
- */
-
-#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 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/numa.c
--- a/xen/arch/powerpc/numa.c   Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-#include "../x86/numa.c"
diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/of-devtree.c
--- a/xen/arch/powerpc/of-devtree.c     Thu May 08 13:15:45 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,1087 +0,0 @@
-/*
- * 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 (C) IBM Corp. 2005
- *
- * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- */
-
-/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
- * This code is intended to be used but relocatable routines So PLEASE
- * do not place any global data here including const integrals or
- * literals.
- * The local assert() is ok for string literal usage.. but thats it.
- */
-
-
-#include <xen/config.h>
-#include <xen/init.h>
-#include <xen/lib.h>
-#include "of-devtree.h"
-
-static int (*ofd_write)(const char *, size_t len) = NULL;
-
-void ofd_init(int (*write)(const char *, size_t len))
-{
-    ofd_write = write;
-}
-                  
-
-static void ofd_stop(void)
-{
-    for ( ; ; ) ;
-}

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.