aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-05-08 13:40:40 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-05-08 13:40:40 +0100
commit1aa3c54a31a5aec90f3705a37258988a69279308 (patch)
treea7aa90331785f89e6938e0348ec05d7e32d83bba
parent1b1305666b610a4808b06d8635451ea74996ceed (diff)
downloadxen-1aa3c54a31a5aec90f3705a37258988a69279308.tar.gz
xen-1aa3c54a31a5aec90f3705a37258988a69279308.tar.bz2
xen-1aa3c54a31a5aec90f3705a37258988a69279308.zip
Remove defunct powerpc port.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
-rw-r--r--Config.mk3
-rw-r--r--config/powerpc64.mk6
-rw-r--r--tools/libxc/Makefile2
-rw-r--r--tools/libxc/powerpc64/Makefile4
-rw-r--r--tools/libxc/powerpc64/flatdevtree.c662
-rw-r--r--tools/libxc/powerpc64/flatdevtree.h108
-rw-r--r--tools/libxc/powerpc64/flatdevtree_env.h94
-rw-r--r--tools/libxc/powerpc64/mk_flatdevtree.c648
-rw-r--r--tools/libxc/powerpc64/mk_flatdevtree.h37
-rw-r--r--tools/libxc/powerpc64/xc_memory.c42
-rw-r--r--tools/libxc/xc_core.h2
-rw-r--r--tools/libxc/xc_core_powerpc.c79
-rw-r--r--tools/libxc/xc_core_powerpc.h58
-rw-r--r--tools/libxc/xc_dom_elfloader.c2
-rw-r--r--tools/libxc/xc_dom_powerpc.c236
-rw-r--r--tools/libxc/xenctrl.h9
-rw-r--r--tools/libxc/xenguest.h14
-rw-r--r--tools/python/xen/lowlevel/xc/xc.c32
-rw-r--r--tools/python/xen/xend/arch.py2
-rw-r--r--tools/python/xen/xend/image.py17
-rw-r--r--tools/xm-test/lib/XmTestLib/arch.py40
-rw-r--r--tools/xm-test/lib/XmTestReport/arch.py6
-rw-r--r--tools/xm-test/ramdisk/Makefile.am2
-rw-r--r--tools/xm-test/ramdisk/configs/buildroot-powerpc338
-rw-r--r--tools/xm-test/ramdisk/make-release.sh3
-rwxr-xr-xtools/xm-test/runtest.sh2
-rw-r--r--xen/Rules.mk3
-rw-r--r--xen/arch/powerpc/0opt.c34
-rw-r--r--xen/arch/powerpc/Makefile152
-rw-r--r--xen/arch/powerpc/Rules.mk52
-rw-r--r--xen/arch/powerpc/audit.c47
-rw-r--r--xen/arch/powerpc/backtrace.c217
-rw-r--r--xen/arch/powerpc/bitops.c94
-rw-r--r--xen/arch/powerpc/boot_of.c1257
-rw-r--r--xen/arch/powerpc/cmdline.c24
-rw-r--r--xen/arch/powerpc/crash.c20
-rw-r--r--xen/arch/powerpc/dart.c297
-rw-r--r--xen/arch/powerpc/dart.h36
-rw-r--r--xen/arch/powerpc/dart_u3.c108
-rw-r--r--xen/arch/powerpc/dart_u4.c184
-rw-r--r--xen/arch/powerpc/domain.c357
-rw-r--r--xen/arch/powerpc/domain_build.c297
-rw-r--r--xen/arch/powerpc/domctl.c120
-rw-r--r--xen/arch/powerpc/exceptions.c91
-rw-r--r--xen/arch/powerpc/exceptions.h54
-rw-r--r--xen/arch/powerpc/external.c202
-rw-r--r--xen/arch/powerpc/float.S243
-rw-r--r--xen/arch/powerpc/gdbstub.c216
-rw-r--r--xen/arch/powerpc/hcalls.c171
-rw-r--r--xen/arch/powerpc/iommu.c95
-rw-r--r--xen/arch/powerpc/iommu.h28
-rw-r--r--xen/arch/powerpc/irq.c22
-rw-r--r--xen/arch/powerpc/machine_kexec.c41
-rw-r--r--xen/arch/powerpc/memory.c224
-rw-r--r--xen/arch/powerpc/mm.c617
-rw-r--r--xen/arch/powerpc/mpic.c1100
-rw-r--r--xen/arch/powerpc/mpic_init.c416
-rw-r--r--xen/arch/powerpc/mpic_init.h27
-rw-r--r--xen/arch/powerpc/multiboot2.c67
-rw-r--r--xen/arch/powerpc/numa.c1
-rw-r--r--xen/arch/powerpc/of-devtree.c1087
-rw-r--r--xen/arch/powerpc/of-devtree.h157
-rw-r--r--xen/arch/powerpc/of-devwalk.c133
-rw-r--r--xen/arch/powerpc/of_handler/Makefile32
-rw-r--r--xen/arch/powerpc/of_handler/console.c233
-rw-r--r--xen/arch/powerpc/of_handler/control.c90
-rw-r--r--xen/arch/powerpc/of_handler/cpu.c82
-rw-r--r--xen/arch/powerpc/of_handler/devtree.c268
-rw-r--r--xen/arch/powerpc/of_handler/head.S156
-rw-r--r--xen/arch/powerpc/of_handler/io.c160
-rw-r--r--xen/arch/powerpc/of_handler/leap.S38
-rw-r--r--xen/arch/powerpc/of_handler/memcmp.c39
-rw-r--r--xen/arch/powerpc/of_handler/memory.c129
-rw-r--r--xen/arch/powerpc/of_handler/memset.c67
-rw-r--r--xen/arch/powerpc/of_handler/ofh.c439
-rw-r--r--xen/arch/powerpc/of_handler/ofh.h164
-rw-r--r--xen/arch/powerpc/of_handler/papr.S97
-rw-r--r--xen/arch/powerpc/of_handler/papr.h69
-rw-r--r--xen/arch/powerpc/of_handler/rtas.c82
-rw-r--r--xen/arch/powerpc/of_handler/services.c96
-rw-r--r--xen/arch/powerpc/of_handler/snprintf.c332
-rw-r--r--xen/arch/powerpc/of_handler/strcmp.c36
-rw-r--r--xen/arch/powerpc/of_handler/strlcpy.c58
-rw-r--r--xen/arch/powerpc/of_handler/strlen.c30
-rw-r--r--xen/arch/powerpc/of_handler/strncmp.c39
-rw-r--r--xen/arch/powerpc/of_handler/strnlen.c30
-rw-r--r--xen/arch/powerpc/of_handler/vdevice.c74
-rw-r--r--xen/arch/powerpc/of_handler/xen_hvcall.S44
-rw-r--r--xen/arch/powerpc/of_handler/xencomm.c84
-rw-r--r--xen/arch/powerpc/ofd_fixup.c428
-rw-r--r--xen/arch/powerpc/ofd_fixup_memory.c128
-rw-r--r--xen/arch/powerpc/oftree.h38
-rw-r--r--xen/arch/powerpc/papr/Makefile11
-rw-r--r--xen/arch/powerpc/papr/debug.c84
-rw-r--r--xen/arch/powerpc/papr/h_perfmon.c158
-rw-r--r--xen/arch/powerpc/papr/tce.c84
-rw-r--r--xen/arch/powerpc/papr/vtce.c158
-rw-r--r--xen/arch/powerpc/papr/vterm.c70
-rw-r--r--xen/arch/powerpc/papr/xlate.c619
-rw-r--r--xen/arch/powerpc/physdev.c24
-rw-r--r--xen/arch/powerpc/platform.c43
-rw-r--r--xen/arch/powerpc/powerpc64/Makefile14
-rw-r--r--xen/arch/powerpc/powerpc64/asm-offsets.c67
-rw-r--r--xen/arch/powerpc/powerpc64/domain.c222
-rw-r--r--xen/arch/powerpc/powerpc64/exceptions.S644
-rw-r--r--xen/arch/powerpc/powerpc64/hypercall_table.S46
-rw-r--r--xen/arch/powerpc/powerpc64/io.S193
-rw-r--r--xen/arch/powerpc/powerpc64/memcpy.S171
-rw-r--r--xen/arch/powerpc/powerpc64/ppc970.c302
-rw-r--r--xen/arch/powerpc/powerpc64/ppc970_machinecheck.c125
-rw-r--r--xen/arch/powerpc/powerpc64/ppc970_scom.c184
-rw-r--r--xen/arch/powerpc/powerpc64/prom_call.S116
-rw-r--r--xen/arch/powerpc/powerpc64/scom.h39
-rw-r--r--xen/arch/powerpc/powerpc64/string.S286
-rw-r--r--xen/arch/powerpc/powerpc64/traps.c58
-rw-r--r--xen/arch/powerpc/ppc32/prom_call.c41
-rw-r--r--xen/arch/powerpc/rtas.c201
-rw-r--r--xen/arch/powerpc/rtas.h65
-rw-r--r--xen/arch/powerpc/rtas_flash.c182
-rw-r--r--xen/arch/powerpc/rtas_nvram.c129
-rw-r--r--xen/arch/powerpc/setup.c509
-rw-r--r--xen/arch/powerpc/shadow.c155
-rw-r--r--xen/arch/powerpc/smp-tbsync.c193
-rw-r--r--xen/arch/powerpc/smp.c214
-rw-r--r--xen/arch/powerpc/smpboot.c29
-rw-r--r--xen/arch/powerpc/start.S62
-rw-r--r--xen/arch/powerpc/sysctl.c65
-rw-r--r--xen/arch/powerpc/systemsim.S64
-rw-r--r--xen/arch/powerpc/tce.h71
-rw-r--r--xen/arch/powerpc/time.c90
-rw-r--r--xen/arch/powerpc/usercopy.c50
-rw-r--r--xen/arch/powerpc/xen.lds.S250
-rw-r--r--xen/include/asm-powerpc/acpi.h2
-rw-r--r--xen/include/asm-powerpc/asm_defns.h28
-rw-r--r--xen/include/asm-powerpc/atomic.h211
-rw-r--r--xen/include/asm-powerpc/bitops.h309
-rw-r--r--xen/include/asm-powerpc/boot.h46
-rw-r--r--xen/include/asm-powerpc/bug.h7
-rw-r--r--xen/include/asm-powerpc/byteorder.h80
-rw-r--r--xen/include/asm-powerpc/cache.h74
-rw-r--r--xen/include/asm-powerpc/config.h85
-rw-r--r--xen/include/asm-powerpc/current.h79
-rw-r--r--xen/include/asm-powerpc/debugger.h97
-rw-r--r--xen/include/asm-powerpc/delay.h40
-rw-r--r--xen/include/asm-powerpc/desc.h25
-rw-r--r--xen/include/asm-powerpc/div64.h33
-rw-r--r--xen/include/asm-powerpc/domain.h123
-rw-r--r--xen/include/asm-powerpc/elf.h30
-rw-r--r--xen/include/asm-powerpc/event.h99
-rw-r--r--xen/include/asm-powerpc/flushtlb.h105
-rw-r--r--xen/include/asm-powerpc/grant_table.h92
-rw-r--r--xen/include/asm-powerpc/guest_access.h26
-rw-r--r--xen/include/asm-powerpc/hardirq.h21
-rw-r--r--xen/include/asm-powerpc/hcalls.h34
-rw-r--r--xen/include/asm-powerpc/htab.h136
-rw-r--r--xen/include/asm-powerpc/hypercall.h26
-rw-r--r--xen/include/asm-powerpc/init.h40
-rw-r--r--xen/include/asm-powerpc/io.h69
-rw-r--r--xen/include/asm-powerpc/iocap.h26
-rw-r--r--xen/include/asm-powerpc/irq.h31
-rw-r--r--xen/include/asm-powerpc/mach-default/irq_vectors.h89
-rw-r--r--xen/include/asm-powerpc/memory.h39
-rw-r--r--xen/include/asm-powerpc/mm.h286
-rw-r--r--xen/include/asm-powerpc/mpic.h294
-rw-r--r--xen/include/asm-powerpc/msr.h66
-rw-r--r--xen/include/asm-powerpc/multicall.h27
-rw-r--r--xen/include/asm-powerpc/nmi.h9
-rw-r--r--xen/include/asm-powerpc/numa.h28
-rw-r--r--xen/include/asm-powerpc/page.h134
-rw-r--r--xen/include/asm-powerpc/papr.h219
-rw-r--r--xen/include/asm-powerpc/pci.h35
-rw-r--r--xen/include/asm-powerpc/percpu.h36
-rw-r--r--xen/include/asm-powerpc/perfc.h16
-rw-r--r--xen/include/asm-powerpc/platform.h28
-rw-r--r--xen/include/asm-powerpc/powerpc64/config.h39
-rw-r--r--xen/include/asm-powerpc/powerpc64/ppc970-hid.h144
-rw-r--r--xen/include/asm-powerpc/powerpc64/ppc970.h31
-rw-r--r--xen/include/asm-powerpc/powerpc64/procarea.h38
-rw-r--r--xen/include/asm-powerpc/powerpc64/processor.h228
-rw-r--r--xen/include/asm-powerpc/powerpc64/string.h42
-rw-r--r--xen/include/asm-powerpc/processor.h429
-rw-r--r--xen/include/asm-powerpc/reg_defs.h210
-rw-r--r--xen/include/asm-powerpc/regs.h25
-rw-r--r--xen/include/asm-powerpc/shadow.h52
-rw-r--r--xen/include/asm-powerpc/shared.h4
-rw-r--r--xen/include/asm-powerpc/smp.h60
-rw-r--r--xen/include/asm-powerpc/softirq.h6
-rw-r--r--xen/include/asm-powerpc/spinlock.h218
-rw-r--r--xen/include/asm-powerpc/string.h26
-rw-r--r--xen/include/asm-powerpc/system.h247
-rw-r--r--xen/include/asm-powerpc/time.h86
-rw-r--r--xen/include/asm-powerpc/trace.h4
-rw-r--r--xen/include/asm-powerpc/types.h79
-rw-r--r--xen/include/asm-powerpc/xenoprof.h100
-rw-r--r--xen/include/asm-x86/desc.h2
-rw-r--r--xen/include/public/arch-powerpc.h120
-rw-r--r--xen/include/public/io/protocols.h3
-rw-r--r--xen/include/public/libelf.h4
-rw-r--r--xen/include/public/xen.h2
199 files changed, 6 insertions, 25862 deletions
diff --git a/Config.mk b/Config.mk
index 077bfa4d5c..4481a40f56 100644
--- a/Config.mk
+++ b/Config.mk
@@ -4,8 +4,7 @@
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 --git a/config/powerpc64.mk b/config/powerpc64.mk
deleted file mode 100644
index a49efd876b..0000000000
--- a/config/powerpc64.mk
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG_POWERPC := y
-CONFIG_POWERPC_$(XEN_OS) := y
-
-CONFIG_XENCOMM := y
-
-CFLAGS += -DELFSIZE=64
diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile
index a84fec85b8..3fd926ad47 100644
--- a/tools/libxc/Makefile
+++ b/tools/libxc/Makefile
@@ -9,7 +9,6 @@ ifneq ($(stubdom),y)
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-y += xc_dom_compat_linux.c
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 --git a/tools/libxc/powerpc64/Makefile b/tools/libxc/powerpc64/Makefile
deleted file mode 100644
index 68c7c1e880..0000000000
--- a/tools/libxc/powerpc64/Makefile
+++ /dev/null
@@ -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 --git a/tools/libxc/powerpc64/flatdevtree.c b/tools/libxc/powerpc64/flatdevtree.c
deleted file mode 100644
index 275e0884a6..0000000000
--- a/tools/libxc/powerpc64/flatdevtree.c
+++ /dev/null
@@ -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@embeddedalley.com>
- * Hollis Blanchard <hollisb@us.ibm.com>
- * Mark A. Greer <mgreer@mvista.com>
- */
-
-#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 --git a/tools/libxc/powerpc64/flatdevtree.h b/tools/libxc/powerpc64/flatdevtree.h
deleted file mode 100644
index 2167cae91c..0000000000
--- a/tools/libxc/powerpc64/flatdevtree.h
+++ /dev/null
@@ -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 --git a/tools/libxc/powerpc64/flatdevtree_env.h b/tools/libxc/powerpc64/flatdevtree_env.h
deleted file mode 100644
index c52ea65aa5..0000000000
--- a/tools/libxc/powerpc64/flatdevtree_env.h
+++ /dev/null
@@ -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 --git a/tools/libxc/powerpc64/mk_flatdevtree.c b/tools/libxc/powerpc64/mk_flatdevtree.c
deleted file mode 100644
index 6931e5b33e..0000000000
--- a/tools/libxc/powerpc64/mk_flatdevtree.c
+++ /dev/null
@@ -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@us.ibm.com>
- */
-
-#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 --git a/tools/libxc/powerpc64/mk_flatdevtree.h b/tools/libxc/powerpc64/mk_flatdevtree.h
deleted file mode 100644
index 7d7a66c9ae..0000000000
--- a/tools/libxc/powerpc64/mk_flatdevtree.h
+++ /dev/null
@@ -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@us.ibm.com>
- */
-
-#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 --git a/tools/libxc/powerpc64/xc_memory.c b/tools/libxc/powerpc64/xc_memory.c
deleted file mode 100644
index a275e92df8..0000000000
--- a/tools/libxc/powerpc64/xc_memory.c
+++ /dev/null
@@ -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@us.ibm.com>
- */
-
-#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 --git a/tools/libxc/xc_core.h b/tools/libxc/xc_core.h
index c15729e5af..c5663e9426 100644
--- a/tools/libxc/xc_core.h
+++ b/tools/libxc/xc_core.h
@@ -148,8 +148,6 @@ int xc_core_arch_map_p2m(int xc_handle, xc_dominfo_t *info,
# 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 --git a/tools/libxc/xc_core_powerpc.c b/tools/libxc/xc_core_powerpc.c
deleted file mode 100644
index dd8f26b371..0000000000
--- a/tools/libxc/xc_core_powerpc.c
+++ /dev/null
@@ -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@us.ibm.com>
- *
- */
-
-#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 --git a/tools/libxc/xc_core_powerpc.h b/tools/libxc/xc_core_powerpc.h
deleted file mode 100644
index 2f39413c4d..0000000000
--- a/tools/libxc/xc_core_powerpc.h
+++ /dev/null
@@ -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 --git a/tools/libxc/xc_dom_elfloader.c b/tools/libxc/xc_dom_elfloader.c
index ec9af72548..f9bbd85ba3 100644
--- a/tools/libxc/xc_dom_elfloader.c
+++ b/tools/libxc/xc_dom_elfloader.c
@@ -43,8 +43,6 @@ static char *xc_dom_guest_type(struct xc_dom_image *dom,
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 --git a/tools/libxc/xc_dom_powerpc.c b/tools/libxc/xc_dom_powerpc.c
deleted file mode 100644
index 2e843b6d54..0000000000
--- a/tools/libxc/xc_dom_powerpc.c
+++ /dev/null
@@ -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@suse.de>.
- *
- * Copyright IBM Corp. 2007
- *
- * Authors: Gerd Hoffmann <kraxel@suse.de>
- * Hollis Blanchard <hollisb@us.ibm.com>
- *
- */
-#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 --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h
index 380f024da9..e514b003e1 100644
--- a/tools/libxc/xenctrl.h
+++ b/tools/libxc/xenctrl.h
@@ -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 @@ xc_error_handler xc_set_error_handler(xc_error_handler handler);
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 --git a/tools/libxc/xenguest.h b/tools/libxc/xenguest.h
index be30cfe299..8ab1149cb5 100644
--- a/tools/libxc/xenguest.h
+++ b/tools/libxc/xenguest.h
@@ -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 --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 136634a59b..cd86022945 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -1350,28 +1350,6 @@ static PyObject *dom_op(XcObject *self, PyObject *args,
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 --git a/tools/python/xen/xend/arch.py b/tools/python/xen/xend/arch.py
index 4ea19e899c..6d789d9f7e 100644
--- a/tools/python/xen/xend/arch.py
+++ b/tools/python/xen/xend/arch.py
@@ -28,7 +28,5 @@ _types = {
"amd64": "x86",
"i86pc": "x86",
"ia64": "ia64",
- "ppc": "powerpc",
- "ppc64": "powerpc",
}
type = _types.get(os.uname()[4], "unknown")
diff --git a/tools/python/xen/xend/image.py b/tools/python/xen/xend/image.py
index 46517c7ac3..72cdc042ba 100644
--- a/tools/python/xen/xend/image.py
+++ b/tools/python/xen/xend/image.py
@@ -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(LinuxImageHandler):
return LinuxImageHandler.buildDomain(self)
_handlers = {
- "powerpc": {
- "linux": PPC_LinuxImageHandler,
- },
"ia64": {
"linux": IA64_Linux_ImageHandler,
"hvm": IA64_HVM_ImageHandler,
diff --git a/tools/xm-test/lib/XmTestLib/arch.py b/tools/xm-test/lib/XmTestLib/arch.py
index 654afecb3b..32a5958096 100644
--- a/tools/xm-test/lib/XmTestLib/arch.py
+++ b/tools/xm-test/lib/XmTestLib/arch.py
@@ -88,39 +88,6 @@ ia_HVMDefaults = {"memory" : 64,
}
# 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" or _arch == "ia64":
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 --git a/tools/xm-test/lib/XmTestReport/arch.py b/tools/xm-test/lib/XmTestReport/arch.py
index 965e7fb9c6..920526d137 100644
--- a/tools/xm-test/lib/XmTestReport/arch.py
+++ b/tools/xm-test/lib/XmTestReport/arch.py
@@ -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 == "x86_64":
elif _arch == "ia64":
cpuValues = {"arch" : "Unknown",
"features" : "Unknown"}
-elif _arch == "powerpc":
- cpuValues = {"cpu" : "Unknown",
- "platform" : "Unknown",
- "revision" : "Unknown"}
else:
raise ValueError, "Unknown architecture!"
diff --git a/tools/xm-test/ramdisk/Makefile.am b/tools/xm-test/ramdisk/Makefile.am
index 944a07146e..4a4c7e65cf 100644
--- a/tools/xm-test/ramdisk/Makefile.am
+++ b/tools/xm-test/ramdisk/Makefile.am
@@ -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 --git a/tools/xm-test/ramdisk/configs/buildroot-powerpc b/tools/xm-test/ramdisk/configs/buildroot-powerpc
deleted file mode 100644
index f0a64ffd5c..0000000000
--- a/tools/xm-test/ramdisk/configs/buildroot-powerpc
+++ /dev/null
@@ -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 --git a/tools/xm-test/ramdisk/make-release.sh b/tools/xm-test/ramdisk/make-release.sh
index 5aa3831181..a200822dc0 100644
--- a/tools/xm-test/ramdisk/make-release.sh
+++ b/tools/xm-test/ramdisk/make-release.sh
@@ -3,9 +3,6 @@
if [ "$1" == "" ]
then
arch=""
-elif [ "$1" == "powerpc" ]
-then
- arch="BR_ARCH=powerpc"
else
echo "Invalid architecture specified." >&2
exit 1
diff --git a/tools/xm-test/runtest.sh b/tools/xm-test/runtest.sh
index 5b102b7f45..287d6cf701 100755
--- a/tools/xm-test/runtest.sh
+++ b/tools/xm-test/runtest.sh
@@ -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 --git a/xen/Rules.mk b/xen/Rules.mk
index 21125e6f7c..36292c92e5 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -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 --git a/xen/arch/powerpc/0opt.c b/xen/arch/powerpc/0opt.c
deleted file mode 100644
index e029ed11eb..0000000000
--- a/xen/arch/powerpc/0opt.c
+++ /dev/null
@@ -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@watson.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/Makefile b/xen/arch/powerpc/Makefile
deleted file mode 100644
index 2010b47723..0000000000
--- a/xen/arch/powerpc/Makefile
+++ /dev/null
@@ -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 --git a/xen/arch/powerpc/Rules.mk b/xen/arch/powerpc/Rules.mk
deleted file mode 100644
index 330f55460e..0000000000
--- a/xen/arch/powerpc/Rules.mk
+++ /dev/null
@@ -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 --git a/xen/arch/powerpc/audit.c b/xen/arch/powerpc/audit.c
deleted file mode 100644
index e39bbf26ab..0000000000
--- a/xen/arch/powerpc/audit.c
+++ /dev/null
@@ -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@us.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/backtrace.c b/xen/arch/powerpc/backtrace.c
deleted file mode 100644
index 7cf8032af7..0000000000
--- a/xen/arch/powerpc/backtrace.c
+++ /dev/null
@@ -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 --git a/xen/arch/powerpc/bitops.c b/xen/arch/powerpc/bitops.c
deleted file mode 100644
index 02a53384b1..0000000000
--- a/xen/arch/powerpc/bitops.c
+++ /dev/null
@@ -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 --git a/xen/arch/powerpc/boot_of.c b/xen/arch/powerpc/boot_of.c
deleted file mode 100644
index 2f968f3f8b..0000000000
--- a/xen/arch/powerpc/boot_of.c
+++ /dev/null
@@ -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@watson.ibm.com>
- * Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/cmdline.c b/xen/arch/powerpc/cmdline.c
deleted file mode 100644
index e7c1bdf74b..0000000000
--- a/xen/arch/powerpc/cmdline.c
+++ /dev/null
@@ -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@us.ibm.com>
- */
-
-#include <asm/config.h>
-
-char builtin_cmdline[CONFIG_CMDLINE_SIZE]
- __attribute__((section("__builtin_cmdline"))) = CMDLINE;
diff --git a/xen/arch/powerpc/crash.c b/xen/arch/powerpc/crash.c
deleted file mode 100644
index 0ba8c5cac6..0000000000
--- a/xen/arch/powerpc/crash.c
+++ /dev/null
@@ -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 --git a/xen/arch/powerpc/dart.c b/xen/arch/powerpc/dart.c
deleted file mode 100644
index cdb256a1ad..0000000000
--- a/xen/arch/powerpc/dart.c
+++ /dev/null
@@ -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@watson.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/dart.h b/xen/arch/powerpc/dart.h
deleted file mode 100644
index a023dabbfb..0000000000
--- a/xen/arch/powerpc/dart.h
+++ /dev/null
@@ -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@watson.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/dart_u3.c b/xen/arch/powerpc/dart_u3.c
deleted file mode 100644
index 3058b57639..0000000000
--- a/xen/arch/powerpc/dart_u3.c
+++ /dev/null
@@ -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@watson.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/dart_u4.c b/xen/arch/powerpc/dart_u4.c
deleted file mode 100644
index 131adc983f..0000000000
--- a/xen/arch/powerpc/dart_u4.c
+++ /dev/null
@@ -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@watson.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/domain.c b/xen/arch/powerpc/domain.c
deleted file mode 100644
index 3be2fdbe84..0000000000
--- a/xen/arch/powerpc/domain.c
+++ /dev/null
@@ -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@watson.ibm.com>
- * Ryan Harper <ryanh@us.ibm.com>
- * Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/domain_build.c b/xen/arch/powerpc/domain_build.c
deleted file mode 100644
index af25abc27e..0000000000
--- a/xen/arch/powerpc/domain_build.c
+++ /dev/null
@@ -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@watson.ibm.com>
- * Ryan Harper <ryanh@us.ibm.com>
- * Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/domctl.c b/xen/arch/powerpc/domctl.c
deleted file mode 100644
index 5177bf6b03..0000000000
--- a/xen/arch/powerpc/domctl.c
+++ /dev/null
@@ -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@watson.ibm.com>
- * Ryan Harper <ryanh@us.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/exceptions.c b/xen/arch/powerpc/exceptions.c
deleted file mode 100644
index cce09c7a54..0000000000
--- a/xen/arch/powerpc/exceptions.c
+++ /dev/null
@@ -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@us.ibm.com>
- * Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/exceptions.h b/xen/arch/powerpc/exceptions.h
deleted file mode 100644
index 4c2865f676..0000000000
--- a/xen/arch/powerpc/exceptions.h
+++ /dev/null
@@ -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@us.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/external.c b/xen/arch/powerpc/external.c
deleted file mode 100644
index 79122eafbc..0000000000
--- a/xen/arch/powerpc/external.c
+++ /dev/null
@@ -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@watson.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/float.S b/xen/arch/powerpc/float.S
deleted file mode 100644
index 21c70ff472..0000000000
--- a/xen/arch/powerpc/float.S
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (C) 2005 Jimi Xenidis <jimix@watson.ibm.com>, 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 --git a/xen/arch/powerpc/gdbstub.c b/xen/arch/powerpc/gdbstub.c
deleted file mode 100644
index d512a9cbcd..0000000000
--- a/xen/arch/powerpc/gdbstub.c
+++ /dev/null
@@ -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@us.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/hcalls.c b/xen/arch/powerpc/hcalls.c
deleted file mode 100644
index fbada6b3d8..0000000000
--- a/xen/arch/powerpc/hcalls.c
+++ /dev/null
@@ -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@us.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/iommu.c b/xen/arch/powerpc/iommu.c
deleted file mode 100644
index 37417d3565..0000000000
--- a/xen/arch/powerpc/iommu.c
+++ /dev/null
@@ -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@watson.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/iommu.h b/xen/arch/powerpc/iommu.h
deleted file mode 100644
index 727441bb07..0000000000
--- a/xen/arch/powerpc/iommu.h
+++ /dev/null
@@ -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@watson.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/irq.c b/xen/arch/powerpc/irq.c
deleted file mode 100644
index 8ebd6f5b71..0000000000
--- a/xen/arch/powerpc/irq.c
+++ /dev/null
@@ -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@watson.ibm.com>
- */
-
-#include "exceptions.h"
-#include "../x86/irq.c"
diff --git a/xen/arch/powerpc/machine_kexec.c b/xen/arch/powerpc/machine_kexec.c
deleted file mode 100644
index f16af71085..0000000000
--- a/xen/arch/powerpc/machine_kexec.c
+++ /dev/null
@@ -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 --git a/xen/arch/powerpc/memory.c b/xen/arch/powerpc/memory.c
deleted file mode 100644
index 5dfc27bd79..0000000000
--- a/xen/arch/powerpc/memory.c
+++ /dev/null
@@ -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@us.ibm.com>
- * Jimi Xenidis <jimix@watson.ibm.com>
- */
-#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 --git a/xen/arch/powerpc/mm.c b/xen/arch/powerpc/mm.c
deleted file mode 100644
index 60c878f76a..0000000000
--- a/xen/arch/powerpc/mm.c
+++ /dev/null
@@ -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@us.ibm.com>
- * Jimi Xenidis <jimix@watson.ibm.com>
- * Ryan Harper <ryanh@us.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/mpic.c b/xen/arch/powerpc/mpic.c
deleted file mode 100644
index 0a89945505..0000000000
--- a/xen/arch/powerpc/mpic.c
+++ /dev/null
@@ -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 --git a/xen/arch/powerpc/mpic_init.c b/xen/arch/powerpc/mpic_init.c
deleted file mode 100644
index f4e4074ae1..0000000000
--- a/xen/arch/powerpc/mpic_init.c
+++ /dev/null
@@ -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@watson.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/mpic_init.h b/xen/arch/powerpc/mpic_init.h
deleted file mode 100644
index e058b0e2fe..0000000000
--- a/xen/arch/powerpc/mpic_init.h
+++ /dev/null
@@ -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@watson.ibm.com>
- */
-
-#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 --git a/xen/arch/powerpc/multiboot2.c b/xen/arch/powerpc/multiboot2.c
deleted file mode 100644
index fb16738ba0..0000000000
--- a/xen/arch/powerpc/multiboot2.c
+++ /dev/null
@@ -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@us.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/lib.h>
-#include <xen/multiboot2.h>
-#include <asm/boot.h>
-#include <asm/init.h>
-
-static struct mb2_tag_module *mb2_tag_mod_find(struct mb2_tag_header *tags,
- const char *type)
-{
- struct mb2_tag_header *tag;
-
- for_each_tag(tag, tags) {
- if (tag->key == MB2_TAG_MODULE) {
- struct mb2_tag_module *mod = (struct mb2_tag_module *)tag;
- if (!strcmp((char *)mod->type, type))
- return mod;
- }
- }
- return NULL;
-}
-
-void parse_multiboot(ulong tags_addr)
-{
- struct mb2_tag_header *tags = (struct mb2_tag_header *)tags_addr;
- struct mb2_tag_module *mod;
-
- if (tags->key != MB2_TAG_START)
- return;
-
- mod = mb2_tag_mod_find(tags, "kernel");
- if (mod) {
- xen_cmdline = (char *)mod->cmdline;
- }
-
- mod = mb2_tag_mod_find(tags, "dom0");
- if (mod) {
- dom0_addr = mod->addr;
- dom0_len = mod->size;
- dom0_cmdline = (char *)mod->cmdline;
- }
-
- mod = mb2_tag_mod_find(tags, "initrd");
- if (mod) {
- initrd_start = mod->addr;
- initrd_len = mod->size;
- }
-}
diff --git a/xen/arch/powerpc/numa.c b/xen/arch/powerpc/numa.c
deleted file mode 100644
index 623b0c1536..0000000000
--- a/xen/arch/powerpc/numa.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "../x86/numa.c"
diff --git a/xen/arch/powerpc/of-devtree.c b/xen/arch/powerpc/of-devtree.c
deleted file mode 100644
index ff5efdff16..0000000000
--- a/xen/arch/powerpc/of-devtree.c
+++ /dev/null
@@ -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@watson.ibm.com>
- */
-
-/* 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 ( ; ; ) ;
-}
-
-/* this is so it can be called from anywhere */
-static void ofd_assprint(int line)
-{
- char a[13];
- char num[20];
- int i;
-
- a[0] = '\n';
- a[1] = '\n';
- a[2] = 'O';
- a[3] = 'F';
- a[4] = 'D';
- a[5] = ':';
- a[6] = 'A';
- a[7] = 'S';
- a[8] = 'S';
- a[9] = 'E';
- a[10] = 'R';
- a[11] = 'T';
- a[12] = ':';
-
-
- ofd_write(a, sizeof (a) - 1);
-
- /* put the number in backwards */
- i = 0;
- while ( line > 0 ) {
- num[i++] = '0' + (line % 10);
- line /= 10;
- }
- /* print it */
- /* number */
- while (i-- > 0) {
- ofd_write(&num[i], 1);
- }
- ofd_write("\n", 1);
-
- ofd_stop();
-}
-
-#ifdef assert
-#undef assert
-#endif
-
-#define assert(EX) \
- do { \
- if ( !(EX) ) { \
- ofd_assprint(__LINE__); \
- } \
- } while (0)
-
-/*
- * We treat memory like an array of u64. For the sake of
- * compactness we assume that a short is big enough as an index.
- */
-struct ofd_node {
- ofdn_t on_ima;
- ofdn_t on_parent;
- ofdn_t on_child;
- ofdn_t on_peer;
- ofdn_t on_io;
- ofdn_t on_next; /* for search lists */
- ofdn_t on_prev;
- ofdn_t on_prop;
- u32 on_pathlen;
- u32 on_last;
- char on_path[0];
-};
-
-struct ofd_prop {
- ofdn_t op_ima;
- ofdn_t op_next;
- u32 op_objsz;
- u32 op_namesz;
- /* must have 64bit alignment */
- char op_data[0] __attribute__ ((aligned(8)));
-};
-
-struct ofd_io {
- ofdn_t oi_ima;
- ofdn_t oi_node;
- u64 oi_open __attribute__ ((aligned(8)));
-};
-
-struct ofd_free {
- ofdn_t of_cells;
- ofdn_t of_next;
-};
-
-struct ofd_mem {
- ofdn_t om_num;
- ofdn_t om_next;
- ofdn_t om_free; /* Future site of a free list */
- ofdn_t _om_pad;
- u64 om_mem[0] __attribute__((aligned(8)));
-};
-
-#define NODE_PAT 0x0f01
-#define PROP_PAT 0x0f03
-#define IO_PAT 0x0f05
-
-
-size_t ofd_size(void *mem)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- size_t sz;
-
- sz = m->om_next * sizeof (u64) + sizeof(*m);
- return sz;
-}
-
-size_t ofd_space(void *mem)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- size_t sz;
-
- sz = m->om_num * sizeof (u64);
- return sz;
-}
-
-
-static int ofd_pathsplit_right(const char *s, int c, size_t max)
-{
- int i = 0;
-
- if ( max == 0 ) {
- --max;
- }
-
- while ( *s != '\0' && *s != c && max != 0 ) {
- ++i;
- ++s;
- --max;
- }
- return i;
-}
-
-static int ofd_pathsplit_left(const char *p, int c, size_t len)
-{
- const char *s;
-
- if ( len > 0 ) {
- /* move s to the end */
- s = p + len - 1;
-
- /* len could include a null */
- if ( *s == '\0' ) {
- --s;
- }
- while ( s >= p ) {
- if ( *s == c ) {
- ++s;
- break;
- }
- --s;
- }
- if ( s < p ) {
- return 0;
- }
- return (s - p);
- }
- return 0;
-}
-
-void *ofd_create(void *mem, size_t sz)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_node *n;
- size_t sum;
- ofdn_t cells;
-
- if ( sz < (sizeof (*n) * 4) ) {
- return NULL;
- }
-
- memset(mem, 0, sz);
-
- m->om_num = (sz - sizeof(*m)) / sizeof (u64);
-
- /* skip the first cell */
- m->om_next = OFD_ROOT;
- n = (struct ofd_node *)&m->om_mem[m->om_next];
- n->on_ima = NODE_PAT;
- n->on_pathlen = 2;
- n->on_last = 1;
- n->on_path[0] = '/';
- n->on_path[1] = '\0';
-
- sum = sizeof (*n) + 2; /* Don't forget the path */
- cells = (sum + sizeof (m->om_mem[0]) - 1) / sizeof (m->om_mem[0]);
- m->om_next += cells;
-
- return m;
-}
-
-static struct ofd_node *ofd_node_get(struct ofd_mem *m, ofdn_t n)
-{
- if ( n < m->om_next ) {
- struct ofd_node *r;
-
- r = (struct ofd_node *)&m->om_mem[n];
- if ( r->on_ima == NODE_PAT ) {
- return r;
- }
- }
- return NULL;
-}
-
-ofdn_t ofd_node_parent(void *mem, ofdn_t n)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_node *r = ofd_node_get(m, n);
-
- if ( r == NULL) return 0;
- return r->on_parent;
-}
-
-ofdn_t ofd_node_peer(void *mem, ofdn_t n)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_node *r;
-
- if ( n == 0 ) {
- return OFD_ROOT;
- }
-
- r = ofd_node_get(m, n);
- if ( r == NULL) return 0;
- return r->on_peer;
-}
-
-const char *ofd_node_path(void *mem, ofdn_t n)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_node *r = ofd_node_get(m, n);
-
- if ( r == NULL) return NULL;
- return r->on_path;
-}
-
-static ofdn_t ofd_node_prop(void *mem, ofdn_t n)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_node *r = ofd_node_get(m, n);
-
- if ( r == NULL) return 0;
- return r->on_prop;
-}
-
-ofdn_t ofd_node_child(void *mem, ofdn_t p)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_node *r = ofd_node_get(m, p);
-
- if ( r == NULL) return 0;
- return r->on_child;
-}
-
-int ofd_node_to_path(void *mem, ofdn_t p, void *buf, size_t sz)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_node *r = ofd_node_get(m, p);
-
- if ( sz > r->on_pathlen ) {
- sz = r->on_pathlen;
- }
-
- memcpy(buf, r->on_path, sz);
-
- if ( r == NULL) return -1;
- return r->on_pathlen;
-}
-
-static int ofd_check(void *p, size_t l)
-{
- int i;
- u64 *v = (u64 *)p;
-
- for ( i = 0; i < l; i++ ) {
- if ( v[i] != 0ULL ) {
- return 0;
- }
- }
- return 1;
-}
-
-
-
-static ofdn_t ofd_node_create(
- struct ofd_mem *m, const char *path, size_t pathlen)
-{
- struct ofd_node *n;
- ofdn_t pos;
- size_t sum = pathlen + 1 + sizeof (*n); /* add trailing zero to path */
- ofdn_t cells = (sum + sizeof(m->om_mem[0]) - 1) / sizeof(m->om_mem[0]);
-
- if ( m->om_next + cells >= m->om_num ) {
- return 0;
- }
-
- pos = m->om_next;
-
- assert(ofd_check(&m->om_mem[pos], cells)); /* non-zero */
- m->om_next += cells;
-
- n = (struct ofd_node *)&m->om_mem[pos];
- assert(n->on_ima == 0); /* new node not empty */
-
- n->on_ima = NODE_PAT;
- n->on_peer = 0;
- n->on_child = 0;
- n->on_io = 0;
- n->on_pathlen = pathlen;
- n->on_last = ofd_pathsplit_left(path, '/', pathlen);
- strlcpy(n->on_path, path, pathlen + 1);
-
- return pos;
-}
-
-/* prunes a node and all its children simply by wasting memory and
- * unlinking it from the tree */
-int ofd_node_prune(void *mem, ofdn_t node)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_node *n;
- struct ofd_node *p;
-
- n = ofd_node_get(m, node);
- if (n == NULL) return -1;
-
- p = ofd_node_get(m, n->on_parent);
- assert(p != NULL);
-
- if ( p->on_child == node ) {
- /* easy case */
- p->on_child = n->on_peer;
- } else {
- struct ofd_node *s;
-
- s = ofd_node_get(m, p->on_child);
- assert(s != NULL);
- while ( s->on_peer != node ) {
- s = ofd_node_get(m, s->on_peer);
- assert(s != NULL);
- }
- s->on_peer = n->on_peer;
- }
- return 1;
-}
-
-ofdn_t ofd_prune_path(void *m, const char *path)
-{
- ofdn_t n;
- int rc = -1;
- while ((n = ofd_node_find(m, path)) > 0) {
- rc = ofd_node_prune(m, n);
- }
-
- return rc;
-}
-
-ofdn_t ofd_node_child_create(
- void *mem, ofdn_t parent, const char *path, size_t pathlen)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_node *p;
- struct ofd_node *n;
- ofdn_t pos;
-
- p = ofd_node_get(m, parent);
- if (p == NULL) return 0;
-
- pos = ofd_node_create(m, path, pathlen);
- n = ofd_node_get(m, pos);
- assert(n != NULL);
-
- assert(p->on_child == 0); /* child exists */
- if ( p->on_child == 0 ) {
- p->on_child = pos;
- n->on_parent = parent;
- } else {
- pos = 0;
- }
-
- return pos;
-}
-
-ofdn_t ofd_node_peer_create(
- void *mem, ofdn_t sibling, const char *path, size_t pathlen)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_node *s;
- struct ofd_node *n;
- ofdn_t pos;
-
- s = ofd_node_get(m, sibling);
- if (s == NULL) return 0;
-
- pos = ofd_node_create(m, path, pathlen);
- n = ofd_node_get(m, pos);
- assert(n != NULL);
-
- if ( s->on_peer == 0 ) {
- s->on_peer = pos;
- n->on_parent = s->on_parent;
- } else {
- assert(0); /* peer exists */
- pos = 0;
- }
- return pos;
-}
-
-static ofdn_t ofd_node_peer_last(void *mem, ofdn_t c)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_node *n;
-
- n = ofd_node_get(m, c);
- if (n == NULL) return 0;
-
- while ( n->on_peer > 0 ) {
- c = n->on_peer;
- n = ofd_node_get(m, c);
- assert(n != NULL);
- }
-
- return c;
-}
-
-static ofdn_t ofd_node_walk(struct ofd_mem *m, ofdn_t p, const char *s)
-{
- struct ofd_node *np;
- ofdn_t n;
- ofdn_t r;
-
- if ( *s == '/' ) {
- ++s;
- if ( *s == '\0' ) {
- assert(0); /* ends in / */
- return 0;
- }
- }
-
- np = ofd_node_get(m, p);
- if (np == NULL) return 0;
-
- r = p;
- do {
- int last = np->on_last;
- size_t lsz = np->on_pathlen - last;
- size_t sz;
-
- sz = ofd_pathsplit_right(s, '/', 0);
-
- if ( lsz > 0 && strncmp(s, &np->on_path[last], sz) == 0 ) {
- if ( s[sz] == '\0' ) {
- return r;
- }
- /* there is more to the path */
- n = ofd_node_child(m, p);
- if ( n != 0 ) {
- r = ofd_node_walk(m, n, &s[sz]);
- return r;
- }
- /* there are no children */
- return 0;
- }
- } while ( 0 );
-
- /*
- * we know that usually we are only serching for top level peers
- * so we do peers first peer
- */
- n = ofd_node_peer(m, p);
- if ( n > 0 ) {
- r = ofd_node_walk(m, n, s);
- } else {
- r = 0;
- }
-
- return r;
-}
-
-
-ofdn_t ofd_node_find(void *mem, const char *devspec)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- ofdn_t n = OFD_ROOT;
- const char *s = devspec;
- size_t sz;
-
- if ( s == NULL || s[0] == '\0' ) {
- return OFD_ROOT;
- }
-
- if ( s[0] != '/' ) {
- size_t asz;
-
- /* get the component length */
- sz = ofd_pathsplit_right(s, '/', 0);
-
- /* check for an alias */
- asz = ofd_pathsplit_right(s, ':', sz);
-
- if ( s[asz] == ':' ) {
- /*
- * s points to an alias and &s[sz] points to the alias
- * args.
- */
- assert(0); /* aliases no supported */
- return 0;
- }
- } else if ( s[1] == '\0' ) {
- return n;
- }
-
- n = ofd_node_child(m, n);
- if ( n == 0 ) {
- return 0;
- }
-
- return ofd_node_walk(m, n, s);
-}
-
-
-static struct ofd_prop *ofd_prop_get(struct ofd_mem *m, ofdn_t p)
-{
- if ( p < m->om_next ) {
- struct ofd_prop *r;
-
- r = (struct ofd_prop *)&m->om_mem[p];
- if ( r->op_ima == PROP_PAT ) {
- return r;
- }
- assert(r->op_ima == PROP_PAT); /* bad object */
- }
- return NULL;
-}
-
-static ofdn_t ofd_prop_create(
- struct ofd_mem *m,
- ofdn_t node,
- const char *name,
- const void *src,
- size_t sz)
-{
- struct ofd_node *n;
- struct ofd_prop *p;
- size_t len = strlen(name) + 1;
- size_t sum = sizeof (*p) + sz + len;
- ofdn_t cells;
- char *dst;
- ofdn_t pos;
-
- cells = (sum + sizeof (m->om_mem[0]) - 1) / sizeof (m->om_mem[0]);
-
- if ( m->om_next + cells >= m->om_num ) {
- return 0;
- }
-
- /* actual data structure */
- pos = m->om_next;
- assert(ofd_check(&m->om_mem[pos], cells)); /* non-zero */
-
- p = (struct ofd_prop *)&m->om_mem[pos];
- m->om_next += cells;
-
- assert(p->op_ima == 0); /* new node not empty */
- p->op_ima = PROP_PAT;
- p->op_next = 0;
- p->op_objsz = sz;
- p->op_namesz = len;
-
- /* the rest of the data */
- dst = p->op_data;
-
- /* zero what will be the pad, cheap and cannot hurt */
- m->om_mem[m->om_next - 1] = 0;
-
- if ( sz > 0 ) {
- /* some props have no data, just a name */
- memcpy(dst, src, sz);
- dst += sz;
- }
-
- memcpy(dst, name, len);
-
- /* now place it in the tree */
- n = ofd_node_get(m, node);
- assert(n != NULL);
-
- if ( n->on_prop == 0 ) {
- n->on_prop = pos;
- } else {
- ofdn_t pn = n->on_prop;
- struct ofd_prop *nxt;
-
- for (;;) {
- nxt = ofd_prop_get(m, pn);
- if (nxt->op_next == 0) {
- nxt->op_next = pos;
- break;
- }
- pn = nxt->op_next;
- }
- }
-
- return pos;
-}
-
-void ofd_prop_remove(void *mem, ofdn_t node, ofdn_t prop)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_node *n = ofd_node_get(m, node);
- struct ofd_prop *p = ofd_prop_get(m, prop);
-
- if (n == NULL) return;
- if (p == NULL) return;
-
- if ( n->on_prop == prop ) {
- n->on_prop = p->op_next;
- } else {
- ofdn_t pn = n->on_prop;
- struct ofd_prop *nxt;
-
- for ( ; ; ) {
- nxt = ofd_prop_get(m, pn);
- if ( nxt->op_next == prop ) {
- nxt->op_next = p->op_next;
- break;
- }
- pn = nxt->op_next;
- }
- }
- return;
-}
-
-ofdn_t ofd_prop_find(void *mem, ofdn_t n, const char *name)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- ofdn_t p = ofd_node_prop(m, n);
- struct ofd_prop *r;
- char *s;
- size_t len;
-
- if ( name == NULL || *name == '\0' ) {
- return OFD_ROOT;
- }
-
- len = strlen(name) + 1;
-
- while ( p != 0 ) {
- r = ofd_prop_get(m, p);
- s = &r->op_data[r->op_objsz];
- if ( len == r->op_namesz ) {
- if ( strncmp(name, s, r->op_namesz) == 0 ) {
- break;
- }
- }
- p = r->op_next;
- }
- return p;
-}
-
-static ofdn_t ofd_prop_next(struct ofd_mem *m, ofdn_t n, const char *prev)
-{
- ofdn_t p;
-
- if ( prev == NULL || *prev == '\0' ) {
- /* give the first */
- p = ofd_node_prop(m, n);
- } else {
- struct ofd_prop *r;
-
- /* look for the name */
- p = ofd_prop_find(m, n, prev);
- if ( p != 0 ) {
- /* get the data for prev */
- r = ofd_prop_get(m, p);
-
- /* now get next */
- p = r->op_next;
- } else {
- p = -1;
- }
- }
-
- return p;
-}
-
-ofdn_t ofd_nextprop(void *mem, ofdn_t n, const char *prev, char *name)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- ofdn_t p = ofd_prop_next(m, n, prev);
- struct ofd_prop *r;
- char *s;
-
- if ( p > 0 ) {
- r = ofd_prop_get(m, p);
- s = &r->op_data[r->op_objsz];
- memcpy(name, s, r->op_namesz);
- }
-
- return p;
-}
-
-/*
- * It is valid to call with NULL pointers, in case you want only one
- * cell size.
- */
-int ofd_getcells(void* mem, ofdn_t n, u32* addr_cells, u32* size_cells)
-{
- if ( addr_cells != NULL ) *addr_cells = 0;
- if ( size_cells != NULL ) *size_cells = 0;
-
-retry:
- if ( addr_cells != NULL && *addr_cells == 0 ) {
- ofd_getprop(mem, n, "#address-cells",
- addr_cells, sizeof(u32));
- }
-
- if ( size_cells != NULL && *size_cells == 0 ) {
- ofd_getprop(mem, n, "#size-cells", size_cells, sizeof(u32));
- }
-
- if ( ( size_cells != NULL && *size_cells == 0 )
- || ( addr_cells != NULL && *addr_cells == 0 ) ) {
- if ( n != OFD_ROOT ) {
- n = ofd_node_parent(mem, n);
- goto retry;
- }
- return -1;
- }
-
- return 1;
-}
-
-int ofd_getprop(void *mem, ofdn_t n, const char *name, void *buf, size_t sz)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- ofdn_t p = ofd_prop_find(m, n, name);
- struct ofd_prop *r;
-
- if ( p == 0 ) {
- return -1;
- }
-
- r = ofd_prop_get(m, p);
-
- if ( sz > r->op_objsz ) {
- sz = r->op_objsz;
- }
- memcpy(buf, r->op_data, sz);
-
- return r->op_objsz;
-}
-
-int ofd_getproplen(void *mem, ofdn_t n, const char *name)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- ofdn_t p = ofd_prop_find(m, n, name);
- struct ofd_prop *r;
-
- if ( p == 0 ) {
- return -1;
- }
-
- r = ofd_prop_get(m, p);
-
- return r->op_objsz;
-}
-
-static ofdn_t ofd_prop_set(
- void *mem, ofdn_t n, const char *name, const void *src, size_t sz)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- ofdn_t p = ofd_prop_find(m, n, name);
- struct ofd_prop *r;
- char *dst;
-
- r = ofd_prop_get(m, p);
-
- if ( sz <= r->op_objsz ) {
- /* we can reuse */
- memcpy(r->op_data, src, sz);
- if ( sz < r->op_objsz ) {
- /* need to move name */
- dst = r->op_data + sz;
- /*
- * use the name arg size we may have overlap with the
- * original
- */
- memcpy(dst, name, r->op_namesz);
- r->op_objsz = sz;
- }
- } else {
- /*
- * Sadly, we remove from the list, wasting the space and then
- * we can creat a new one
- */
- ofd_prop_remove(m, n, p);
- p = ofd_prop_create(mem, n, name, src, sz);
- }
-
- return p;
-}
-
-int ofd_setprop(
- void *mem, ofdn_t n, const char *name, const void *buf, size_t sz)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- ofdn_t r;
-
- r = ofd_prop_find(m, n, name);
- if ( r == 0 ) {
- r = ofd_prop_create(mem, n, name, buf, sz);
- } else {
- r = ofd_prop_set(mem, n, name, buf, sz);
- }
-
- if ( r > 0 ) {
- struct ofd_prop *pp = ofd_prop_get(m, r);
- return pp->op_objsz;
- }
-
- return OF_FAILURE;
-}
-
-
-static ofdn_t ofd_find_by_prop(
- struct ofd_mem *m,
- ofdn_t head,
- ofdn_t *prev_p,
- ofdn_t n,
- const char *name,
- const void *val,
- size_t sz)
-{
- struct ofd_node *np;
- struct ofd_prop *pp;
- ofdn_t p;
-
-retry:
- p = ofd_prop_find(m, n, name);
-
- if ( p > 0 ) {
- int match = 0;
-
- /* a property exists by that name */
- if ( val == NULL ) {
- match = 1;
- } else {
- /* need to compare values */
- pp = ofd_prop_get(m, p);
- if ( sz == pp->op_objsz
- && memcmp(pp->op_data, val, sz) == 0 ) {
- match = 1;
- }
- }
- if ( match == 1 ) {
- if ( *prev_p >= 0 ) {
- np = ofd_node_get(m, *prev_p);
- np->on_next = n;
- } else {
- head = n;
- }
- np = ofd_node_get(m, n);
- np->on_prev = *prev_p;
- np->on_next = -1;
- *prev_p = n;
- }
- }
-
- p = ofd_node_child(m, n);
- if ( p > 0 ) {
- head = ofd_find_by_prop(m, head, prev_p, p, name, val, sz);
- }
-
- p = ofd_node_peer(m, n);
- if ( p > 0 ) {
- n = p;
- goto retry;
- }
-
- return head;
-}
-
-ofdn_t ofd_node_find_by_prop(
- void *mem,
- ofdn_t n,
- const char *name,
- const void *val,
- size_t sz)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- ofdn_t prev = -1;
-
- if ( n <= 0 ) {
- n = OFD_ROOT;
- }
-
- return ofd_find_by_prop(m, -1, &prev, n, name, val, sz);
-}
-
-ofdn_t ofd_node_find_next(void *mem, ofdn_t n)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_node *np;
-
- np = ofd_node_get(m, n);
-
- if (np == NULL) return 0;
- return np->on_next;
-}
-
-ofdn_t ofd_node_find_prev(void *mem, ofdn_t n)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_node *np;
-
- np = ofd_node_get(m, n);
- if (np == NULL) return 0;
-
- return np->on_prev;
-}
-
-ofdn_t ofd_io_create(void *mem, ofdn_t node, u64 open)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_node *n;
- struct ofd_io *i;
- ofdn_t pos;
- ofdn_t cells;
-
- cells = (sizeof (*i) + sizeof (m->om_mem[0]) - 1) / sizeof(m->om_mem[0]);
-
- n = ofd_node_get(m, node);
- if ( n == NULL ) return 0;
-
- if ( m->om_next + cells >= m->om_num ) {
- return 0;
- }
-
- pos = m->om_next;
- assert(ofd_check(&m->om_mem[pos], cells)); /* non-zero */
-
- m->om_next += cells;
-
- i = (struct ofd_io *)&m->om_mem[pos];
- assert(i->oi_ima == 0); /* new node not empty */
-
- i->oi_ima = IO_PAT;
- i->oi_node = node;
- i->oi_open = open;
-
- n->on_io = pos;
-
- return pos;
-}
-
-static struct ofd_io *ofd_io_get(struct ofd_mem *m, ofdn_t i)
-{
- if ( i < m->om_next ) {
- struct ofd_io *r;
-
- r = (struct ofd_io *)&m->om_mem[i];
- if ( r->oi_ima == IO_PAT ) {
- return r;
- }
- assert(r->oi_ima == IO_PAT); /* bad object */
- }
-
- return NULL;
-}
-
-ofdn_t ofd_node_io(void *mem, ofdn_t n)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_node *r = ofd_node_get(m, n);
-
- if (r == NULL) return 0;
- return r->on_io;
-}
-
-uint ofd_io_open(void *mem, ofdn_t n)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_io *r = ofd_io_get(m, n);
-
- if (r == NULL) return 0;
- return r->oi_open;
-}
-
-void ofd_io_close(void *mem, ofdn_t n)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- struct ofd_io *o = ofd_io_get(m, n);
- struct ofd_node *r = ofd_node_get(m, o->oi_node);
-
- assert(o != NULL);
- assert(r != NULL);
- o->oi_open = 0;
- r->on_io = 0;
-}
-
-ofdn_t ofd_node_add(void *m, ofdn_t p, const char *path, size_t sz)
-{
- ofdn_t n;
-
- n = ofd_node_child(m, p);
- if ( n > 0 ) {
- n = ofd_node_peer_last(m, n);
- if ( n > 0 ) {
- n = ofd_node_peer_create(m, n, path, sz);
- }
- } else {
- n = ofd_node_child_create(m, p, path, sz);
- }
-
- return n;
-}
-
-ofdn_t ofd_prop_add(
- void *mem,
- ofdn_t n,
- const char *name,
- const void *buf,
- size_t sz)
-{
- struct ofd_mem *m = (struct ofd_mem *)mem;
- ofdn_t r;
-
- r = ofd_prop_find(m, n, name);
- if ( r == 0 ) {
- r = ofd_prop_create(mem, n, name, buf, sz);
- } else {
- r = ofd_prop_set(mem, n, name, buf, sz);
- }
-
- return r;
-}
diff --git a/xen/arch/powerpc/of-devtree.h b/xen/arch/powerpc/of-devtree.h
deleted file mode 100644
index d1450c5014..0000000000
--- a/xen/arch/powerpc/of-devtree.h
+++ /dev/null
@@ -1,157 +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@watson.ibm.com>
- */
-
-#ifndef _OF_DEVTREE_H
-#define _OF_DEVTREE_H
-
-#include <xen/types.h>
-#include <xen/string.h>
-#include <xen/kernel.h>
-#include <public/xen.h>
-
-enum {
- OF_FAILURE = -1,
- OF_SUCCESS = 0,
-};
-
-union of_pci_hi {
- u32 word;
- struct {
- u32 opa_n: 1; /* relocatable */
- u32 opa_p: 1; /* prefetchable */
- u32 opa_t: 1; /* aliased */
- u32 _opa_res: 3;
- u32 opa: 2; /* space code */
- u32 opa_b: 8; /* bus number */
- u32 opa_d: 5; /* device number */
- u32 opa_f: 3; /* function number */
- u32 opa_r: 8; /* register number */
- } bits;
-};
-
-struct of_pci_addr {
- union of_pci_hi opa_hi;
- u32 opa_mid;
- u32 opa_lo;
-};
-
-struct of_pci_range32 {
- struct of_pci_addr opr_addr;
- u32 opr_phys;
- u32 opr_size;
-};
-
-struct of_pci_range64 {
- struct of_pci_addr opr_addr;
- u32 opr_phys_hi;
- u32 opr_phys_lo;
- u32 opr_size_hi;
- u32 opr_size_lo;
-};
-
-struct of_pci_addr_range64 {
- struct of_pci_addr opr_addr;
- u32 opr_size_hi;
- u32 opr_size_lo;
-};
-
-struct reg_property32 {
- u32 address;
- u32 size;
-};
-
-typedef s32 ofdn_t;
-
-#define OFD_ROOT 1
-#define OFD_DUMP_NAMES 0x1
-#define OFD_DUMP_VALUES 0x2
-#define OFD_DUMP_ALL (OFD_DUMP_VALUES|OFD_DUMP_NAMES)
-
-extern void *ofd_create(void *mem, size_t sz);
-extern ofdn_t ofd_node_parent(void *mem, ofdn_t n);
-extern ofdn_t ofd_node_peer(void *mem, ofdn_t n);
-extern ofdn_t ofd_node_child(void *mem, ofdn_t p);
-extern const char *ofd_node_path(void *mem, ofdn_t p);
-extern int ofd_node_to_path(void *mem, ofdn_t p, void *buf, size_t sz);
-extern ofdn_t ofd_node_child_create(void *mem, ofdn_t parent,
- const char *path, size_t pathlen);
-extern ofdn_t ofd_node_peer_create(void *mem, ofdn_t sibling,
- const char *path, size_t pathlen);
-extern ofdn_t ofd_node_find(void *mem, const char *devspec);
-extern ofdn_t ofd_node_add(void *m, ofdn_t n, const char *path, size_t sz);
-extern int ofd_node_prune(void *m, ofdn_t n);
-extern int ofd_prune_path(void *m, const char *path);
-extern ofdn_t ofd_node_io(void *mem, ofdn_t n);
-
-extern ofdn_t ofd_nextprop(void *mem, ofdn_t n, const char *prev, char *name);
-extern ofdn_t ofd_prop_find(void *mem, ofdn_t n, const char *name);
-extern int ofd_getprop(void *mem, ofdn_t n, const char *name,
- void *buf, size_t sz);
-extern int ofd_getproplen(void *mem, ofdn_t n, const char *name);
-
-extern int ofd_setprop(void *mem, ofdn_t n, const char *name,
- const void *buf, size_t sz);
-extern void ofd_prop_remove(void *mem, ofdn_t node, ofdn_t prop);
-extern ofdn_t ofd_prop_add(void *mem, ofdn_t n, const char *name,
- const void *buf, size_t sz);
-extern ofdn_t ofd_io_create(void *m, ofdn_t node, u64 open);
-extern u32 ofd_io_open(void *mem, ofdn_t n);
-extern void ofd_io_close(void *mem, ofdn_t n);
-
-
-typedef void (*walk_fn)(void *m, const char *pre, ofdn_t p, int arg);
-extern void ofd_dump_props(void *m, const char *pre, ofdn_t p, int dump);
-
-extern void ofd_walk(void *m, const char *pre, ofdn_t p, walk_fn fn, int arg);
-
-
-/* Recursively look up #address_cells and #size_cells properties */
-extern int ofd_getcells(void *mem, ofdn_t n,
- u32 *addr_cells, u32 *size_cells);
-
-extern size_t ofd_size(void *mem);
-extern size_t ofd_space(void *mem);
-
-extern void ofd_prop_print(const char *head, const char *path,
- const char *name, const char *prop, size_t sz);
-
-extern ofdn_t ofd_node_find_by_prop(void *mem, ofdn_t n, const char *name,
- const void *val, size_t sz);
-extern ofdn_t ofd_node_find_next(void *mem, ofdn_t n);
-extern ofdn_t ofd_node_find_prev(void *mem, ofdn_t n);
-extern void ofd_init(int (*write)(const char *, size_t len));
-
-static inline int ofd_strstr(const char *s, int len, const char *str)
-{
- int l = strlen(str);
- do {
- int n;
-
- if (len >= l && strstr(s, str))
- return 1;
-
- n = strnlen(s, len) + 1;
- len -= strnlen(s, len) + 1;
- s += n;
- } while (len > 0);
- return 0;
-}
-
-#endif /* _OF_DEVTREE_H */
diff --git a/xen/arch/powerpc/of-devwalk.c b/xen/arch/powerpc/of-devwalk.c
deleted file mode 100644
index 697ebb1901..0000000000
--- a/xen/arch/powerpc/of-devwalk.c
+++ /dev/null
@@ -1,133 +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@watson.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/init.h>
-#include <xen/lib.h>
-#include <xen/ctype.h>
-#include <xen/kernel.h>
-#include "of-devtree.h"
-
-void ofd_prop_print(
- const char *head,
- const char *path,
- const char *name,
- const char *prop,
- size_t sz)
-{
-#define DEBUG_PROP
-#ifndef DEBUG_PROP
- if ( path[0] == '/' && path[1] == '\0' ) {
- path = "";
- }
- printk("%s: %s/%s: 0x%lx\n", head, path, name, sz);
-#else
- int i;
- int isstr = sz;
- const char *b = prop;
-
- for ( i = 0; i < sz; i++ ) {
- /* see if there is any non printable characters */
- if ( !isprint(b[i]) ) {
- /* not printable */
- if (b[i] != '\0' || (i + 1) != sz) {
- /* not the end of string */
- isstr = 0;
- break;
- }
- }
- }
-
- if ( isstr > 0 ) {
- printk("%s: \t%s\n", head, b);
- } else if ( sz != 0 ) {
- printk("%s: \t0x", head);
-
- for ( i = 0; i < sz; i++ ) {
- if ( (i % 4) == 0 && i != 0 ) {
- if ( (i % 16) == 0 && i != 0 ) {
- printk("\n%s: \t0x", head);
- } else {
- printk(" 0x");
- }
- }
- if (b[i] < 0x10) {
- printk("0");
- }
- printk("%x", b[i]);
- }
- printk("\n");
- }
-#endif
-}
-
-void ofd_dump_props(void *mem, const char *pre, ofdn_t n, int dump)
-{
- ofdn_t p;
- char name[128];
- char prop[256] __attribute__ ((aligned (__alignof__ (u64))));
- int sz;
- const char *path;
-
- if ( n == OFD_ROOT ) {
- path = "";
- } else {
- path = ofd_node_path(mem, n);
- }
-
- if (dump & OFD_DUMP_NAMES) {
- printk("%s: %s: phandle 0x%x\n", pre, path, n);
- }
-
- p = ofd_nextprop(mem, n, NULL, name);
- while ( p > 0 ) {
- sz = ofd_getprop(mem, n, name, prop, sizeof (prop));
- if ( sz > 0 && sz > sizeof (prop) ) {
- sz = sizeof (prop);
- }
-
- if ( dump & OFD_DUMP_VALUES ) {
- ofd_prop_print(pre, path, name, prop, sz);
- }
-
- p = ofd_nextprop(mem, n, name, name);
- }
-}
-
-void ofd_walk(void *m, const char *pre, ofdn_t p, walk_fn fn, int arg)
-{
- ofdn_t n;
-
- if ( fn != NULL ) {
- (*fn)(m, pre, p, arg);
- }
-
- /* child */
- n = ofd_node_child(m, p);
- if ( n != 0 ) {
- ofd_walk(m, pre, n, fn, arg);
- }
-
- /* peer */
- n = ofd_node_peer(m, p);
- if ( n != 0 ) {
- ofd_walk(m, pre, n, fn, arg);
- }
-}
diff --git a/xen/arch/powerpc/of_handler/Makefile b/xen/arch/powerpc/of_handler/Makefile
deleted file mode 100644
index 1f3abfa2c1..0000000000
--- a/xen/arch/powerpc/of_handler/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Build the Open Firmware handler
-#
-
-CFLAGS += -I..
-
-# head.o must be first
-obj-y = head.o
-obj-y += console.o
-obj-y += control.o
-obj-y += cpu.o
-obj-y += devtree.o
-obj-y += head.o
-obj-y += io.o
-obj-y += leap.o
-obj-y += memory.o
-obj-y += ofh.o
-obj-y += papr.o
-obj-y += rtas.o
-obj-y += services.o
-obj-y += vdevice.o
-obj-y += xencomm.o
-obj-y += xen_hvcall.o
-
-obj-y += memcmp.o
-obj-y += memset.o
-obj-y += snprintf.o
-obj-y += strcmp.o
-obj-y += strlen.o
-obj-y += strncmp.o
-obj-y += strlcpy.o
-obj-y += strnlen.o
diff --git a/xen/arch/powerpc/of_handler/console.c b/xen/arch/powerpc/of_handler/console.c
deleted file mode 100644
index 1c576ef3c2..0000000000
--- a/xen/arch/powerpc/of_handler/console.c
+++ /dev/null
@@ -1,233 +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@watson.ibm.com>
- */
-
-#include "ofh.h"
-#include "papr.h"
-#include <xen/string.h>
-#include <asm/system.h>
-
-union chpack {
- u64 oct[2];
- u32 quad[4];
- char c[16];
-};
-
-/* used for internal printing */
-static struct ofh_ihandle *ofh_ihp;
-
-static s32 ofh_papr_read(s32 chan, void *buf, u32 count, s32 *actual, ulong b)
-{
- s32 rc;
- ulong ret[5];
- ulong sz = 0;
-
- rc = papr_get_term_char(ret, chan);
- if (rc == H_Success && ret[0] > 0) {
- sz = MIN(count, ret[0]);
- memcpy(buf, &ret[1], sz);
- }
- *actual = sz;
- return OF_SUCCESS;
-}
-
-static s32 ofh_papr_write(s32 chan, const void *buf, u32 count, s32 *actual,
- ulong b)
-{
- const char *str = (const char *)buf;
- u32 i;
- union chpack ch;
- s32 ret;
-
- for (i = 0; i < count; i++) {
- int m = i % sizeof(ch);
- ch.c[m] = str[i];
- if (m == sizeof(ch) - 1 || i == count - 1) {
- for (;;) {
- if (sizeof (ulong) == sizeof (u64)) {
- ret = papr_put_term_char(NULL,
- chan,
- m + 1,
- ch.oct[0],
- ch.oct[1]);
- } else {
- ret = papr_put_term_char(NULL,
- chan,
- m + 1,
- ch.quad[0],
- ch.quad[1],
- ch.quad[2],
- ch.quad[3]);
- }
- if (ret != H_Busy) {
- break;
- }
- /* yielding here would be nice */
- }
- if (ret != H_Success) {
- return -1;
- }
- }
- }
- *actual = count;
- if (*actual == -1) {
- return OF_FAILURE;
- }
- return OF_SUCCESS;
-}
-
-#define __HYPERVISOR_console_io 18
-#define CONSOLEIO_write 0
-#define CONSOLEIO_read 1
-#define XEN_MARK(a) ((a) | (~0UL << 16))
-extern long xen_hvcall(ulong code, ...);
-
-#define XENCOMM_MINI_AREA (sizeof(struct xencomm_mini) * 2)
-static s32 ofh_xen_dom0_read(s32 chan, void *buf, u32 count, s32 *actual,
- ulong b)
-{
- char __storage[XENCOMM_MINI_AREA];
- struct xencomm_desc *desc;
- s32 rc;
- char *s = buf;
- s32 ret = 0;
-
- while (count > 0) {
- if (xencomm_create_mini(__storage, XENCOMM_MINI_AREA, s, count, &desc))
- return ret;
-
- rc = xen_hvcall(XEN_MARK(__HYPERVISOR_console_io), CONSOLEIO_read,
- count, desc);
- if (rc <= 0) {
- return ret;
- }
- count -= rc;
- s += rc;
- ret += rc;
- }
- *actual = ret;
- return OF_SUCCESS;
-}
-
-static s32 ofh_xen_dom0_write(s32 chan, const void *buf, u32 count,
- s32 *actual, ulong b)
-{
- char __storage[XENCOMM_MINI_AREA];
- struct xencomm_desc *desc;
- s32 rc;
- char *s = (char *)buf;
- s32 ret = 0;
-
- while (count > 0) {
- if (xencomm_create_mini(__storage, XENCOMM_MINI_AREA, s, count, &desc))
- return ret;
-
- rc = xen_hvcall(XEN_MARK(__HYPERVISOR_console_io), CONSOLEIO_write,
- count, desc);
- if (rc <= 0) {
- return ret;
- }
- count -= rc;
- s += rc;
- ret += rc;
- }
- *actual = ret;
- if (*actual == -1) {
- return OF_FAILURE;
- }
- return OF_SUCCESS;
-}
-
-static s32 ofh_xen_domu_read(s32 chan, void *buf, u32 count, s32 *actual,
- ulong b)
-{
- struct xencons_interface *intf;
- XENCONS_RING_IDX cons, prod;
- s32 ret;
-
- intf = DRELA(ofh_ihp, b)->ofi_intf;
- cons = intf->in_cons;
- prod = intf->in_prod;
- mb();
-
- ret = prod - cons;
-
- if (ret > 0) {
- ret = (ret < count) ? ret : count;
- memcpy(buf, intf->in+MASK_XENCONS_IDX(cons,intf->in), ret);
- }
-
- *actual = (ret < 0) ? 0 : ret;
- return OF_SUCCESS;
-}
-
-static s32 ofh_xen_domu_write(s32 chan, const void *buf, u32 count,
- s32 *actual, ulong b)
-{
- struct xencons_interface *intf;
- XENCONS_RING_IDX cons, prod;
- s32 ret;
-
- intf = DRELA(ofh_ihp, b)->ofi_intf;
- cons = intf->in_cons;
- prod = intf->in_prod;
- mb();
-
- ret = prod - cons;
- /* FIXME: Do we have to write the whole thing or are partial writes ok? */
- if (ret > 0) {
- ret = (ret < count) ? ret : count;
- memcpy(intf->in+MASK_XENCONS_IDX(cons,intf->in), buf, ret);
- }
-
- *actual = (ret < 0) ? 0 : ret;
- return OF_SUCCESS;
-}
-
-/* for emergency printing in the OFH */
-s32 ofh_cons_write(const void *buf, u32 count, s32 *actual)
-{
- ulong b = get_base();
- struct ofh_ihandle *ihp = DRELA(ofh_ihp, b);
-
- return ihp->ofi_write(ihp->ofi_chan, buf, count, actual, b);
-}
-
-s32 ofh_cons_close(void)
-{
- return OF_SUCCESS;
-}
-
-void
-ofh_cons_init(struct ofh_ihandle *ihp, ulong b)
-{
- if (ihp->ofi_chan == OFH_CONS_XEN) {
- if (ihp->ofi_intf == NULL) {
- ihp->ofi_write = ofh_xen_dom0_write;
- ihp->ofi_read = ofh_xen_dom0_read;
- } else {
- ihp->ofi_write = ofh_xen_domu_write;
- ihp->ofi_read = ofh_xen_domu_read;
- }
- } else {
- ihp->ofi_write = ofh_papr_write;
- ihp->ofi_read = ofh_papr_read;
- }
- *DRELA(&ofh_ihp, b) = ihp;
-}
diff --git a/xen/arch/powerpc/of_handler/control.c b/xen/arch/powerpc/of_handler/control.c
deleted file mode 100644
index 02dbab6946..0000000000
--- a/xen/arch/powerpc/of_handler/control.c
+++ /dev/null
@@ -1,90 +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@watson.ibm.com>
- */
-
-#include "ofh.h"
-
-s32
-ofh_boot(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- b=b;
- nargs = nargs;
- nrets = nrets;
- argp = argp;
- retp = retp;
- return OF_FAILURE;
-}
-
-s32
-ofh_enter(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- b=b;
- nargs = nargs;
- nrets = nrets;
- argp = argp;
- retp = retp;
- return OF_FAILURE;
-}
-
-s32
-ofh_exit(u32 nargs __attribute__ ((unused)),
- u32 nrets __attribute__ ((unused)),
- s32 argp[] __attribute__ ((unused)),
- s32 retp[] __attribute__ ((unused)),
- ulong b)
-{
- static const char msg[] = "OFH: exit method called\n";
- s32 dummy;
-
- ofh_cons_write(DRELA(&msg[0], b), sizeof (msg), &dummy);
-
- for (;;) {
- /* kill domain here */
- }
- return OF_FAILURE;
-}
-
-s32
-ofh_chain(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- b=b;
- nargs = nargs;
- nrets = nrets;
- argp = argp;
- retp = retp;
- return OF_FAILURE;
-}
-
-s32
-ofh_quiesce(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 0) {
- if (nrets == 0) {
- void *mem = ofd_mem(b);
- (void)nargs;
- (void)nrets;
- (void)argp;
- (void)retp;
- (void)mem;
-
- return OF_SUCCESS;
- }
- }
- return OF_FAILURE;
-}
diff --git a/xen/arch/powerpc/of_handler/cpu.c b/xen/arch/powerpc/of_handler/cpu.c
deleted file mode 100644
index 0fcc5d8ace..0000000000
--- a/xen/arch/powerpc/of_handler/cpu.c
+++ /dev/null
@@ -1,82 +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@watson.ibm.com>
- */
-
-#include "ofh.h"
-
-s32
-ofh_start_cpu(u32 nargs, u32 nrets, s32 argp[],
- s32 retp[] __attribute__ ((unused)),
- ulong b __attribute__ ((unused)))
-{
- if (nargs == 3) {
- if (nrets == 0) {
- ofdn_t ph = argp[0];
- u32 pc = argp[1];
- u32 arg = argp[2];
-
- (void)ph; (void)pc; (void)arg;
- return OF_FAILURE;
- }
- }
- return OF_FAILURE;
-}
-
-s32
-ofh_stop_self(u32 nargs, u32 nrets,
- s32 argp[] __attribute__ ((unused)),
- s32 retp[] __attribute__ ((unused)),
- ulong b __attribute__ ((unused)))
-{
- if (nargs == 0) {
- if (nrets == 0) {
- return OF_FAILURE;
- }
- }
- return OF_FAILURE;
-}
-
-s32
-ofh_idle_self(u32 nargs, u32 nrets,
- s32 argp[] __attribute__ ((unused)),
- s32 retp[] __attribute__ ((unused)),
- ulong b __attribute__ ((unused)))
-{
- if (nargs == 0) {
- if (nrets == 0) {
- return OF_FAILURE;
- }
- }
- return OF_FAILURE;
-}
-s32
-ofh_resume_cpu(u32 nargs, u32 nrets, s32 argp[],
- s32 retp[] __attribute__ ((unused)),
- ulong b __attribute__ ((unused)))
-{
- if (nargs == 1) {
- if (nrets == 0) {
- ofdn_t ph = argp[0];
-
- (void)ph;
- return OF_FAILURE;
- }
- }
- return OF_FAILURE;
-}
diff --git a/xen/arch/powerpc/of_handler/devtree.c b/xen/arch/powerpc/of_handler/devtree.c
deleted file mode 100644
index edd98f976f..0000000000
--- a/xen/arch/powerpc/of_handler/devtree.c
+++ /dev/null
@@ -1,268 +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@watson.ibm.com>
- */
-
-#include "ofh.h"
-#include <of-devtree.h>
-
-s32
-ofh_peer(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 1) {
- if (nrets == 1) {
- ofdn_t ph = argp[0];
- s32 *sib_ph = &retp[0];
- void *mem = ofd_mem(b);
-
- *sib_ph = ofd_node_peer(mem, ph);
- return OF_SUCCESS;
- }
- }
- return OF_FAILURE;
-}
-
-s32
-ofh_child(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 1) {
- if (nrets == 1) {
- ofdn_t ph = argp[0];
- s32 *ch_ph = &retp[0];
- void *mem = ofd_mem(b);
-
- *ch_ph = ofd_node_child(mem, ph);
- return OF_SUCCESS;
- }
- }
- return OF_FAILURE;
-}
-
-s32
-ofh_parent(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 1) {
- if (nrets == 1) {
- ofdn_t ph = argp[0];
- s32 *parent_ph = &retp[0];
- void *mem = ofd_mem(b);
-
- *parent_ph = ofd_node_parent(mem, ph);
- return OF_SUCCESS;
- }
- }
- return OF_FAILURE;
-}
-
-s32
-ofh_instance_to_package(u32 nargs, u32 nrets, s32 argp[], s32 retp[],
- ulong b __attribute__ ((unused)))
-{
- if (nargs == 1) {
- if (nrets == 1) {
- struct ofh_ihandle *ih =
- (struct ofh_ihandle *)(ulong)argp[0];
- s32 *p = &retp[0];
-
- *p = (s32)ih->ofi_node;
- return OF_SUCCESS;
- }
- }
- return OF_FAILURE;
-}
-
-s32
-ofh_getproplen(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 2) {
- if (nrets == 1) {
- ofdn_t ph = argp[0];
- const char *name = (const char *)(ulong)argp[1];
- s32 *size = &retp[0];
- void *mem = ofd_mem(b);
-
- *size = ofd_getproplen(mem, ph, name);
- if (*size >= 0) {
- return OF_SUCCESS;
- }
- }
- }
- return OF_FAILURE;
-}
-
-s32
-ofh_getprop(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 4) {
- if (nrets == 1) {
- ofdn_t ph = argp[0];
- const char *name = (const char *)(ulong)argp[1];
- void *buf = (void *)(ulong)argp[2];
- ulong buflen = argp[3];
- s32 *size = &retp[0];
- void *mem = ofd_mem(b);
-
- *size = ofd_getprop(mem, ph, name, buf, buflen);
- if (*size > 0) {
- return OF_SUCCESS;
- }
- }
- }
- return OF_FAILURE;
-}
-
-s32
-ofh_nextprop(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 3) {
- if (nrets == 1) {
- ofdn_t ph = argp[0];
- const char *prev = (const char *)(ulong)argp[1];
- char *name = (char *)(ulong)argp[2];
- s32 *flag = &retp[0];
- void *mem = ofd_mem(b);
-
- *flag = ofd_nextprop(mem, ph, prev, name);
- if (*flag > 0) {
- *flag = 1;
- }
- return OF_SUCCESS;
- }
- }
- return OF_FAILURE;
-}
-
-s32
-ofh_setprop(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 4) {
- if (nrets == 1) {
- ofdn_t ph = argp[0];
- const char *name = (const char *)(ulong)argp[1];
- const void *buf = (void *)(ulong)argp[2];
- ulong buflen = argp[3];
- s32 *size = &retp[0];
- void *mem = ofd_mem(b);
-
- *size = ofd_setprop(mem, ph, name, buf, buflen);
- return OF_SUCCESS;
- }
- }
- return OF_FAILURE;
-}
-
-s32
-ofh_canon(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 3) {
- if (nrets == 1) {
- const char *dev_spec = (const char *)(ulong)argp[0];
- char *buf = (char *)(ulong)argp[1];
- u32 sz = argp[2];
- s32 *len = &retp[0];
- void *mem = ofd_mem(b);
- ofdn_t ph;
-
- ph = ofd_node_find(mem, dev_spec);
- if (ph > 0) {
- *len = ofd_node_to_path(mem, ph, buf, sz);
- return OF_SUCCESS;
- }
- }
- }
- return OF_FAILURE;
-}
-
-s32 ofh_active_package = -1;
-
-s32
-ofh_finddevice(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 1) {
- if (nrets == 1) {
- s32 *ap = DRELA(&ofh_active_package, b);
- const char *devspec = (const char *)(ulong)argp[0];
- s32 *ph = &retp[0];
- void *mem = ofd_mem(b);
-
- /* good enuff */
- if (devspec[0] == '\0') {
- if (*ap == -1) {
- *ph = -1;
- return OF_FAILURE;
- }
- *ph = *ap;
- } else {
- *ph = ofd_node_find(mem, devspec);
- if (*ph <= 0) {
- *ph = -1;
- return OF_FAILURE;
- }
- }
- *ap = *ph;
- return OF_SUCCESS;
- }
- }
- return OF_FAILURE;
-}
-
-s32
-ofh_instance_to_path(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 3) {
- if (nrets == 1) {
- struct ofh_ihandle *ih =
- (struct ofh_ihandle *)((ulong)argp[0]);
- char *buf = (char *)(ulong)argp[1];
- u32 sz = argp[2];
- s32 *len = &retp[0];
- ofdn_t ph;
- void *mem = ofd_mem(b);
-
- ph = ih->ofi_node;
- if (ph > 0) {
- *len = ofd_node_to_path(mem, ph, buf, sz);
- return OF_SUCCESS;
- }
- }
- }
- return OF_FAILURE;
-}
-
-s32
-ofh_package_to_path(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 3) {
- if (nrets == 1) {
- ofdn_t ph = argp[0];
- char *buf = (char *)(ulong)argp[1];
- u32 sz = argp[2];
- s32 *len = &retp[0];
- void *mem = ofd_mem(b);
-
- if (ph > 0) {
- *len = ofd_node_to_path(mem, ph, buf, sz);
- return OF_SUCCESS;
- }
- }
- }
- return OF_FAILURE;
-}
-
-
-
diff --git a/xen/arch/powerpc/of_handler/head.S b/xen/arch/powerpc/of_handler/head.S
deleted file mode 100644
index e5d45c87fb..0000000000
--- a/xen/arch/powerpc/of_handler/head.S
+++ /dev/null
@@ -1,156 +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, 2007
- *
- * Authors: Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-/*
- * Glue code for open-firmware client interface implementation.
- */
-
-#define OF_STACK_SIZE (64*1024)
-
-#include <asm/config.h>
-#include <asm/processor.h>
-
-#define SAVE_STACK 0
-#define SAVE_SRR0 1
-#define SAVE_SRR1 2
-#define SAVE_MSR 3
-#define SAVE_LR 4
-#define SAVE_TOC 5
-#define SAVE_BASE 6
-#define SAVE_BCHAIN 7 /* MUST be last */
-
-/* This code is NOT MP safe and does not need to be */
- .p2align 3
- . = 0x0
-_GLOBAL(ofh_start) # make the linker happy
-_ofh_cih:
- ## r3 holds the parameter. All other volatiles are available.
- mflr r0
- # Obtain address of _ofh_work_space via a branch-and-link
- bl _ofh_cih_continue
-_ofh_work_space:
- nop
-
- . = 0x10
- .global _ofh_tree
-_ofh_tree:
- .long 0xdeadbeef
- .long 0x0
-
- . = 0x18
- .global _ofh_inited
-_ofh_inited:
- .long 0x0
-
- . = 0x20
- .global _ofh_lastarg
-_ofh_lastarg:
- .long 0x0
- .long 0x0
-
-_ofh_cih_continue:
- mflr r12 # r12 = &_ofh_work_space
- mr r11, r1 # r11 = orig stk ptr
-
- /* load base address in r4 */
- LOADADDR(r4, _ofh_work_space)
- sub r4, r12, r4
-
-
- # save srr0/1
- mfsrr0 r9
- mfsrr1 r8
- mfmsr r7
- LOADADDR(r5, _ofh_cih_64bit)
- add r5, r5, r4 # offset base
- mtsrr0 r5
- # r5 = MSR_SF
- li r5,-1
- rldicr r5,r5,0,0
- or r5,r5,r7
- mtsrr1 r5
- rfid
- trap
-
-_ofh_cih_64bit:
- # move to local stack
- lis r1, (_ofh_cih_stack - _ofh_cih_stack_end) >> 16
- ori r1, r1, (_ofh_cih_stack - _ofh_cih_stack_end) & 0xffff
- add r1, r12, r1
- # create an initial chain
- li r10, 0
- # frame with 3 slots
- stdu r10, -(STACK_FRAME_OVERHEAD + (SAVE_BCHAIN * 8))(r1)
- # preserve base
- std r4, (STACK_FRAME_OVERHEAD + (SAVE_BASE * 8))(r1)
- # preserve orig stk ptr
- std r11, (STACK_FRAME_OVERHEAD + (SAVE_STACK * 8))(r1)
- # preserve orig srr0
- std r9, (STACK_FRAME_OVERHEAD + (SAVE_SRR0 * 8))(r1)
- # preserve orig srr1
- std r8, (STACK_FRAME_OVERHEAD + (SAVE_SRR1 * 8))(r1)
- # preserve orig msr
- std r7, (STACK_FRAME_OVERHEAD + (SAVE_MSR * 8))(r1)
- # preserve orig lr
- std r0, (STACK_FRAME_OVERHEAD + (SAVE_LR * 8))(r1)
- # preserve orig toc
- std r2, (STACK_FRAME_OVERHEAD + (SAVE_TOC * 8))(r1)
-
- LOADADDR(r2, ofh_start) # get the address of any function
- add r2, r2, r4 # add the base
- ld r2, 8(r2) # get the TOC for that funtion
- add r2, r2, r4 # add the base
-
- bl _ENTRY(ofh_handler) # call handler
-
- ld r4, (STACK_FRAME_OVERHEAD + (SAVE_BASE * 8))(r1)
- ld r9, (STACK_FRAME_OVERHEAD + (SAVE_SRR0 * 8))(r1)
- ld r8, (STACK_FRAME_OVERHEAD + (SAVE_SRR1 * 8))(r1)
- ld r7, (STACK_FRAME_OVERHEAD + (SAVE_MSR * 8))(r1)
- ld r2, (STACK_FRAME_OVERHEAD + (SAVE_TOC * 8))(r1)
- ld r0, (STACK_FRAME_OVERHEAD + (SAVE_LR * 8))(r1)
- ld r1, (STACK_FRAME_OVERHEAD + (SAVE_STACK * 8))(r1)
-
- LOADADDR(r5, _ofh_cih_orig_msr)
- add r5, r5, r4
- mtsrr0 r5
- mtsrr1 r7
- rfid
-
-_ofh_cih_orig_msr:
- mtsrr0 r9
- mtsrr1 r8
- mtlr r0
- blr
-
-_GLOBAL(get_base)
- mflr r0
- bl 1f
-1: mflr r5
- LOADADDR(r4,1b)
- subf r3,r4,r5
- mtlr r0
- blr
-
- .data
- .p2align 3
-_ofh_cih_stack_end:
- .space OF_STACK_SIZE
-_ofh_cih_stack:
diff --git a/xen/arch/powerpc/of_handler/io.c b/xen/arch/powerpc/of_handler/io.c
deleted file mode 100644
index 492e4d6c6c..0000000000
--- a/xen/arch/powerpc/of_handler/io.c
+++ /dev/null
@@ -1,160 +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@watson.ibm.com>
- */
-
-#include "ofh.h"
-#include "xen/lib.h"
-
-s32
-ofh_open(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 1) {
- if (nrets == 1) {
- const char *devspec = (const char *)(ulong)argp[0];
- s32 *ih = &retp[0];
- ofdn_t p;
- void *mem = ofd_mem(b);
-
- p = ofd_node_find(mem, devspec);
- if (p > 0) {
- ofdn_t io;
- io = ofd_node_io(mem, p);
- if (io > 0) {
- void *f = (void *)(ulong)ofd_io_open(mem, io);
- if (f != 0) {
- *ih = leap(b, 0, NULL, NULL,
- b, f);
- return OF_SUCCESS;
- }
- }
- }
- *ih = 0;
- }
- }
- return OF_FAILURE;
-}
-
-s32
-ofh_close(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 1) {
- if (nrets == 0) {
- argp = argp;
- retp = retp;
- b = b;
- return OF_FAILURE;
- }
- }
- return OF_FAILURE;
-}
-s32
-ofh_read(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 3) {
- if (nrets == 1) {
- struct ofh_ihandle *ih =
- (struct ofh_ihandle *)(ulong)argp[0];
-
- if (ih->ofi_read != NULL) {
- void *addr = (void *)(ulong)argp[1];
- u32 sz = argp[2];
- s32 *actual = &retp[0];
- void *f = ih->ofi_read;
-
- if (f != 0) {
- return io_leap(ih->ofi_chan, addr, sz, actual,
- b, f);
- }
- }
- }
- }
- return OF_FAILURE;
-}
-
-s32
-ofh_write(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 3) {
- if (nrets == 1) {
- struct ofh_ihandle *ih =
- (struct ofh_ihandle *)(ulong)argp[0];
-
- if (ih->ofi_write != NULL) {
- void *addr = (void *)(ulong)argp[1];
- u32 sz = argp[2];
- s32 *actual = &retp[0];
- void *f = ih->ofi_write;
-
- if (f != 0) {
- return io_leap(ih->ofi_chan, addr, sz, actual,
- b, f);
- }
- }
- }
- }
- return OF_FAILURE;
-}
-
-s32
-ofh_seek(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- b=b;
- nargs = nargs;
- nrets = nrets;
- argp = argp;
- retp = retp;
- return OF_FAILURE;
-}
-
-static ofh_func_t *
-method_lookup(struct ofh_ihandle *ih, const char *name, ulong b)
-{
- struct ofh_methods *m = DRELA(ih->ofi_methods, b);
-
- while (m != NULL && m->ofm_name != NULL ) {
- if (strcmp(name, DRELA(m->ofm_name, b)) == 0) {
- return m->ofm_method;
- }
- }
- return NULL;
-}
-
-
-s32
-ofh_call_method(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs > 2) {
- if (nrets > 1) {
- const char *method = (const char *)(ulong)argp[0];
- struct ofh_ihandle *ih =
- (struct ofh_ihandle *)(ulong)argp[1];
- ofh_func_t *f;
-
- f = method_lookup(ih, method, b);
- if (f != NULL) {
- /* set catch methods return 0 on success */
- retp[0] = leap(nargs - 2, nrets - 1,
- &argp[2], &retp[1], b, f);
- return OF_SUCCESS;
- }
- }
- }
- return OF_FAILURE;
-}
-
diff --git a/xen/arch/powerpc/of_handler/leap.S b/xen/arch/powerpc/of_handler/leap.S
deleted file mode 100644
index 2bbb2d044e..0000000000
--- a/xen/arch/powerpc/of_handler/leap.S
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2005 Jimi Xenidis <jimix@watson.ibm.com>, 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/processor.h>
-
-/*
- * sval
- * rh_leap(uval nargs, uval nrets, uval args[], uval rets[], uval ba,
- * rh_func_t f)
- * We need to deal with f actually bein a function descriptor, we can
- * assume that TOC is correct.
- */
-
-
-_GLOBAL(io_leap)
-_GLOBAL(leap)
- ## r8 contains the base address for everyone
- add r8,r8,r7 # add
- ld r8, 0(r8) # get the entry point
- add r8,r8,r7 # add
- mtctr r8 # and
- bctr # leap
- /* never get here */
diff --git a/xen/arch/powerpc/of_handler/memcmp.c b/xen/arch/powerpc/of_handler/memcmp.c
deleted file mode 100644
index f6c23b75f3..0000000000
--- a/xen/arch/powerpc/of_handler/memcmp.c
+++ /dev/null
@@ -1,39 +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@watson.ibm.com>
- */
-
-#include <xen/string.h>
-
-int
-memcmp(const void *v1, const void *v2, size_t n)
-{
- const char *s1 = (const char *)v1;
- const char *s2 = (const char *)v2;
-
- while (n > 0) {
- if (*s1 != *s2) {
- return (*s1 - *s2);
- }
- /* advance pointers to next character */
- ++s1;
- ++s2;
- --n;
- }
- return 0;
-}
diff --git a/xen/arch/powerpc/of_handler/memory.c b/xen/arch/powerpc/of_handler/memory.c
deleted file mode 100644
index 184945737f..0000000000
--- a/xen/arch/powerpc/of_handler/memory.c
+++ /dev/null
@@ -1,129 +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@watson.ibm.com>
- */
-
-#include "ofh.h"
-
-struct of_malloc_s {
- u32 ofm_start;
- u32 ofm_end;
-};
-static struct of_malloc_s claimed[64];
-
-static s32
-claim(ulong b, u32 virt, u32 size, u32 align, s32 *baseaddr)
-{
- struct of_malloc_s *cp;
- u32 i;
- s32 e;
- u32 end;
-
- if (align != 0) {
- /* we don't do this now */
- return OF_FAILURE;
- }
-
- end = virt + size;
-
- /* you cannot claim OF's own space */
- if (virt >= (u32)ofh_start && end < (u32)_end) {
- return OF_FAILURE;
- }
-
- cp = DRELA(&claimed[0], b);
- /* don't care about speed at the moment */
- e = -1;
- for (i = 0; i < sizeof (claimed)/sizeof (claimed[0]); i++) {
- if (cp[i].ofm_end == 0) {
- if (e == -1) {
- e = i;
- }
- continue;
- }
- if (virt >= cp[i].ofm_start && virt < cp[i].ofm_end) {
- return OF_FAILURE;
- }
- if (end >= cp[i].ofm_start && end < cp[i].ofm_end) {
- return OF_FAILURE;
- }
- }
- /* e points to the first empty */
- cp[e].ofm_start = virt;
- cp[e].ofm_end = end;
- *baseaddr = virt;
- return OF_SUCCESS;
-}
-
-s32
-ofh_claim(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 3) {
- if (nrets == 1) {
- u32 virt = argp[0];
- u32 size = argp[1];
- u32 align = argp[2];
- s32 *baseaddr = &retp[0];
-
- return claim(b, virt, size, align, baseaddr);
- }
- }
- return OF_FAILURE;
-}
-
-static s32
-release(ulong b, u32 virt, u32 size)
-{
- struct of_malloc_s *cp;
- u32 i;
- u32 end;
-
- end = virt + size;
-
- /* you cannot release OF's own space */
- if (virt >= (u32)ofh_start && end < (u32)_end) {
- return OF_FAILURE;
- }
-
- cp = DRELA(&claimed[0], b);
- /* don't care about speed at the moment */
- for (i = 0; i < sizeof (claimed)/sizeof (claimed[0]); i++) {
- if (virt == cp[i].ofm_start && end == cp[i].ofm_end) {
- cp[i].ofm_start = 0;
- cp[i].ofm_end = 0;
- return OF_SUCCESS;
- }
- }
- return OF_FAILURE;
-}
-
-s32
-ofh_release(u32 nargs, u32 nrets, s32 argp[],
- s32 retp[] __attribute__ ((unused)),
- ulong b)
-{
- if (nargs == 2) {
- if (nrets == 0) {
- u32 virt = argp[0];
- u32 size = argp[1];
-
- return release(b, virt, size);
- }
- }
- return OF_FAILURE;
-}
diff --git a/xen/arch/powerpc/of_handler/memset.c b/xen/arch/powerpc/of_handler/memset.c
deleted file mode 100644
index addaf80c09..0000000000
--- a/xen/arch/powerpc/of_handler/memset.c
+++ /dev/null
@@ -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 (C) IBM Corp. 2005
- *
- * Authors: Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#include <xen/string.h>
-
-void *
-memset(void *s, int c, size_t n)
-{
- uint8_t *ss = (uint8_t *)s;
-
- if (n == 0) {
- return s;
- }
-
- /* yes, I pulled the 2 out of this air */
- if (n >= (2 * sizeof (ulong))) {
- ulong val = 0;
- ulong i;
-
- /* construct val assignment from c */
- if (c != 0) {
- for (i = 0; i < sizeof (ulong); i++) {
- val = (val << 8) | c;
- }
- }
-
- /* do by character until aligned */
- while (((ulong)ss & (sizeof (ulong) - 1)) > 0) {
- *ss = c;
- ++ss;
- --n;
- }
-
- /* now do the aligned stores */
- while (n >= sizeof (ulong)) {
- *(ulong *)ss = val;
- ss += sizeof (ulong);
- n -= sizeof (ulong);
- }
- }
- /* do that last unaligned bit */
- while (n > 0) {
- *ss = c;
- ++ss;
- --n;
-
- }
-
- return s;
-}
diff --git a/xen/arch/powerpc/of_handler/ofh.c b/xen/arch/powerpc/of_handler/ofh.c
deleted file mode 100644
index 06d700eaa9..0000000000
--- a/xen/arch/powerpc/of_handler/ofh.c
+++ /dev/null
@@ -1,439 +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@watson.ibm.com>
- */
-
-#include "ofh.h"
-#include <stdarg.h>
-#include <xen/lib.h>
-
-/*
- * 6.3.1 Access to the client interface functions
- * This is the spec'd maximum
- */
-#define PFW_MAXSRVCLEN 31
-
-static u32 ofh_maxsrvclen;
-
-extern s32 debug(const char *fmt, ...);
-
-s32 debug(const char *fmt, ...)
-{
- s32 sz;
- va_list ap;
- char buf[512];
- va_start(ap, fmt);
- sz = vsnprintf(buf, 512, fmt, ap);
- va_end(ap);
- ofh_cons_write(buf, sz, &sz);
-
- return sz;
-}
-
-
-
-void
-assprint(const char *expr, const char *file, int line, const char *fmt, ...)
-{
- char a[15] = {
- '\n', '\n', 'O', 'F', 'H', ':', 'A', 'S', 'S', 'E', 'R', 'T', '!',
- '\n', '\n',
- };
- s32 actual;
- u32 t = 1;
- volatile u32 *tp = &t;
-
- ofh_cons_write(a, sizeof (a), &actual);
-
- /* maybe I can break out of this loop manually (like with a
- * debugger) */
- while (*tp) {
- continue;
- }
-}
-
-/*
- * we use elf hash since it is pretty standard
- */
-static u32
-of_hash(const char *s)
-{
- u32 hash = 0;
- u32 hnib;
-
- if (s != NULL) {
- while (*s != '\0') {
- hash = (hash << 4) + *s++;
- hnib = hash & 0xf0000000UL;
- if (hnib != 0) {
- hash ^= hnib >> 24;
- }
- hash &= ~hnib;
- }
- }
- return hash;
-}
-
-static void
-ofh_service_init(ulong b)
-{
- ulong sz;
- int i;
- int j = 0;
- struct ofh_srvc *o;
- struct ofh_srvc *ofs[] = {
- DRELA(&ofh_srvc[0], b),
- DRELA(&ofh_isa_srvc[0], b),
- NULL
- };
-
- j = 0;
- while (ofs[j] != NULL) {
- /* find the maximum string length for services */
- o = &ofs[j][0];
- while (o->ofs_name != NULL) {
- const char *n;
-
- n = DRELA(&o->ofs_name[0], b);
- /* fix it up so we don't have to fix it anymore */
- o->ofs_name = n;
-
- sz = strlen(n);
- if (sz > *DRELA(&ofh_maxsrvclen, b)) {
- *DRELA(&ofh_maxsrvclen, b) = sz;
- }
- o->ofs_hash =
- of_hash(n);
- ++i;
- ++o;
- }
- ++j;
- }
-}
-
-
-static void
-ofh_cpu_init(ofdn_t chosen, ulong b)
-{
- static struct ofh_ihandle _ih_cpu_0;
- void *mem = ofd_mem(b);
- u32 ih = DRELA((ulong)&_ih_cpu_0, b);
- struct ofh_ihandle *ihp = (struct ofh_ihandle *)((ulong)ih);
- const char *cpu_type = DRELA((const char*)"cpu",b);
-
- ofdn_t cpu = ofd_node_find_by_prop(mem, OFD_ROOT,
- DRELA((const char*)"device_type",b),
- cpu_type, 4);
- ihp->ofi_node = cpu;
- ofd_prop_add(mem, chosen, DRELA((const char *)"cpu", b),
- &ih, sizeof (ih));
-}
-static s32
-mmu_translate(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- /* FIXME: need a little more here */
- nargs = nargs;
- nrets = nrets;
- argp = argp;
- retp = retp;
- b = b;
- return OF_SUCCESS;
-}
-
-static void
-ofh_mmu_init(ofdn_t chosen, ulong b)
-{
- static struct ofh_methods _mmu_methods[] = {
- { "translate", mmu_translate },
- { NULL, NULL},
- };
- static struct ofh_ihandle _ih_mmu = {
- .ofi_methods = _mmu_methods,
- };
- void *mem = ofd_mem(b);
- u32 ih = DRELA((ulong)&_ih_mmu, b);
-
- ofd_prop_add(mem, chosen, DRELA((const char *)"mmu", b),
- &ih, sizeof (ih));
-}
-
-static void
-ofh_chosen_init(ulong b)
-{
- ofdn_t ph;
- void *mem = ofd_mem(b);
-
- ph = ofd_node_find(mem, DRELA((const char *)"/chosen", b));
-
- ofh_vty_init(ph, b);
- ofh_cpu_init(ph, b);
- ofh_mmu_init(ph, b);
-}
-
-static void
-ofh_options_init(ulong b)
-{
- void *mem = ofd_mem(b);
- ofdn_t options;
- u32 size = 1 << 20;
- u32 base = b;
- char buf[20];
- int i;
-
-
- /* fixup the ihandle */
- options = ofd_node_find(mem,
- DRELA((const char *)"options", b));
-
- i = snprintf(buf, sizeof (buf), "0x%x", base);
- ofd_prop_add(mem, options, DRELA((const char *)"real-base", b),
- buf, i);
-
- i = snprintf(buf,sizeof (buf), "0x%x", size);
- ofd_prop_add(mem, options, DRELA((const char *)"real-size", b),
- buf, i);
-}
-
-static void
-ofh_init(ulong b)
-{
- ulong sz = (ulong)_end - (ulong)__bss_start;
- /* clear bss */
- memset(__bss_start + b, 0, sz);
-
- ofh_service_init(b);
- ofh_chosen_init(b);
- ofh_rtas_init(b);
- ofh_options_init(b);
-}
-
-static ofh_func_t *
-ofh_lookup(const char *service, ulong b)
-{
- int j;
- u32 hash;
- struct ofh_srvc *o;
- struct ofh_srvc *ofs[] = {
- DRELA(&ofh_srvc[0], b),
- DRELA(&ofh_isa_srvc[0], b),
- NULL
- };
- u32 sz;
-
- sz = *DRELA(&ofh_maxsrvclen, b);
-
- if (strnlen(service, sz + 1) > sz) {
- return NULL;
- }
-
- hash = of_hash(service);
-
- j = 0;
- while (ofs[j] != NULL) {
- /* yes this could be quicker */
- o = &ofs[j][0];
- while (o->ofs_name != NULL) {
- if (o->ofs_hash == hash) {
- const char *n = o->ofs_name;
- if (strcmp(service, n) == 0) {
- return o->ofs_func;
- }
- }
- ++o;
- }
- ++j;
- }
- return NULL;
-}
-
-s32
-ofh_nosup(u32 nargs __attribute__ ((unused)),
- u32 nrets __attribute__ ((unused)),
- s32 argp[] __attribute__ ((unused)),
- s32 retp[] __attribute__ ((unused)),
- ulong b __attribute__ ((unused)))
-{
- return OF_FAILURE;
-}
-
-s32
-ofh_test_method(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 2) {
- if (nrets == 1) {
- s32 *ap = DRELA(&ofh_active_package, b);
- u32 service = (s32)argp[0];
- const char *method = (const char *)(ulong)argp[1];
- s32 *stat = &retp[0];
-
- (void)ap; (void)service; (void)method;
-
- *stat = 0;
- /* we do not do this yet */
- return OF_FAILURE;
- }
- }
- return OF_FAILURE;
-}
-extern u32 _ofh_inited[0];
-extern u32 _ofh_lastarg[0];
-
-s32
-ofh_handler(struct ofh_args *args, ulong b)
-{
- u32 *inited = (u32 *)DRELA(&_ofh_inited[0],b);
- u32 *lastarg = (u32 *)DRELA(&_ofh_lastarg[0],b);
- ofh_func_t *f;
-
- if (*inited == 0) {
- ofh_init(b);
-
- if ((ulong)ofd_mem(b) < (ulong)_end + b) {
- static const char msg[] = "PANIC: OFD and BSS collide\n";
- s32 dummy;
-
- ofh_cons_write(DRELA(&msg[0], b), sizeof (msg), &dummy);
- for (;;);
- }
-
- *inited = 1;
- }
-
- *lastarg = (ulong)args;
-
- f = ofh_lookup((char *)((ulong)args->ofa_service), b);
-
- if (f == ((ofh_func_t *)~0UL)) {
- /* do test */
- if (args->ofa_nargs == 1) {
- if (args->ofa_nreturns == 1) {
- char *name = (char *)(ulong)args->ofa_args[0];
- if (ofh_lookup(name, b) != NULL) {
- args->ofa_args[args->ofa_nargs] =
- OF_SUCCESS;
- return OF_SUCCESS;
- }
- }
- }
- return OF_FAILURE;
-
- } else if (f != NULL) {
- return leap(args->ofa_nargs,
- args->ofa_nreturns,
- args->ofa_args,
- &args->ofa_args[args->ofa_nargs],
- b, f);
- }
- return OF_FAILURE;
-}
-
-/*
- * The following code exists solely to run the handler code standalone
- */
-void
-__ofh_start(void)
-{
- s32 ret;
- u32 of_stdout;
- u32 ihandle;
- char buf[1024];
- u32 args_buf[sizeof (struct ofh_args) + (sizeof (u32) * 10)];
- struct ofh_args *args;
-
- args = (struct ofh_args *)args_buf;
-
- args->ofa_service = (u32)"finddevice";
- args->ofa_nargs = 1;
- args->ofa_nreturns = 1;
- args->ofa_args[0] = (u32)"/";
- args->ofa_args[1] = -1;
- ret = ofh_start(args);
-
- if (ret == OF_SUCCESS) {
- args->ofa_service = (u32)"finddevice";
- args->ofa_nargs = 1;
- args->ofa_nreturns = 1;
- args->ofa_args[0] = (u32)"/chosen";
- args->ofa_args[1] = -1;
- ret = ofh_start(args);
- }
-
- if (ret == OF_SUCCESS) {
- u32 phandle = args->ofa_args[1];
-
- args->ofa_service = (u32)"getprop";
- args->ofa_nargs = 4;
- args->ofa_nreturns = 1;
- args->ofa_args[0] = phandle;
- args->ofa_args[1] = (ulong)"stdout";
- args->ofa_args[2] = (ulong)&of_stdout;
- args->ofa_args[3] = sizeof(of_stdout);
- args->ofa_args[4] = -1;
- ret = ofh_start(args);
- }
-
- ihandle = *(u32 *)((ulong)args->ofa_args[2]);
-
- if (ret == OF_SUCCESS) {
- /* instance to path */
- args->ofa_service = (u32)"instance-to-path";
- args->ofa_nargs = 3;
- args->ofa_nreturns = 1;
- args->ofa_args[0] = ihandle;
- args->ofa_args[1] = (ulong)buf;
- args->ofa_args[2] = sizeof (buf);
- args->ofa_args[3] = -1;
- ret = ofh_start(args);
-
- }
-
- if (ret == OF_SUCCESS) {
- /* open rtas */
- args->ofa_service = (u32)"open";
- args->ofa_nargs = 1;
- args->ofa_nreturns = 1;
- args->ofa_args[0] = (u32)"/rtas";
- ret = ofh_start(args);
- if (ret == OF_SUCCESS) {
- u32 ir = args->ofa_args[1];
- args->ofa_service = (u32)"call-method";
- args->ofa_nargs = 3;
- args->ofa_nreturns = 2;
- args->ofa_args[0] = (ulong)"instantiate-rtas";
- args->ofa_args[1] = ir;
- args->ofa_args[2] = (ulong)buf;
-
- ret = ofh_start(args);
- }
- }
-
- if (ret == OF_SUCCESS) {
- const char msg[] = "This is a test";
- u32 msgsz = sizeof(msg) - 1; /* Includes \0 */
-
- args->ofa_service = (u32)"write";
- args->ofa_nargs = 3;
- args->ofa_nreturns = 1;
- args->ofa_args[0] = ihandle;
- args->ofa_args[1] = (ulong)msg;
- args->ofa_args[2] = msgsz;
- args->ofa_args[3] = -1;
- ret = ofh_start(args);
- }
-
-}
diff --git a/xen/arch/powerpc/of_handler/ofh.h b/xen/arch/powerpc/of_handler/ofh.h
deleted file mode 100644
index 1aab134d6d..0000000000
--- a/xen/arch/powerpc/of_handler/ofh.h
+++ /dev/null
@@ -1,164 +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@watson.ibm.com>
- */
-
-#ifndef _PFW_H
-#define _PFW_H
-
-#include <xen/types.h>
-#include <public/xencomm.h>
-#include <public/io/console.h>
-#include <of-devtree.h>
-
-#define MIN(x,y) (((x)<(y))?(x):(y))
-
-#define PAGE_SHIFT 12
-#define PAGE_SIZE (1UL<<PAGE_SHIFT)
-
-struct ofh_args {
- u32 ofa_service;
- u32 ofa_nargs;
- u32 ofa_nreturns;
- s32 ofa_args[0];
-};
-
-typedef s32 (ofh_func_t)(u32, u32, s32 [], s32 [], ulong b);
-
-struct ofh_srvc {
- const char *ofs_name;
- ofh_func_t *ofs_func;
- u32 ofs_hash;
-};
-
-extern ofh_func_t ofh_test_method;
-extern ofh_func_t ofh_nosup;
-
-/* device tree */
-extern ofh_func_t ofh_peer;
-extern ofh_func_t ofh_child;
-extern ofh_func_t ofh_parent;
-extern ofh_func_t ofh_instance_to_package;
-extern ofh_func_t ofh_getproplen;
-extern ofh_func_t ofh_getprop;
-extern ofh_func_t ofh_nextprop;
-extern ofh_func_t ofh_setprop;
-extern ofh_func_t ofh_canon;
-extern ofh_func_t ofh_finddevice;
-extern ofh_func_t ofh_instance_to_path;
-extern ofh_func_t ofh_package_to_path;
-extern ofh_func_t ofh_call_method;
-
-/* IO */
-extern ofh_func_t ofh_open;
-extern ofh_func_t ofh_close;
-extern ofh_func_t ofh_read;
-extern ofh_func_t ofh_write;
-extern ofh_func_t ofh_seek;
-
-/* memory */
-extern ofh_func_t ofh_claim;
-extern ofh_func_t ofh_release;
-
-/* control */
-extern ofh_func_t ofh_boot;
-extern ofh_func_t ofh_enter;
-extern ofh_func_t ofh_exit; /* __attribute__ ((noreturn)); */
-extern ofh_func_t ofh_chain;
-extern ofh_func_t ofh_quiesce;
-
-extern struct ofh_srvc ofh_srvc[];
-extern struct ofh_srvc ofh_isa_srvc[];
-extern s32 ofh_active_package;
-
-struct ofh_methods {
- const char *ofm_name;
- ofh_func_t *ofm_method;
-};
-
-struct ofh_ihandle {
- s32 (*ofi_close)(void);
- s32 (*ofi_read)(s32 chan, void *buf, u32 count, s32 *actual, ulong b);
- s32 (*ofi_write)(s32 chan, const void *buf, u32 count, s32 *actual,
- ulong b);
- s32 (*ofi_seek)(u32 pos_hi, u32 pos_lo, u32 *status);
- struct ofh_methods *ofi_methods;
- struct xencons_interface *ofi_intf;
- s32 ofi_node;
- s32 ofi_chan;
-};
-
-struct ofh_imem {
- s32 (*ofi_xlate)(void *addr, u32 ret[4]);
-};
-
-
-enum prop_type {
- pt_byte_array,
- pt_value,
- pt_string,
- pt_composite,
- /* these are for our own use */
- pt_func,
-};
-
-extern s32 ofh_start(struct ofh_args *);
-
-#define OFH_CONS_XEN -1
-extern void ofh_cons_init(struct ofh_ihandle *ihp, ulong b);
-extern s32 ofh_cons_read(s32 chan, void *buf, u32 count, s32 *actual);
-extern s32 ofh_cons_write(const void *buf, u32 count, s32 *actual);
-extern s32 ofh_cons_close(void);
-extern s32 ofh_handler(struct ofh_args *args, ulong ifh_base);
-extern s32 leap(u32 nargs, u32 nrets, s32 args[], s32 rets[],
- ulong ba, void *f);
-
-extern s32 io_leap(s32 chan, void *buf, u32 sz, s32 *actual,
- ulong ba, void *f);
-
-extern void ofh_vty_init(ofdn_t chosen, ulong b);
-extern void ofh_rtas_init(ulong b);
-
-extern void *_ofh_tree;
-
-#if 1
-#define DRELA(p,b) ((__typeof__ (p))((((ulong)(p)) + (b))))
-#else
-#define DRELA(p,b) (b == b ? p : 0)
-#endif
-extern ulong get_base(void);
-
-static inline void *ofd_mem(ulong base) { return *DRELA(&_ofh_tree, base); }
-
-extern ofh_func_t ofh_start_cpu;
-extern ofh_func_t ofh_stop_self;
-extern ofh_func_t ofh_idle_self;
-extern ofh_func_t ofh_resume_cpu;
-
-/* In Open Firmware, we only use xencomm for reading/writing console data.
- * Since that's always small, we can use this fixed-size structure. */
-#define XENCOMM_MINI_ADDRS 3
-struct xencomm_mini {
- struct xencomm_desc _desc;
- u64 address[XENCOMM_MINI_ADDRS];
-};
-
-extern int xencomm_create_mini(void *area, int arealen, void *buffer,
- unsigned long bytes, struct xencomm_desc **ret);
-
-#endif
diff --git a/xen/arch/powerpc/of_handler/papr.S b/xen/arch/powerpc/of_handler/papr.S
deleted file mode 100644
index 9f979f0da3..0000000000
--- a/xen/arch/powerpc/of_handler/papr.S
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2005 Jimi Xenidis <jimix@watson.ibm.com>, 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/processor.h>
-#include <asm/papr.h>
-#include <asm/asm-offsets.h>
-
-#define HSC .long 0x44000022
-
-
-/* in is unsused */
-#define PAPR(in, out, name, func_code) \
- _GLOBAL(name); \
- std r3,-GPR_WIDTH(r1); \
- li r3,func_code; \
- HSC; \
- ld r12,-GPR_WIDTH(r1); \
- cmpi 0,r12,0; \
- bne ret ## out; /* only store regs if r12 != NULL */ \
- b ret0
-
-ret8: std r11, 7 * GPR_WIDTH(r12)
-ret7: std r10, 6 * GPR_WIDTH(r12)
-ret6: std r9, 5 * GPR_WIDTH(r12)
-ret5: std r8, 4 * GPR_WIDTH(r12)
-ret4: std r7, 3 * GPR_WIDTH(r12)
-ret3: std r6, 2 * GPR_WIDTH(r12)
-ret2: std r5, 1 * GPR_WIDTH(r12)
-ret1: std r4, 0 * GPR_WIDTH(r12)
- nop
-ret0: blr
-
-PAPR(5, 2,papr_remove, H_REMOVE)
-PAPR(5, 1,papr_clear_mod, H_CLEAR_MOD)
-PAPR(5, 1,papr_clear_ref, H_CLEAR_REF)
-PAPR(5, 0,papr_protect, H_PROTECT)
-PAPR(1, 0,papr_eoi, H_EOI)
-PAPR(5, 1,papr_cppr, H_CPPR)
-PAPR(5, 2,papr_ipi, H_IPI)
-PAPR(5, 1,papr_ipoll, H_IPOLL)
-PAPR(5, 1,papr_xirr, H_XIRR)
-PAPR(2, 0,papr_interrupt, H_INTERRUPT)
-PAPR(5, 1,papr_logical_ci_load_64, H_LOGICAL_CI_LOAD)
-PAPR(5, 0,papr_logical_ci_store_64, H_LOGICAL_CI_STORE)
-PAPR(5, 1,papr_logical_cache_load_64, H_LOGICAL_CACHE_LOAD)
-PAPR(5, 0,papr_logical_cache_store_64, H_LOGICAL_CACHE_STORE)
-PAPR(5, 0,papr_logical_icbi, H_LOGICAL_ICBI)
-PAPR(5, 0,papr_logical_dcbf, H_LOGICAL_DCBF)
-PAPR(5, 1,papr_set_dabr, H_SET_DABR)
-PAPR(5, 1,papr_real_to_logical, H_REAL_TO_LOGICAL)
-PAPR(5, 1,papr_pci_config_read, H_PCI_CONFIG_READ)
-PAPR(5, 0,papr_pci_config_write, H_PCI_CONFIG_WRITE)
-
-PAPR(5, 1,papr_grant_logical, H_GRANT_LOGICAL)
-PAPR(1, 1,papr_accept_logical, H_ACCEPT_LOGICAL)
-PAPR(0, 2,papr_rescind_logical, H_RESCIND_LOGICAL)
-PAPR(3, 0,papr_register_vterm, H_REGISTER_VTERM)
-PAPR(4, 0,papr_vterm_partner_info, H_VTERM_PARTNER_INFO)
-PAPR(1, 0,papr_free_vterm, H_FREE_VTERM)
-
-/* Definitions for hypervisor functions. Note that we do not use the
- * first macro arg */
-
-PAPR(x, 1,papr_enter, H_ENTER)
-PAPR(x, 8,papr_read, H_READ)
-PAPR(x, 1,papr_thread_control, H_THREAD_CONTROL)
-PAPR(x, 0,papr_cede, H_CEDE)
-
-PAPR(x, 0,papr_page_init, H_PAGE_INIT)
-PAPR(x, 1,papr_set_asr, H_SET_ASR) /* ISTAR only. */
-PAPR(x, 0,papr_asr_on, H_ASR_ON) /* ISTAR only. */
-PAPR(x, 0,papr_asr_off, H_ASR_OFF) /* ISTAR only. */
-
-PAPR(x, 8,papr_hypervisor_data, H_HYPERVISOR_DATA)
-
-PAPR(x, 2,papr_get_xive, H_GET_XIVE)
-PAPR(x, 0,papr_set_xive, H_SET_XIVE)
-
-
-PAPR(x, 0,papr_put_term_char, H_PUT_TERM_CHAR)
-PAPR(x, 3,papr_get_term_char, H_GET_TERM_CHAR)
diff --git a/xen/arch/powerpc/of_handler/papr.h b/xen/arch/powerpc/of_handler/papr.h
deleted file mode 100644
index 19e4478efd..0000000000
--- a/xen/arch/powerpc/of_handler/papr.h
+++ /dev/null
@@ -1,69 +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@watson.ibm.com>
- */
-
-#ifndef _OFH_PAPR_H
-#define _OFH_PAPR_H
-
-#include <asm/papr.h>
-
-#ifndef __ASSEMBLY__
-
-extern long papr_enter(ulong *retvals, ulong flags, ulong idx, ...);
-extern long papr_read(ulong *retvals, ulong flags, ulong idx);
-extern long papr_remove(ulong *retvals, ulong flags, ulong pte_index,
- ulong avpn);
-extern long papr_clear_mod(ulong *retvals, ulong flags, ulong pte_index);
-extern long papr_clear_ref(ulong *retvals, ulong flags, ulong pte_index);
-extern long papr_protect(ulong *retvals, ulong flags, ulong pte_index,
- ulong avpn);
-extern long papr_get_term_char(ulong *retvals, ulong idx);
-extern long papr_put_term_char(ulong *retvals, ulong idx, ulong count, ...);
-extern long papr_register_vterm(ulong *retvals, ulong ua, ulong plpid, ulong pua);
-extern long papr_vterm_partner_info(ulong *retvals, ulong ua, ulong plpid,
- ulong pua, ulong lpage);
-extern long papr_free_vterm(ulong *retvals, ulong uaddr);
-
-extern long papr_cede(ulong *retvals);
-extern long papr_page_init(ulong *retvals, ulong flags,
- ulong destination, ulong source);
-extern long papr_set_asr(ulong *retvals, ulong value); /* ISTAR only. */
-extern long papr_asr_on(ulong *retvals); /* ISTAR only. */
-extern long papr_asr_off(ulong *retvals); /* ISTAR only. */
-extern long papr_eoi(ulong *retvals, ulong xirr);
-extern long papr_cppr(ulong *retvals, ulong cppr);
-extern long papr_ipi(ulong *retvals, ulong sn, ulong mfrr);
-extern long papr_ipoll(ulong *retvals, ulong sn);
-extern long papr_xirr(ulong *retvals);
-extern long papr_logical_ci_load_64(ulong *retvals, ulong size,
- ulong addrAndVal);
-extern long papr_logical_ci_store_64(ulong *retvals, ulong size,
- ulong addr, ulong value);
-extern long papr_logical_cache_load_64(ulong *retvals, ulong size,
- ulong addrAndVal);
-extern long papr_logical_cache_store_64(ulong *retvals, ulong size,
- ulong addr, ulong value);
-extern long papr_logical_icbi(ulong *retvals, ulong addr);
-extern long papr_logical_dcbf(ulong *retvals, ulong addr);
-extern long papr_set_dabr(ulong *retvals, ulong dabr);
-extern long papr_hypervisor_data(ulong *retvals, u64 control);
-extern long papr_real_to_logical(ulong *retvals, ulong raddr);
-
-#endif /* ! __ASSEMBLY__ */
-#endif /* ! _OFH_PAPR_H */
diff --git a/xen/arch/powerpc/of_handler/rtas.c b/xen/arch/powerpc/of_handler/rtas.c
deleted file mode 100644
index 4343d3c910..0000000000
--- a/xen/arch/powerpc/of_handler/rtas.c
+++ /dev/null
@@ -1,82 +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. 2007
- *
- * Authors: Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#include "ofh.h"
-#include <stdarg.h>
-#include <xen/lib.h>
-extern char _rtas_image_start[];
-extern char _rtas_image_end[];
-
-static int
-rtas_instantiate_rtas(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
-{
- if (nargs == 1) {
- if (nrets == 1) {
- void *rtas_base_address = (void *)(ulong)argp[0];
- u32 sz = (_rtas_image_end - _rtas_image_start);
-
- memcpy(rtas_base_address,
- DRELA(&_rtas_image_start[0], b), sz);
- retp[0] = (ulong)rtas_base_address;
-
- return OF_SUCCESS;
- }
- }
- return OF_FAILURE;
-}
-
-
-static struct ofh_methods _rtas_methods[] = {
- { "instantiate-rtas", rtas_instantiate_rtas },
- { NULL, NULL},
-};
-
-static struct ofh_ihandle _ih_rtas = {
- .ofi_methods = _rtas_methods,
-};
-
-static int rtas_open(u32 b)
-{
- u32 ih = DRELA((u32)&_ih_rtas, b);
-
- return ih;
-}
-
-void ofh_rtas_init(ulong b)
-{
- static const char path[] = "/rtas";
- ofdn_t n;
- void *m = ofd_mem(b);
- u32 sz;
-
- n = ofd_node_find(m, DRELA(&path[0], b));
- if (n <= 0)
- return;
-
- sz = (_rtas_image_end - _rtas_image_start);
- /* Round size up to a multiple of 0x1000 */
- sz = ALIGN_UP(sz, PAGE_SIZE);
-
- ofd_prop_add(m, n, DRELA((const char *)"rtas-size", b),
- &sz, sizeof(sz));
-
- /* create an IO node */
- ofd_io_create(m, n, (ulong)rtas_open);
-}
diff --git a/xen/arch/powerpc/of_handler/services.c b/xen/arch/powerpc/of_handler/services.c
deleted file mode 100644
index 068d08c8e6..0000000000
--- a/xen/arch/powerpc/of_handler/services.c
+++ /dev/null
@@ -1,96 +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@watson.ibm.com>
- */
-
-#include "ofh.h"
-
-/*
- * These are ISA independent OF services
- */
-
-struct ofh_srvc ofh_srvc[] = {
- /* Document Section 6.3.2.1 Client Interface */
- { .ofs_name = "test", .ofs_func = ((ofh_func_t *)~0UL) },
- { .ofs_name = "test-method", .ofs_func = ofh_test_method },
-
- /* Document Section 6.3.2.2 Device Tree */
- { .ofs_name = "peer", .ofs_func = ofh_peer },
- { .ofs_name = "child", .ofs_func = ofh_child },
- { .ofs_name = "parent", .ofs_func = ofh_parent },
- { .ofs_name = "instance-to-package",
- .ofs_func = ofh_instance_to_package },
- { .ofs_name = "getproplen", .ofs_func = ofh_getproplen },
- { .ofs_name = "getprop", .ofs_func = ofh_getprop },
- { .ofs_name = "nextprop", .ofs_func = ofh_nextprop },
- { .ofs_name = "setprop", .ofs_func = ofh_setprop },
- { .ofs_name = "canon", .ofs_func = ofh_canon },
- { .ofs_name = "finddevice", .ofs_func = ofh_finddevice },
- { .ofs_name = "instance-to-path", .ofs_func = ofh_instance_to_path },
- { .ofs_name = "package-to-path", .ofs_func = ofh_package_to_path },
- { .ofs_name = "call-method", .ofs_func = ofh_call_method },
-
- /* Document Section 6.3.2.3 Device I/O */
- { .ofs_name = "open", .ofs_func = ofh_open },
- { .ofs_name = "close", .ofs_func = ofh_close },
- { .ofs_name = "read", .ofs_func = ofh_read },
- { .ofs_name = "write", .ofs_func = ofh_write },
- { .ofs_name = "seek", .ofs_func = ofh_seek },
-
- /* Document Section 6.3.2.4 Memory */
- { .ofs_name = "claim", .ofs_func = ofh_claim },
- { .ofs_name = "release", .ofs_func = ofh_release },
-
- /* Document Section 6.3.2.5 Control Transfer */
- { .ofs_name = "boot", .ofs_func = ofh_boot },
- { .ofs_name = "enter", .ofs_func = ofh_enter },
- { .ofs_name = "exit", .ofs_func = ofh_exit },
- { .ofs_name = "chain", .ofs_func = ofh_chain },
- { .ofs_name = "quiesce", .ofs_func = ofh_quiesce },
-
- /* Document Section 6.3.2.6 User Interface */
- { .ofs_name = "interpret", .ofs_func = ofh_nosup },
- { .ofs_name = "set-callback", .ofs_func = ofh_nosup },
- { .ofs_name = "set-symbol-lookup", .ofs_func = ofh_nosup },
-
- /* Document Section 6.3.2.7 Time */
- { .ofs_name = "milliseconds", .ofs_func = ofh_nosup },
- { .ofs_name = NULL, .ofs_func = NULL}
-};
-
-/*
- * These are services particular to poweprc 32/64
- */
-
-struct ofh_srvc ofh_isa_srvc[] = {
- /* Document Section 8.5.1 Real-Mode physical memory ... */
- { .ofs_name = "alloc-real_mem", .ofs_func = ofh_nosup },
-
- /* Document Section 8.5.2 Virtual address translation ... */
- { .ofs_name = "map", .ofs_func = ofh_nosup },
- { .ofs_name = "unmap", .ofs_func = ofh_nosup },
- { .ofs_name = "translate", .ofs_func = ofh_nosup },
-
- /* Document Section 11.3 Client Interface Services */
- { .ofs_name = "start-cpu", .ofs_func = ofh_start_cpu },
- { .ofs_name = "stop-self", .ofs_func = ofh_stop_self },
- { .ofs_name = "idle-self", .ofs_func = ofh_idle_self },
- { .ofs_name = "resume-cpu", .ofs_func = ofh_resume_cpu },
- { .ofs_name = NULL, .ofs_func = NULL}
-};
-
diff --git a/xen/arch/powerpc/of_handler/snprintf.c b/xen/arch/powerpc/of_handler/snprintf.c
deleted file mode 100644
index 2f3bee5602..0000000000
--- a/xen/arch/powerpc/of_handler/snprintf.c
+++ /dev/null
@@ -1,332 +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@watson.ibm.com>
- */
-
-#include <xen/types.h>
-#include <stdarg.h>
-
-#define UPPER 0x00001
-#define SIGNED 0x00010
-#define ZERO 0x00100
-#define PTR 0x01000
-
-#define NUMBUFSZ 24 /* fits a 64bit value formatted in octal */
-
-/* do we need to handle 128 bits? */
-static ulong
-digits(char *buf, uint64_t val, ulong radix, ulong width, ulong flgs)
-{
- const char hex[] = "0123456789abcdefx";
- const char Hex[] = "0123456789ABCDEFX";
- const char *dig;
- char *b = buf;
- char num[NUMBUFSZ];
- ulong i;
-
- if (radix == 0 || radix > 16) {
- radix = 16;
- }
-
- if (flgs & UPPER) {
- dig = Hex;
- } else {
- dig = hex;
- }
-
- /* sign */
- if (flgs & SIGNED && radix == 10) {
- /* there are corner cases here, for sure */
- if ((int64_t)val < 0) {
- *b++ = '-';
- val *= -1;
- }
- }
-
- /* ptr */
- if (flgs & PTR && radix == 16) {
- *b++ = '0';
- *b++ = dig[16];
- }
-
- /* put it in t backwards */
- i = 0;
- if (val == 0) {
- num[i++] = '0';
- } else {
- while (val > 0) {
- num[i++] = dig[val % radix];
- val /= radix;
- }
- }
-
- /* pad */
- if (flgs & ZERO && width > i) {
- while (width-- > i) {
- *b++ = '0';
- }
- }
-
- /* number */
- while (i-- > 0) {
- *b++ = num[i];
- }
-
- return (b - buf);
-}
-
-/*
- * yeah, I dislike goto's too, but ...
- */
-int
-vsnprintf(char *buf, size_t size, const char *fmt, va_list ap)
-{
- int c;
- int nullify;
- ulong used = 0;
- ulong sz;
- unsigned ells;
- ulong flgs;
- const char *str;
- uint64_t val = 0;
- ulong radix;
- ulong width;
- char num[NUMBUFSZ];
-
- /* there must always be a trailing null */
- if (size == 0) {
- /* but don't write anything is size is zero */
- nullify = 0;
- } else {
- --size;
- nullify = 1;
- }
-
- while ((c = *fmt++) != '\0') {
- if (c != '%') {
- if (used++ < size) {
- *buf++ = c;
- }
- continue;
- }
- /* deal with format */
- ells = 0;
- flgs = 0;
-
- /* check for a given width */
- width = 0;
-
- c = *fmt;
- if (c >= '0' && c <= '9') {
- flgs |= ZERO;
- ++fmt;
- while (c >= '0' && c <= '9') {
- width = (width * 10) + (c - '0');
- c = *fmt++;
- }
- --fmt;
- }
-
-loop:
- c = *fmt++;
- switch (c) {
- case 'l':
- ++ells;
- goto loop;
- /*NOTREACHED*/
- break;
-
- case 'h': /* support linux kernel 'h' for short */
- ells = 0;
- goto loop;
- /*NOTREACHED*/
- break;
-
- case 'L': /* support linux kernel 'L' for long long */
- ells = 2;
- goto loop;
- /*NOTREACHED*/
- break;
-
- case 'Z': /* support linux kernel 'Z' for [s]size_t */
- /* I think it is safe to assume that 'long'
- * just gets it right but, the compiler should
- * do the right thing here anyway */
- if (sizeof (size_t) > sizeof (unsigned)) {
- ells = 1;
- }
- goto loop;
- /*NOTREACHED*/
- break;
- case 's':
- str = va_arg(ap, char *);
- if (str == NULL) {
- str = "(nil)";
- }
-
- /* copy over only what fits */
- sz = 0;
- while (*str != '\0') {
- c = *str++;
- if (used++ < size) {
- *buf++ = c;
- }
- }
- break;
- case 'c':
- c = (char)va_arg(ap, int);
- /*FALLTHRU*/
- case '%':
- if (used++ < size) {
- *buf++ = c;
- }
- break;
-
- case 'n':
- /* totally untested */
- switch (ells) {
- case 0: {
- unsigned *pval = va_arg(ap, unsigned *);
- *pval = used;
- }
- break;
- case 1: {
- unsigned long *pval;
- pval = va_arg(ap, unsigned long *);
- *pval = used;
- }
- break;
- default: {
- unsigned long long *pval;
- pval = va_arg(ap, unsigned long long *);
- *pval = used;
- }
- break;
- }
-
- break;
- case 'p':
- flgs |= (PTR | ZERO);
- radix = 16;
- val = (unsigned long) va_arg(ap, void *);
- /* pad to max type by default */
- if (sizeof (long) == sizeof (long long)) {
- width = 16;
- } else {
- width = 8;
- }
- goto print_value;
-
- case 'd': case 'i':
- flgs |= SIGNED;
- radix = 10;
- switch (ells) {
- case 0:
- val = va_arg(ap, int);
- break;
- case 1:
- val = va_arg(ap, long);
- break;
- default:
- val = va_arg(ap, long long);
- break;
- }
- goto print_value;
-
- case 'u':
- radix = 10;
- goto print_ulongue;
- break;
-
- case 'o':
- radix = 8;
- goto print_ulongue;
- break;
-
- case 'X':
- flgs |= UPPER;
- /*FALLTHRU*/
- case 'x':
- radix = 16;
-print_ulongue:
- switch (ells) {
- case 0:
- val = va_arg(ap, unsigned);
- break;
- case 1:
- val = va_arg(ap, unsigned long);
- break;
- default:
- val = va_arg(ap, unsigned long long);
- break;
- }
-
-print_value:
- /* get the number */
- sz = digits(num, val, radix, width, flgs);
-
- str = num;
- while (sz-- > 0) {
- c = *str++;
- if (used++ < size) {
- *buf++ = c;
- }
- }
- break;
-
-
- default:
- break;
- }
- }
- if (nullify) {
- /* stuff a nul char but don't include it in return */
- *buf++ = '\0';
- }
- return used;
-}
-
-int
-snprintf(char *buf, size_t size, const char *fmt, ...)
-{
- va_list ap;
- signed int ret;
-
- va_start(ap, fmt);
- ret = vsnprintf(buf, size, fmt, ap);
- va_end(ap);
- return ret;
-}
-
-int
-vsprintf(char *buf, const char *fmt, va_list ap)
-{
- return vsnprintf(buf, ~0UL, fmt, ap);
-}
-
-int
-sprintf(char *buf, const char *fmt, ...)
-{
- va_list ap;
- signed int ret;
-
- va_start(ap, fmt);
- ret = vsprintf(buf, fmt, ap);
- va_end(ap);
- return ret;
-}
diff --git a/xen/arch/powerpc/of_handler/strcmp.c b/xen/arch/powerpc/of_handler/strcmp.c
deleted file mode 100644
index 5125dc7636..0000000000
--- a/xen/arch/powerpc/of_handler/strcmp.c
+++ /dev/null
@@ -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@watson.ibm.com>
- */
-
-#include <xen/string.h>
-
-int
-strcmp(const char *s1, const char *s2)
-{
- while (*s1 == *s2) {
- /* characters are equal; if we are at the end, return EQUAL */
- if (*s1 == '\0') {
- return(0);
- }
- /* advance pointers to next character */
- s1++;
- s2++;
- }
- return(*s1 - *s2);
-}
diff --git a/xen/arch/powerpc/of_handler/strlcpy.c b/xen/arch/powerpc/of_handler/strlcpy.c
deleted file mode 100644
index 02f33e8d62..0000000000
--- a/xen/arch/powerpc/of_handler/strlcpy.c
+++ /dev/null
@@ -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 IBM Corp. 2005, 2007
- *
- * Authors: Jimi Xenidis <jimix@watson.ibm.com>
- * Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#include <xen/string.h>
-
-size_t
-strlcpy(char *dest, const char *src, size_t n)
-{
- size_t ret;
- char *dp;
-
- /* cases to consider:
- * dest is NULL, s is NULL;
- * src is empty (0);
- * src is not empty, less than n;
- * src is not empty, equal to n;
- * src is not empty, greater than n;
- */
-
- if (n <= 0) {
- return 0;
- }
-
- dp = dest;
-
- do {
- *dp++ = *src;
- --n;
- ++src;
- } while ((*src != '\0') && (n > 1));
-
- ret = n;
-
- /* clear remainder of buffer (if any); ANSI semantics */
- while (n > 0) {
- *dp++ = '\0';
- --n;
- }
- return ret;
-}
diff --git a/xen/arch/powerpc/of_handler/strlen.c b/xen/arch/powerpc/of_handler/strlen.c
deleted file mode 100644
index ca9b13fbaf..0000000000
--- a/xen/arch/powerpc/of_handler/strlen.c
+++ /dev/null
@@ -1,30 +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@watson.ibm.com>
- */
-
-#include <xen/string.h>
-
-size_t
-strlen(const char *s)
-{
- ulong i = 0;
- while (*s++ != '\0')
- i++;
- return i;
-}
diff --git a/xen/arch/powerpc/of_handler/strncmp.c b/xen/arch/powerpc/of_handler/strncmp.c
deleted file mode 100644
index 4d03374344..0000000000
--- a/xen/arch/powerpc/of_handler/strncmp.c
+++ /dev/null
@@ -1,39 +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@watson.ibm.com>
- */
-
-#include <xen/string.h>
-
-int
-strncmp(const char *s1, const char *s2, size_t n)
-{
- while (n > 0) {
- if (*s1 != *s2) {
- return (*s1 - *s2);
- }
- if (*s1 == '\0') {
- return (0);
- }
- /* advance pointers to next character */
- ++s1;
- ++s2;
- --n;
- }
- return 0;
-}
diff --git a/xen/arch/powerpc/of_handler/strnlen.c b/xen/arch/powerpc/of_handler/strnlen.c
deleted file mode 100644
index 828f4d084f..0000000000
--- a/xen/arch/powerpc/of_handler/strnlen.c
+++ /dev/null
@@ -1,30 +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@watson.ibm.com>
- */
-
-#include <xen/string.h>
-
-size_t
-strnlen(const char *s, size_t maxlen)
-{
- ulong i = 0;
- while (*s++ != '\0' && i < maxlen)
- i++;
- return i;
-}
diff --git a/xen/arch/powerpc/of_handler/vdevice.c b/xen/arch/powerpc/of_handler/vdevice.c
deleted file mode 100644
index 8b71014072..0000000000
--- a/xen/arch/powerpc/of_handler/vdevice.c
+++ /dev/null
@@ -1,74 +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@watson.ibm.com>
- */
-
-#include "ofh.h"
-
-static struct ofh_ihandle _ih_cons;
-
-void
-ofh_vty_init(ofdn_t chosen, ulong b)
-{
- void *mem = ofd_mem(b);
- u32 ih = DRELA((u32)&_ih_cons, b);
- struct ofh_ihandle *ihp = (struct ofh_ihandle *)((ulong)ih);
- ofdn_t n = 0;
- s32 ret;
- u32 chan = OFH_CONS_XEN;
-
- ihp->ofi_intf = NULL;
-
- /* find the vty */
- n = ofd_node_find(mem,
- DRELA((const char *)"/vdevice/vty", b));
- if (n > 0) {
- /* PAPR VTERM */
- ret = ofd_getprop(mem, n, DRELA((const char *)"reg", b),
- &chan, sizeof (chan));
- if (ret != (s32)sizeof (chan)) {
- chan = 0;
- }
- } else {
- /* xen console */
- u32 addr;
-
- n = ofd_node_find(mem, DRELA((const char *)"/xen/console", b));
- if (n > 0) {
- ret = ofd_getprop(mem, n, DRELA((const char *)"reg", b),
- &addr, sizeof (addr));
- if (addr == 0) {
- ihp->ofi_intf = NULL;
- } else {
- ihp->ofi_intf = (struct xencons_interface *)(ulong)addr;
- }
- }
- }
- if (n > 0) {
- ihp->ofi_node = n;
- }
- ihp->ofi_chan = chan;
- ofh_cons_init(ihp, b);
-
- ofd_prop_add(mem, chosen, DRELA((const char *)"stdout", b),
- &ih, sizeof (ih));
- ofd_prop_add(mem, chosen, DRELA((const char *)"stdin", b),
- &ih, sizeof (ih));
-}
-
-
diff --git a/xen/arch/powerpc/of_handler/xen_hvcall.S b/xen/arch/powerpc/of_handler/xen_hvcall.S
deleted file mode 100644
index 2d0a15acc9..0000000000
--- a/xen/arch/powerpc/of_handler/xen_hvcall.S
+++ /dev/null
@@ -1,44 +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, 2007
- *
- * Authors: Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#include <asm/config.h>
-#include <asm/processor.h>
-#include <asm/papr.h>
-#include <asm/asm-offsets.h>
-
-#define HSC .long 0x44000022
-
-_GLOBAL(xen_hvcall)
- HSC
- blr
-
-/* The following stub will get instantiated as RTAS in the guest */
-#define H_RTAS_PROXY 23
- .p2align 3
- .global _rtas_image_start
- .global _rtas_image_end
-_rtas_image_start:
- mr r4,r3
- lis r3,0xffff
- ori r3,r3,H_RTAS_PROXY
- HSC
- blr
- nop
-_rtas_image_end:
diff --git a/xen/arch/powerpc/of_handler/xencomm.c b/xen/arch/powerpc/of_handler/xencomm.c
deleted file mode 100644
index b82acbacf2..0000000000
--- a/xen/arch/powerpc/of_handler/xencomm.c
+++ /dev/null
@@ -1,84 +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@us.ibm.com>
- */
-
-#include "ofh.h"
-
-static int __xencomm_init(struct xencomm_desc *desc, void *buffer,
- unsigned long bytes)
-{
- int recorded = 0;
- int i = 0;
-
- /* record the physical pages used */
- while ((recorded < bytes) && (i < desc->nr_addrs)) {
- unsigned long paddr = (unsigned long)buffer + recorded;
- int offset;
- int chunksz;
-
- offset = (unsigned long)paddr % PAGE_SIZE; /* handle partial pages */
- chunksz = MIN(PAGE_SIZE - offset, (unsigned long)bytes - recorded);
-
- desc->address[i++] = paddr;
- recorded += chunksz;
- }
-
- if (recorded < bytes)
- return -1;
-
- desc->magic = XENCOMM_MAGIC;
-
- return 0;
-}
-
-static void *__xencomm_alloc_mini(void *area, int arealen)
-{
- unsigned long base = (unsigned long)area;
- unsigned int left_in_page;
-
- left_in_page = PAGE_SIZE - base % PAGE_SIZE;
-
- /* we probably fit right at the front of area */
- if (left_in_page >= sizeof(struct xencomm_mini)) {
- return area;
- }
-
- /* if not, see if area is big enough to advance to the next page */
- if ((arealen - left_in_page) >= sizeof(struct xencomm_mini))
- return (void *)(base + left_in_page);
-
- /* area was too small */
- return NULL;
-}
-
-/* allocate a xencomm_mini out of a preallocated memory area */
-int xencomm_create_mini(void *area, int arealen, void *buffer,
- unsigned long bytes, struct xencomm_desc **ret)
-{
- struct xencomm_desc *desc = __xencomm_alloc_mini(area, arealen);
- if (!desc)
- return -1;
-
- desc->nr_addrs = XENCOMM_MINI_ADDRS;
- if (__xencomm_init(desc, buffer, bytes))
- return -1;
-
- *ret = desc;
- return 0;
-}
diff --git a/xen/arch/powerpc/ofd_fixup.c b/xen/arch/powerpc/ofd_fixup.c
deleted file mode 100644
index b2432aade9..0000000000
--- a/xen/arch/powerpc/ofd_fixup.c
+++ /dev/null
@@ -1,428 +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@watson.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/lib.h>
-#include <xen/sched.h>
-#include <xen/version.h>
-#include <public/xen.h>
-#include "of-devtree.h"
-#include "oftree.h"
-#include "rtas.h"
-
-ofdn_t ofd_boot_cpu;
-
-#ifdef PAPR_VTERM
-static ofdn_t ofd_vdevice_vty(void *m, ofdn_t p, struct domain *d)
-{
- ofdn_t n;
- static const char pathfmt[] = "/vdevice/vty@%x";
- static const char name[] = "vty";
- static const char compatible[] = "hvterm1";
- static const char device_type[] = "serial";
- char path[sizeof (pathfmt) + 8 - 2];
- int client = 0;
-
- snprintf(path, sizeof (path), pathfmt, client);
- n = ofd_node_add(m, p, path, sizeof (path));
-
- if (n > 0) {
- u32 val32;
-
- val32 = client;
- ofd_prop_add(m, n, "name", name, sizeof (name));
- ofd_prop_add(m, n, "reg", &val32, sizeof (val32));
- ofd_prop_add(m, n, "compatible",
- compatible, sizeof (compatible));
- ofd_prop_add(m, n, "device_type",
- device_type, sizeof (device_type));
- }
-
- return n;
-}
-#endif
-
-#ifdef PAPR_VDEVICE
-static ofdn_t ofd_vdevice(void *m, struct domain *d)
-{
- ofdn_t n;
- static const char path[] = "/vdevice";
- static const char name[] = "vdevice";
- static const char compatible[] = "IBM,vdevice";
- u32 val;
-
- n = ofd_node_add(m, OFD_ROOT, path, sizeof (path));
-
- if (n > 0) {
-
- ofd_prop_add(m, n, "name", name, sizeof (name));
- val = 1;
- ofd_prop_add(m, n, "#address-cells", &val, sizeof (val));
- val = 0;
- ofd_prop_add(m, n, "#size-cells", &val, sizeof (val));
- ofd_prop_add(m, n, "compatible",
- compatible, sizeof (compatible));
- ofd_prop_add(m, n, "device_type", name, sizeof (name));
- ofd_prop_add(m, n, "interupt-controller", NULL, 0);
-
-#ifdef PAPR_VDEVICE
- ofdn_t r;
-
- /* add vty */
- r = ofd_vdevice_vty(m, n, d);
- printk("vdevice r: %x\n", r);
- n = r;
-#endif
- }
- return n;
-}
-#endif
-
-static ofdn_t ofd_openprom_props(void *m)
-{
- static const char path[] = "/openprom";
- static const char vernum[] = "IBM,XenOF0.1";
- ofdn_t n;
-
- n = ofd_node_find(m, path);
- if (n == 0) {
- n = ofd_node_add(m, OFD_ROOT, path, sizeof (path));
- ofd_prop_add(m, n, "name",
- &path[1], sizeof (path) - 1);
- }
- /* I want to override */
- ofd_prop_add(m, n, "model", vernum, sizeof(vernum));
- ofd_prop_add(m, n, "ibm,fw-vernum_encoded", vernum, sizeof(vernum));
- ofd_prop_add(m, n, "relative-addressing", NULL, 0);
- return n;
-
-}
-
-#ifdef PAPR_VTERM
-static ofdn_t ofd_aliases_props(void *m)
-{
- static const char path[] = "/aliases";
- static const char screen[] = "/vdevice/vty@0";
- ofdn_t n;
-
- n = ofd_node_find(m, path);
- if (n == 0) {
- n = ofd_node_add(m, OFD_ROOT, path, sizeof (path));
- ofd_prop_add(m, n, "name",
- &path[1], sizeof (path) - 1);
- }
- ofd_prop_add(m, n, "screen", screen, sizeof(screen));
- return n;
-}
-#endif
-
-static ofdn_t ofd_options_props(void *m)
-{
- static const char path[] = "/options";
- static const char boot[] = "true";
- ofdn_t n;
-
- n = ofd_node_find(m, path);
- if (n == 0) {
- n = ofd_node_add(m, OFD_ROOT, path, sizeof (path));
- ofd_prop_add(m, n, "name",
- &path[1], sizeof (path) - 1);
- }
- ofd_prop_add(m, n, "auto-boot?", boot, sizeof(boot));
- return n;
-}
-
-static ofdn_t ofd_cpus_props(void *m, struct domain *d)
-{
- static const char path[] = "/cpus";
- static const char cpu[] = "cpu";
- u32 val = 1;
- ofdn_t n;
- ofdn_t c;
- static u32 ibm_pft_size[] = { 0x0, 0x0 };
-
- n = ofd_node_find(m, path);
- if (n == 0) {
- n = ofd_node_add(m, OFD_ROOT, path, sizeof (path));
- ofd_prop_add(m, n, "name",
- &path[1], sizeof (path) - 1);
- }
- ofd_prop_add(m, n, "#address-cells", &val, sizeof(val));
- ofd_prop_add(m, n, "#size-cells", &val, sizeof(val));
- ofd_prop_add(m, n, "smp-enabled", NULL, 0);
-
-#ifdef HV_EXPOSE_PERFORMANCE_MONITOR
- ofd_prop_add(m, n, "performance-monitor", NULL, 0);
-#endif
-
- c = ofd_node_find_by_prop(m, n, "device_type", cpu, sizeof (cpu));
- if (ofd_boot_cpu == -1)
- ofd_boot_cpu = c;
- while (c > 0) {
- /* We do not use the OF tree to identify secondary processors
- * so we must prune them from the tree */
- if (c == ofd_boot_cpu) {
- ofdn_t p;
-
- ibm_pft_size[1] = d->arch.htab.log_num_ptes + LOG_PTE_SIZE;
- ofd_prop_add(m, c, "ibm,pft-size",
- ibm_pft_size, sizeof (ibm_pft_size));
-
- /* get rid of non-standard properties */
- p = ofd_prop_find(m, c, "cpu#");
- if (p > 0) {
- ofd_prop_remove(m, c, p);
- }
-
- /* FIXME: Check the the "l2-cache" property who's
- * contents is an orphaned phandle? */
- } else
- ofd_node_prune(m, c);
-
- c = ofd_node_find_next(m, c);
- }
-
- return n;
-}
-
-#ifdef ADD_XICS
-static ofdn_t ofd_xics_props(void *m)
-{
- ofdn_t n;
- static const char path[] = "/interrupt-controller";
- static const char compat[] = "IBM,ppc-xicp";
- static const char model[] = "IBM, BoaC, PowerPC-PIC, 00";
- static const char dtype[] =
- "PowerPC-External-Interrupt-Presentation";
- /*
- * I don't think these are used for anything but linux wants
- * it. I seems to describe some per processor location for
- * IPIs but that is a complete guess.
- */
- static const u32 reg[] = {
- 0x000003e0, 0x0f000000, 0x00000000, 0x00001000,
- 0x000003e0, 0x0f001000, 0x00000000, 0x00001000,
- 0x000003e0, 0x0f002000, 0x00000000, 0x00001000,
- 0x000003e0, 0x0f003000, 0x00000000, 0x00001000,
- 0x000003e0, 0x0f004000, 0x00000000, 0x00001000,
- 0x000003e0, 0x0f005000, 0x00000000, 0x00001000,
- 0x000003e0, 0x0f006000, 0x00000000, 0x00001000,
- 0x000003e0, 0x0f007000, 0x00000000, 0x00001000,
- 0x000003e0, 0x0f008000, 0x00000000, 0x00001000,
- 0x000003e0, 0x0f009000, 0x00000000, 0x00001000,
- 0x000003e0, 0x0f00a000, 0x00000000, 0x00001000,
- 0x000003e0, 0x0f00b000, 0x00000000, 0x00001000,
- 0x000003e0, 0x0f00c000, 0x00000000, 0x00001000,
- 0x000003e0, 0x0f00d000, 0x00000000, 0x00001000,
- 0x000003e0, 0x0f00e000, 0x00000000, 0x00001000,
- 0x000003e0, 0x0f00f000, 0x00000000, 0x00001000,
- };
-
- n = ofd_node_find(m, path);
- if (n == 0) {
- n = ofd_node_add(m, OFD_ROOT, path, sizeof (path));
- ofd_prop_add(m, n, "name",
- &path[1], sizeof (path) - 1);
- }
- ofd_prop_add(m, n, "built-in", NULL, 0);
- ofd_prop_add(m, n, "compatible", compat, sizeof(compat));
- ofd_prop_add(m, n, "device_type", dtype, sizeof(dtype));
- ofd_prop_add(m, n, "model", model, sizeof(model));
- ofd_prop_add(m, n, "reg", reg, sizeof(reg));
-
- return n;
-}
-#endif
-
-/*
- * Good things you can stick here:
- * init=/bin/bash ip=dhcp root=/dev/hda2 ide=nodma
- */
-static char default_bootargs[] = "";
-
-static ofdn_t ofd_chosen_props(void *m, const char *cmdline)
-{
- ofdn_t n;
- ofdn_t p;
- static const char path[] = "/chosen";
- char bootargs[256] = { 0, };
- int bsz;
- int sz;
- int rm;
-
- n = ofd_node_find(m, path);
- if (n == 0) {
- n = ofd_node_add(m, OFD_ROOT, path, sizeof (path));
- ofd_prop_add(m, n, "name",
- &path[1], sizeof (path) - 1);
- }
-
- if (cmdline)
- strlcpy(bootargs, cmdline, sizeof(bootargs));
- bsz = strlen(bootargs) + 1;
- rm = sizeof (bootargs) - bsz;
-
- if (default_bootargs != NULL) {
- sz = strlen(default_bootargs);
- if (sz > rm) {
- panic("default_bootargs is too big: 0x%x > 0x%x\n",
- sz, rm);
- } else if (sz > 0) {
- memcpy(&bootargs[bsz - 1], default_bootargs, sz + 1);
- bsz += sz;
- rm -= sz;
- }
- }
-
- printk("DOM0 bootargs: %s\n", bootargs);
- ofd_prop_add(m, n, "bootargs", bootargs, bsz);
-
- ofd_prop_add(m, n, "bootpath", NULL, 0);
-
- printk("Remove /chosen/mmu, stub will replace\n");
- p = ofd_prop_find(m, n, "mmu");
- if (p > 0) {
- ofd_prop_remove(m, n, p);
- }
-
- return n;
-}
-
-static ofdn_t ofd_xen_props(void *m, struct domain *d, ulong shared_info)
-{
- ofdn_t n;
- static const char path[] = "/xen";
- static const char console[] = "/xen/console";
-
- n = ofd_node_add(m, OFD_ROOT, path, sizeof (path));
- if (n > 0) {
- char xen[256];
- int xl;
- u64 val[2];
- s32 dom_id;
-
- dom_id = d->domain_id;
-
- ofd_prop_add(m, n, "reg", &dom_id, sizeof (dom_id));
- ofd_prop_add(m, n, "name", &path[1], sizeof (path) - 1);
-
- xl = snprintf(xen, sizeof (xen), "Xen-%d.%d%s",
- xen_major_version(), xen_minor_version(), xen_extra_version());
- ASSERT(xl < sizeof (xen));
- ofd_prop_add(m, n, "version", xen, xl + 1);
-
- /* convert xen pointer to guest physical */
- val[0] = shared_info;
- val[1] = PAGE_SIZE;
- ofd_prop_add(m, n, "shared-info", val, sizeof (val));
-
- /* reserve PAGE_SIZE @ addr shared info */
- ofd_prop_add(m, n, "reserved", val, sizeof (val));
-
- /* flags |= SIF_PROVILEDGED; */
- ofd_prop_add(m, n, "privileged", NULL, 0);
-
- /* flags |= SIF_INITDOMAIN; */
- ofd_prop_add(m, n, "initdomain", NULL, 0);
-
- /* tell dom0 that Xen depends on it to have power control */
- if (!rtas_entry)
- ofd_prop_add(m, n, "power-control", NULL, 0);
-
- /* tell dom0 where granted pages go in the linear map */
- val[0] = cpu_foreign_map_order();
- val[1] = d->arch.foreign_mfn_count;
- ofd_prop_add(m, n, "foreign-map", val, sizeof (val));
-
- n = ofd_node_add(m, n, console, sizeof (console));
- if (n > 0) {
- val[0] = 0;
- ofd_prop_add(m, n, "interrupts", &val[0], sizeof (val[0]));
- }
- }
- return n;
-}
-
-ulong ofd_dom0_fixup(struct domain *d, ulong mem, const char *cmdline,
- ulong shared_info)
-{
- const char compat[] = "Hypervisor,Maple";
- const char d0[] = "dom0";
- void *m;
- const ofdn_t n = OFD_ROOT;
- ofdn_t r;
- u32 did;
-
- m = (void *)mem;
-
-#ifdef PAPR_VDEVICE
- printk("Add /vdevice\n");
- ofd_vdevice(m, d);
-
- printk("Add /aliases props\n");
- ofd_aliases_props(m);
-#endif
-
- printk("Add /openprom props\n");
- ofd_openprom_props(m);
-
- printk("Add /options props\n");
- ofd_options_props(m);
-
- printk("Add /cpus props\n");
- ofd_cpus_props(m, d);
-
- printk("Add /chosen props\n");
- ofd_chosen_props(m, cmdline);
-
- printk("fix /memory props\n");
- ofd_memory_props(m, d);
-
- printk("fix /xen props\n");
- ofd_xen_props(m, d, shared_info);
-
- printk("Remove original /dart\n");
- ofd_prune_path(m, "/dart");
-
- printk("Remove original /rtas\n");
- ofd_prune_path(m, "/rtas");
-
- rtas_proxy_init(m);
-
-#ifdef FIX_COMPAT
- r = ofd_prop_add(m, n, "compatible", compat, sizeof (compat));
- ASSERT( r > 0 );
-#else
- (void)compat;
-#endif
-
- did = d->domain_id;
- r = ofd_prop_add(m, n, "ibm,partition-no", &did, sizeof(did));
- ASSERT( r > 0 );
-
- r = ofd_prop_add(m, n, "ibm,partition-name", d0, sizeof (d0));
- ASSERT( r > 0 );
-
-
-#ifdef DEBUG
- ofd_walk(m, __func__, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
-#endif
- return ofd_size(m);
-}
diff --git a/xen/arch/powerpc/ofd_fixup_memory.c b/xen/arch/powerpc/ofd_fixup_memory.c
deleted file mode 100644
index 9149a286fd..0000000000
--- a/xen/arch/powerpc/ofd_fixup_memory.c
+++ /dev/null
@@ -1,128 +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: Jimi Xenidis <jimix@watson.ibm.com>
- * Ryan Harper <ryanh@us.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/lib.h>
-#include <xen/sched.h>
-#include <asm/platform.h>
-#include <public/xen.h>
-#include "of-devtree.h"
-#include "oftree.h"
-
-static char memory[] = "memory";
-
-struct mem_reg {
- u64 addr;
- u64 sz;
-};
-
-static void ofd_memory_clean(void *m)
-{
- ofdn_t old;
-
- /* Remove all old memory props */
- do {
- old = ofd_node_find_by_prop(m, OFD_ROOT, "device_type",
- memory, sizeof(memory));
- if (old <= 0)
- break;
-
- ofd_node_prune(m, old);
- } while (1);
-}
-
-static ofdn_t ofd_memory_node_create(
- void *m, ofdn_t p, const char *ppath, const char *name,
- const char *dt, ulong start, ulong size)
-{
- struct mem_reg reg;
- char path[128];
- ulong l;
- ofdn_t n;
- ulong nl = strlen(name) + 1;
- ulong dtl = strlen(dt) + 1;
-
- l = snprintf(path, sizeof (path), "%s/%s@%lx", ppath, name, start);
- n = ofd_node_add(m, p, path, l + 1);
- ofd_prop_add(m, n, "name", name, nl);
- ofd_prop_add(m, n, "device_type", dt, dtl);
-
- /* physical addresses usable without regard to OF */
- reg.addr = start;
- reg.sz = size;
- ofd_prop_add(m, n, "reg", &reg, sizeof (reg));
-
- printk("Dom0: %s: %016lx, %016lx\n", path, start, size);
-
- return n;
-}
-
-static void ofd_memory_rma_node(void *m, struct domain *d)
-{
- ulong size = rma_size(d->arch.rma_order);
- ofdn_t n;
-
- n = ofd_memory_node_create(m, OFD_ROOT, "", memory, memory, 0, size);
- BUG_ON(n <= 0);
-}
-
-static void ofd_memory_extent_nodes(void *m, struct domain *d)
-{
- ulong start;
- ulong size;
- ofdn_t n;
- ulong cur_pfn = 1UL << d->arch.rma_order;
-
- /* if dom0 > 2G, shift ram past IO hole */
- if ((d->tot_pages << PAGE_SHIFT) > platform_iohole_base()) {
- /* memory@RMA up to IO hole */
- start = cur_pfn << PAGE_SHIFT;
- size = platform_iohole_base() - (cur_pfn << PAGE_SHIFT);
- n = ofd_memory_node_create(m, OFD_ROOT, "", memory, memory,
- start, size);
-
- BUG_ON(n <= 0);
-
- /* XXX Our p2m translation currnetly doesn't allow dom0 memory above
- * the IO hole. */
-#if 0
- /* remaining memory shifted up to memory@IOHOLE_END */
- start = platform_iohole_base()+platform_iohole_size();
- size = (d->tot_pages << PAGE_SHIFT) - platform_iohole_base();
- n = ofd_memory_node_create(m, OFD_ROOT, "", memory, memory,
- start, size);
-#endif
- } else {
- /* we fit beneath the IO hole as one chunk */
- start = cur_pfn << PAGE_SHIFT;
- size = (d->tot_pages - cur_pfn) << PAGE_SHIFT;
- n = ofd_memory_node_create(m, OFD_ROOT, "", memory, memory,
- start, size);
- }
- BUG_ON(n <= 0);
-}
-
-void ofd_memory_props(void *m, struct domain *d)
-{
- ofd_memory_clean(m);
- ofd_memory_rma_node(m, d);
- ofd_memory_extent_nodes(m,d);
-}
diff --git a/xen/arch/powerpc/oftree.h b/xen/arch/powerpc/oftree.h
deleted file mode 100644
index c8bc3563eb..0000000000
--- a/xen/arch/powerpc/oftree.h
+++ /dev/null
@@ -1,38 +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
- *
- * Authors: Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#ifndef _OFTREE_H
-#define _OFTREE_H
-#include <xen/multiboot.h>
-#include "of-devtree.h"
-
-extern ulong oftree;
-extern ulong oftree_len;
-extern ulong oftree_end;
-extern ofdn_t ofd_boot_cpu;
-
-extern ulong ofd_dom0_fixup(struct domain *d, ulong mem, const char *cmdline,
- ulong shared_info);
-extern void ofd_memory_props(void *m, struct domain *d);
-
-extern int firmware_image_start[0];
-extern int firmware_image_size[0];
-
-#endif /* #ifndef _OFTREE_H */
diff --git a/xen/arch/powerpc/papr/Makefile b/xen/arch/powerpc/papr/Makefile
deleted file mode 100644
index f1ba02c6ac..0000000000
--- a/xen/arch/powerpc/papr/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-#
-# Build the Open Firmware handler
-#
-
-# PAPR support
-obj-y += debug.o
-obj-y += tce.o
-obj-y += vtce.o
-obj-$(papr_vterm) += vterm.o
-obj-y += xlate.o
-obj-y += h_perfmon.o
diff --git a/xen/arch/powerpc/papr/debug.c b/xen/arch/powerpc/papr/debug.c
deleted file mode 100644
index cd0eb978d4..0000000000
--- a/xen/arch/powerpc/papr/debug.c
+++ /dev/null
@@ -1,84 +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@watson.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/sched.h>
-#include <xen/init.h>
-#include <public/xen.h>
-#include <asm/current.h>
-#include <asm/papr.h>
-#include <asm/hcalls.h>
-
-#define DABR_BT (1UL << 2)
-#define DABR_DW (1UL << 1)
-#define DABR_DR (1UL << 0)
-
-#define DABRX_BT (1UL << 3)
-#define DABRX_HYP (1UL << 2)
-#define DABRX_PNH (1UL << 1)
-#define DABRX_PRO (1UL << 0)
-
-static inline int has_dabrx(void) { return 1; }
-
-static void h_set_dabr(struct cpu_user_regs *regs)
-{
- ulong dabr = regs->gprs[4];
-
- if (!has_dabrx()) {
- if (!(dabr & DABR_BT)) {
- regs->gprs[3] = H_Parameter;
- return;
- }
- } else {
- asm volatile("mtspr %0,%1" : : "I" (SPRN_DABRX), "r" (2) : "memory");
- }
- asm volatile("mtspr %0,%1" : : "I" (SPRN_DABR), "r" (dabr) : "memory");
- regs->gprs[3] = H_Success;
-}
-
-static void h_set_xdabr(struct cpu_user_regs *regs)
-{
- ulong dabr = regs->gprs[4];
- ulong dabrx = regs->gprs[5];
-
- if (!has_dabrx()) {
- regs->gprs[3] = H_Function;
- return;
- }
- /* make sure reserved bits are 0 */
- if ((dabrx & ~((DABRX_BT << 1) - 1)) != 0) {
- regs->gprs[3] = H_Parameter;
- return;
- }
- if ((dabrx & DABRX_HYP) || dabrx == 0) {
- regs->gprs[3] = H_Parameter;
- return;
- }
- asm volatile("mtspr %0,%1; mtspr %2,%3"
- : /* output */ :
- "I" (SPRN_DABR), "r" (dabr),
- "I" (SPRN_DABRX), "r" (dabrx) : "memory");
-
- regs->gprs[3] = H_Success;
-}
-
-__init_papr_hcall(H_SET_DABR, h_set_dabr);
-__init_papr_hcall(H_SET_XDABR, h_set_xdabr);
diff --git a/xen/arch/powerpc/papr/h_perfmon.c b/xen/arch/powerpc/papr/h_perfmon.c
deleted file mode 100644
index 33de44f36f..0000000000
--- a/xen/arch/powerpc/papr/h_perfmon.c
+++ /dev/null
@@ -1,158 +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. 2007
- *
- * Authors: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
- */
-#undef DEBUG
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/sched.h>
-#include <xen/init.h>
-#include <xen/domain.h>
-#include <public/xen.h>
-#include <asm/current.h>
-#include <asm/msr.h>
-#include <asm/papr.h>
-#include <asm/hcalls.h>
-#include <asm/xenoprof.h>
-
-#define H_PERFMON_ENABLE (1UL << 63)
-#define H_PERFMON_THRESHOLDGRANULARITY (1UL << 62)
-
-#ifdef DEBUG
-#define DBG(fmt...) printk(fmt)
-#else
-#define DBG(fmt...)
-#endif
-
-/* FIXME workaround - these are just the default values, need the values set to
- * linux via sysfs up-to-date. */
-int pmc_reset_val[NUM_PMCS] = { (0x8000000-0x0),
- (0x8000000-0x100000),
- (0x8000000-0x0),
- (0x8000000-0x0),
- (0x8000000-0x0),
- (0x8000000-0x0),
- (0x8000000-0x0),
- (0x8000000-0x0)};
-int perf_count_active_vcpu;
-perf_sprs_t perf_clear_sprs;
-static DEFINE_SPINLOCK(perf_pmu_lock);
-
-static inline int has_pmu(void) { return 1; }
-
-void do_perfmon(struct cpu_user_regs *regs)
-{
- ulong mmcra = mfmmcra();
- ulong mmcr0 = mfmmcr0();
- int pmc,i;
-
- if ((mmcra & MMCRA_SAMPHV) && !(mmcra & MMCRA_SAMPPR)) {
- /* TODO Hypervisor sample - support to sample xen,
- * pass the sample to the primary sampling domain via an event channel.
- */
- printk("do_perfmon - called with sample of xen space\n");
- print_perf_status();
- BUG();
- }
-
- /* Dom sample postponed into xen space
- * Currently just ignored (decreases accuracy)
- * TODO pass the Dom samples to the appropriate domain via an event channel
- * TODO get access to the real pmc_reset_val currently used by the domain
- * to reset counter safe and valid
- */
-
- for (i = 0; i < NUM_PMCS; ++i) {
- pmc = ctr_read(i);
- if (pmc < 0) {
- DBG("postponed perfmon exception - PMC%d < 0 - reset to default "
- "'0x%0x'\n", i, pmc_reset_val[i]);
- ctr_write(i,pmc_reset_val[i]);
- }
- }
-
- mmcr0 |= MMCR0_PMAE;
- mmcr0 &= ~MMCR0_FC;
- mtmmcr0(mmcr0);
-}
-
-static void h_perfmon(struct cpu_user_regs *regs)
-{
- ulong mode_set = regs->gprs[4];
- ulong mode_reset = regs->gprs[5];
- struct vcpu *v = get_current();
- struct domain *d = v->domain;
-
- if (!has_pmu()) {
- regs->gprs[3] = H_Function;
- return;
- }
-
- /* only bits 0&1 are supported by H_PERFMON */
- if (((mode_set | mode_reset) & ~(H_PERFMON_ENABLE |
- H_PERFMON_THRESHOLDGRANULARITY)) != 0) {
- regs->gprs[3] = H_Parameter;
- return;
- }
- /* enable or disable it, not both */
- if ((mode_set & mode_reset) != 0) {
- regs->gprs[3] = H_Resource;
- return;
- }
-
- spin_lock(&perf_pmu_lock);
- if (mode_set & H_PERFMON_ENABLE) {
- if (v->arch.pmu_enabled) {
- DBG("H_PERFMON call on already enabled PMU for domain '%d' on "
- "vcpu '%d'\n", d->domain_id, v->vcpu_id);
- goto success;
- }
-
- if (!perf_count_active_vcpu) {
- save_pmc_sprs(&perf_clear_sprs);
-#ifdef DEBUG
- DBG("H_PERFMON Saved initial clear performance special purpose "
- "registers\n");
- print_perf_status();
-#endif
- }
- v->arch.pmu_enabled = 1;
- perf_count_active_vcpu++;
- printk("H_PERFMON call enabled PMU for domain '%d' on vcpu '%d'\n",
- d->domain_id, v->vcpu_id);
- } else if (mode_reset & H_PERFMON_ENABLE) {
- if (!v->arch.pmu_enabled) {
- DBG("H_PERFMON call on already disabled PMU for domain '%d' on "
- "vcpu '%d'\n", d->domain_id, v->vcpu_id);
- goto success;
- }
- v->arch.pmu_enabled = 0;
- perf_count_active_vcpu--;
- printk("H_PERFMON call disabled PMU for domain '%d' on vcpu '%d'\n",
- d->domain_id, v->vcpu_id);
- } else {
- regs->gprs[3] = H_Parameter;
- }
-
-success:
- regs->gprs[3] = H_Success;
- spin_unlock(&perf_pmu_lock);
-}
-
-__init_papr_hcall(H_PERFMON, h_perfmon);
diff --git a/xen/arch/powerpc/papr/tce.c b/xen/arch/powerpc/papr/tce.c
deleted file mode 100644
index 69efa6517e..0000000000
--- a/xen/arch/powerpc/papr/tce.c
+++ /dev/null
@@ -1,84 +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@watson.ibm.com>
- */
-
-#define DEBUG
-
-#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/current.h>
-#include <asm/papr.h>
-#include <asm/hcalls.h>
-#include "../tce.h"
-#include "../iommu.h"
-
-static void h_put_tce(struct cpu_user_regs *regs)
-{
- u32 liobn = regs->gprs[4];
- ulong ioba = regs->gprs[5];
- u64 tce_dword = regs->gprs[6];
- union tce tce;
-
- tce.tce_dword = tce_dword;
-
- if (iommu_put(liobn, ioba, tce) == -1) {
- regs->gprs[3] = H_Parameter;
- } else {
- regs->gprs[3] = H_Success;
- }
-}
-
-static void h_get_tce(struct cpu_user_regs *regs)
-{
- u32 liobn = regs->gprs[4];
- ulong ioba = regs->gprs[5];
-
-#ifdef DEBUG
- printk("%s: liobn: 0x%x ioba: 0x%lx \n", __func__, liobn, ioba);
-#endif
- regs->gprs[3] = H_Function;
- BUG();
-}
-
-static void h_stuff_tce(struct cpu_user_regs *regs)
-{
- u32 liobn = regs->gprs[4];
- ulong ioba = regs->gprs[5];
- u64 tce_dword = regs->gprs[6];
- ulong count = regs->gprs[7];
- union tce tce;
-
- tce.tce_dword = tce_dword;
-#ifdef DEBUG
- printk("%s: liobn: 0x%x ioba: 0x%lx tce: 0x%"
- PRIx64"(0x%"PRIx64") count: %lu\n",
- __func__, liobn, ioba, tce.tce_dword, (long)tce.tce_bits.tce_rpn,
- count);
-#endif
- regs->gprs[3] = H_Function;
- BUG();
-}
-
-__init_papr_hcall(H_PUT_TCE, h_put_tce);
-__init_papr_hcall(H_GET_TCE, h_get_tce);
-__init_papr_hcall(H_STUFF_TCE, h_stuff_tce);
diff --git a/xen/arch/powerpc/papr/vtce.c b/xen/arch/powerpc/papr/vtce.c
deleted file mode 100644
index 2d7c3657f3..0000000000
--- a/xen/arch/powerpc/papr/vtce.c
+++ /dev/null
@@ -1,158 +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@watson.ibm.com>
- */
-
-#define DEBUG
-
-/* support for creating virual TCE tables for VIO */
-
-#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/current.h>
-#include <asm/papr.h>
-#include <asm/hcalls.h>
-#include "../tce.h"
-
-static inline ulong calc_pages(ulong dma_window_size)
-{
- ulong pages_in_window = PFN_DOWN(dma_window_size);
-
- return PFN_DOWN(pages_in_window * sizeof (union tce));
-}
-
-void vtce_ia(struct tce_data *tce_data)
-{
- ulong size = tce_data->t_entries * sizeof (tce_data->t_tce[0]);
- memset(tce_data->t_tce, 0, size);
-}
-
-ulong vtce_alloc(
- struct tce_data *tce_data,
- ulong base,
- ulong dma_window_size)
-{
- ulong entries = PFN_DOWN(dma_window_size);
- ulong size = calc_pages(dma_window_size) * PAGE_SIZE;
-
- tce_data->t_tce = alloc_xenheap_pages(get_order(size));
- if (NULL != tce_data->t_tce) {
- memset(tce_data->t_tce, 0, size);
- tce_data->t_entries = entries;
- tce_data->t_base = base;
- tce_data->t_alloc_size = size;
- return dma_window_size;
- }
- return 0;
-}
-
-void vtce_free(struct tce_data *tce_data)
-{
- BUG_ON(NULL != tce_data);
- BUG_ON(NULL != tce_data->t_tce);
- free_xenheap_pages(tce_data->t_tce, get_order(tce_data->t_alloc_size));
- tce_data->t_entries = 0;
- tce_data->t_base = 0;
- tce_data->t_alloc_size = 0;
- tce_data->t_tce = NULL;
-}
-
-int vtce_put(struct tce_data *tce_data, ulong ioba, union tce ltce)
-{
- int pg;
- volatile union tce *ptce;
- union tce *tce;
- int entries;
-
- BUG_ON(tce_data != NULL);
-
- tce = tce_data->t_tce;
- entries = tce_data->t_entries;
-
- pg = ioba >> PAGE_SHIFT;
- BUG_ON(pg < entries);
- if (pg >= entries) {
- return H_Parameter;
- }
- ptce = &tce[pg];
-
- /* needs to occur atomically, we don;t care what was there before */
-
- ptce->tce_dword = ltce.tce_dword;
-
- return H_Success;
-}
-
-void *vtce_bd_xlate(struct tce_data *tce_data, union tce_bdesc bd)
-{
- ulong pg;
- ulong s = bd.lbd_bits.lbd_addr;
- ulong sz = bd.lbd_bits.lbd_len;
- ulong ep;
- ulong bytes;
- union tce *tce;
- ulong entries;
-
- BUG_ON(tce_data != NULL);
-
- tce = tce_data->t_tce;
- entries = tce_data->t_entries;
-
- pg = s >> PAGE_SHIFT;
- bytes = s - ALIGN_DOWN(s, PAGE_SIZE);
-
- ep = ALIGN_UP(s + sz, PAGE_SIZE) >> PAGE_SHIFT;
- s = ALIGN_DOWN(s, PAGE_SIZE) >> PAGE_SHIFT;
-
- /* make sure all consecutive pages are represented */
- while (s < ep) {
- ulong rw;
-
- if (s >= entries) {
- return NULL;
- }
- rw = tce[s].tce_bits.tce_read < 1;
- rw |= tce[s].tce_bits.tce_write;
-
- switch (rw) {
- case 0:
- return NULL;
- break;
-
-#ifdef DEBUG
- case 1:
- printk("%s: tce WO\n", __func__);
- break;
- case 2:
- printk("%s: tce RO\n", __func__);
- break;
-#endif
- case 3:
- default:
- break;
- }
- ++s;
- }
-
- pg = (tce[pg].tce_bits.tce_rpn << PAGE_SHIFT) + bytes;
- return (void *)pg;
-}
diff --git a/xen/arch/powerpc/papr/vterm.c b/xen/arch/powerpc/papr/vterm.c
deleted file mode 100644
index eb6f67ff0a..0000000000
--- a/xen/arch/powerpc/papr/vterm.c
+++ /dev/null
@@ -1,70 +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@us.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/sched.h>
-#include <xen/init.h>
-#include <public/xen.h>
-#include <asm/current.h>
-#include <asm/papr.h>
-#include <asm/hcalls.h>
-
-static void h_put_term_char(struct cpu_user_regs *regs)
-{
- char data[(sizeof (u64) * 4) + 1];
- ulong count;
- extern void serial_puts(int handle, const char *s);
-
- /* XXX what to do with 'channel' in r4? */
-
- count = regs->gprs[5];
- if (count > 16) {
- regs->gprs[3] = H_Parameter;
- return;
- }
-
- memcpy(data, &regs->gprs[6], count);
- data[count] = '\0';
-
- serial_puts(0, data);
- regs->gprs[3] = H_Success;
-}
-
-static void h_get_term_char(struct cpu_user_regs *regs)
-{
- /* temporary hack to let us use xmon in dom0 */
- extern char serial_getc_nb(int handle);
- char c;
-
- c = serial_getc_nb(0);
- if (c > 0) {
- regs->gprs[4] = 1;
- regs->gprs[5] = (ulong)c << (7 * 8);
- regs->gprs[6] = 0; /* paranoid */
- } else {
- regs->gprs[4] = 0;
- }
-
- regs->gprs[3] = H_Success;
-}
-
-__init_papr_hcall(H_PUT_TERM_CHAR, h_put_term_char);
-__init_papr_hcall(H_GET_TERM_CHAR, h_get_term_char);
diff --git a/xen/arch/powerpc/papr/xlate.c b/xen/arch/powerpc/papr/xlate.c
deleted file mode 100644
index 1d197dd0d4..0000000000
--- a/xen/arch/powerpc/papr/xlate.c
+++ /dev/null
@@ -1,619 +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@watson.ibm.com>
- */
-
-#undef DEBUG
-#undef DEBUG_LOW
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/sched.h>
-#include <xen/init.h>
-#include <public/xen.h>
-#include <asm/current.h>
-#include <asm/papr.h>
-#include <asm/hcalls.h>
-#include <asm/platform.h>
-
-#ifdef DEBUG
-#define DBG(fmt...) printk(fmt)
-#else
-#define DBG(fmt...)
-#endif
-#ifdef DEBUG_LOW
-#define DBG_LOW(fmt...) printk(fmt)
-#else
-#define DBG_LOW(fmt...)
-#endif
-
-#ifdef USE_PTE_INSERT
-static inline void pte_insert(union pte volatile *pte,
- ulong vsid, ulong rpn, ulong lrpn)
-{
- /*
- * It's required that external locking be done to provide
- * exclusion between the choices of insertion points. Any valid
- * choice of pte requires that the pte be invalid upon entry to
- * this function.
- */
-
- ASSERT( (pte->bits.v == 0) );
-
- /* Set shadow word. */
- (void)lrpn;
-
- /* Set the second word first so the valid bit is the last thing set */
- pte->words.rpn = rpn;
-
- /* Guarantee the second word is visible before the valid bit */
- __asm__ __volatile__("eieio" : : : "memory");
-
- /* Now set the first word including the valid bit */
- pte->words.vsid = vsid;
- /* Architecturally this instruction will cause a heavier operation
- * if this one is not supported. note: on come machines like Cell
- * this coul dbe a nop */
- __asm__ __volatile__("ptesync" : : : "memory");
-}
-#endif
-
-/*
- * POWER Arch 2.03 Sec 4.12.1 (Yes 970 is one)
- *
- * when a tlbsync instruction has been executed by a processor in a
- * given partition, a ptesync instruction must be executed by that
- * processor before a tlbie or tlbsync instruction is executed by
- * another processor in that partition.
- *
- * So for now, here is a BFLock to deal with it, the lock should be per-domain.
- *
- * XXX Will need to audit all tlb usege soon enough.
- */
-
-static DEFINE_SPINLOCK(native_tlbie_lock);
-static void pte_tlbie(union pte volatile *pte, ulong ptex)
-{
- ulong va;
- ulong vsid;
- ulong group;
- ulong pi;
- ulong pi_high;
-
- vsid = pte->bits.avpn >> 5;
- group = ptex >> 3;
- if (pte->bits.h) {
- group = ~group;
- }
- pi = (vsid ^ group) & 0x7ff;
- pi_high = (pte->bits.avpn & 0x1f) << 11;
- pi |= pi_high;
- va = (pi << 12) | (vsid << 28);
- va &= ~(0xffffULL << 48);
-
- spin_lock(&native_tlbie_lock);
-#ifndef FLUSH_THE_WHOLE_THING
- if (pte->bits.l) {
- va |= (pte->bits.rpn & 1);
- asm volatile("ptesync ;tlbie %0,1" : : "r"(va) : "memory");
- } else {
- asm volatile("ptesync; tlbie %0,0" : : "r"(va) : "memory");
- }
- asm volatile("eieio; tlbsync; ptesync" : : : "memory");
-#else
- {
- unsigned i;
- ulong rb;
-
- for (i = 0; i < 256; i++) {
- rb = i;
- rb <<= 12;
- asm volatile("ptesync; tlbie %0,0; eieio; tlbsync; ptesync; isync"
- : "=r" (rb): : "memory");
- asm volatile("ptesync; tlbie %0,1; eieio; tlbsync; ptesync; isync"
- : "=r" (rb): : "memory");
- }
- }
-#endif
- spin_unlock(&native_tlbie_lock);
-}
-
-long pte_enter(ulong flags, ulong ptex, ulong vsid, ulong rpn)
-{
- union pte pte;
- union pte volatile *ppte;
- struct domain_htab *htab;
- int lp_bits = 0;
- int pgshift = PAGE_SHIFT;
- ulong idx;
- int limit = 0; /* how many PTEs to examine in the PTEG */
- ulong pfn;
- ulong mfn;
- struct vcpu *v = get_current();
- struct domain *d = v->domain;
- int mtype;
- struct page_info *pg = NULL;
- struct domain *f = NULL;
-
-
- htab = &d->arch.htab;
- if (ptex > (1UL << htab->log_num_ptes)) {
- DBG("%s: bad ptex: 0x%lx\n", __func__, ptex);
- return H_Parameter;
- }
-
- /* use local HPTE to avoid manual shifting & masking */
- pte.words.vsid = vsid;
- pte.words.rpn = rpn;
-
- if ( pte.bits.l ) { /* large page? */
- /* figure out the page size for the selected large page */
- ulong lp_rpn = pte.bits.rpn;
- uint lp_size = 0;
-
- while ( lp_rpn & 0x1 ) {
- lp_rpn >>= 1;
- lp_bits = ((lp_bits << 1) | 0x1);
- lp_size++;
- }
-
- if ( lp_size >= d->arch.large_page_sizes ) {
- DBG("%s: attempt to use unsupported lp_size %d\n",
- __func__, lp_size);
- return H_Parameter;
- }
-
- /* get correct pgshift value */
- pgshift = d->arch.large_page_order[lp_size] + PAGE_SHIFT;
- }
-
- /* get the correct logical RPN in terms of 4K pages need to mask
- * off lp bits and unused arpn bits if this is a large page */
-
- pfn = ~0ULL << (pgshift - PAGE_SHIFT);
- pfn = pte.bits.rpn & pfn;
-
- mfn = pfn2mfn(d, pfn, &mtype);
- if (mfn == INVALID_MFN) {
- DBG("%s: Bad PFN: 0x%lx\n", __func__, pfn);
- return H_Parameter;
- }
-
- if (mtype == PFN_TYPE_IO && !d->is_privileged) {
- /* only a privilaged dom can access outside IO space */
- DBG("%s: unprivileged access to physical page: 0x%lx\n",
- __func__, pfn);
- return H_Privilege;
- }
- if (mtype == PFN_TYPE_IO) {
- if ( !((pte.bits.w == 0)
- && (pte.bits.i == 1)
- && (pte.bits.g == 1)) ) {
- DBG("%s: expecting an IO WIMG "
- "w=%x i=%d m=%d, g=%d\n word 0x%lx\n", __func__,
- pte.bits.w, pte.bits.i, pte.bits.m, pte.bits.g,
- pte.words.rpn);
- return H_Parameter;
- }
- }
- if (mtype == PFN_TYPE_GNTTAB) {
- DBG("%s: Dom[%d] mapping grant table: 0x%lx\n",
- __func__, d->domain_id, pfn << PAGE_SHIFT);
- pte.bits.i = 0;
- pte.bits.g = 0;
- }
- /* fixup the RPN field of our local PTE copy */
- pte.bits.rpn = mfn | lp_bits;
-
- /* clear reserved bits in high word */
- pte.bits.lock = 0x0;
- pte.bits.res = 0x0;
-
- /* clear reserved bits in low word */
- pte.bits.pp0 = 0x0;
- pte.bits.ts = 0x0;
- pte.bits.res2 = 0x0;
-
- if (mtype == PFN_TYPE_FOREIGN) {
- pg = mfn_to_page(mfn);
- f = page_get_owner(pg);
-
- BUG_ON(f == d);
-
- if (unlikely(!get_domain(f))) {
- DBG("%s: Rescinded, no domain: 0x%lx\n", __func__, pfn);
- return H_Rescinded;
- }
- if (unlikely(!get_page(pg, f))) {
- put_domain(f);
- DBG("%s: Rescinded, no page: 0x%lx\n", __func__, pfn);
- return H_Rescinded;
- }
- }
-
- if ( !(flags & H_EXACT) ) {
- /* PTEG (not specific PTE); clear 3 lowest bits */
- ptex &= ~0x7UL;
- limit = 7;
- }
-
- /* data manipulations should be done prior to the pte insertion. */
- if ( flags & H_ZERO_PAGE ) {
- ulong pg = mfn << PAGE_SHIFT;
- ulong pgs = 1UL << pgshift;
-
- while (pgs > 0) {
- clear_page((void *)pg);
- pg += PAGE_SIZE;
- --pgs;
- }
- }
-
- if ( flags & H_ICACHE_INVALIDATE ) {
- ulong k;
- ulong addr = mfn << PAGE_SHIFT;
-
- for (k = 0; k < (1UL << pgshift); k += L1_CACHE_BYTES) {
- dcbst(addr + k);
- sync();
- icbi(addr + k);
- sync();
- isync();
- }
- }
-
- if ( flags & H_ICACHE_SYNCHRONIZE ) {
- ulong k;
- ulong addr = mfn << PAGE_SHIFT;
- for (k = 0; k < (1UL << pgshift); k += L1_CACHE_BYTES) {
- icbi(addr + k);
- sync();
- isync();
- }
- }
-
- for (idx = ptex; idx <= ptex + limit; idx++) {
- ppte = &htab->map[idx];
-
- if ( ppte->bits.v == 0 && ppte->bits.lock == 0) {
- /* got it */
-
- asm volatile(
- "std %1, 8(%0); eieio; std %2, 0(%0); ptesync"
- :
- : "b" (ppte), "r" (pte.words.rpn), "r" (pte.words.vsid)
- : "memory");
-
- return idx;
- }
- }
-
- /* If the PTEG is full then no additional values are returned. */
- DBG("%s: PTEG FULL\n", __func__);
-
- if (pg != NULL)
- put_page(pg);
-
- if (f != NULL)
- put_domain(f);
-
- return H_PTEG_Full;
-}
-
-static void h_enter(struct cpu_user_regs *regs)
-{
- ulong flags = regs->gprs[4];
- ulong ptex = regs->gprs[5];
- ulong vsid = regs->gprs[6];
- ulong rpn = regs->gprs[7];
- long ret;
-
- ret = pte_enter(flags, ptex, vsid, rpn);
-
- if (ret >= 0) {
- regs->gprs[3] = H_Success;
- regs->gprs[4] = ret;
- } else
- regs->gprs[3] = ret;
-}
-
-static void h_protect(struct cpu_user_regs *regs)
-{
- ulong flags = regs->gprs[4];
- ulong ptex = regs->gprs[5];
- ulong avpn = regs->gprs[6];
- struct vcpu *v = get_current();
- struct domain *d = v->domain;
- struct domain_htab *htab = &d->arch.htab;
- union pte volatile *ppte;
- union pte lpte;
-
- DBG_LOW("%s: flags: 0x%lx ptex: 0x%lx avpn: 0x%lx\n", __func__,
- flags, ptex, avpn);
- if ( ptex > (1UL << htab->log_num_ptes) ) {
- DBG("%s: bad ptex: 0x%lx\n", __func__, ptex);
- regs->gprs[3] = H_Parameter;
- return;
- }
- ppte = &htab->map[ptex];
-
- lpte.words.vsid = ppte->words.vsid;
- lpte.words.rpn = ppte->words.rpn;
-
- /* the AVPN param occupies the bit-space of the word */
- if ( (flags & H_AVPN) && lpte.bits.avpn != avpn >> 7 ) {
- DBG_LOW("%s: %p: AVPN check failed: 0x%lx, 0x%lx\n", __func__,
- ppte, lpte.words.vsid, lpte.words.rpn);
- regs->gprs[3] = H_Not_Found;
- return;
- }
-
- if (lpte.bits.v == 0) {
- /* the PAPR does not specify what to do here, this is because
- * we invalidate entires where the PAPR says to 0 the whole hi
- * dword, so the AVPN should catch this first */
-
- DBG("%s: pte invalid\n", __func__);
- regs->gprs[3] = H_Not_Found;
- return;
- }
-
- lpte.bits.v = 0;
-
- /* ppte->words.vsid = lpte.words.vsid; */
- asm volatile(
- "eieio; std %1, 0(%0); ptesync"
- :
- : "b" (ppte), "r" (0)
- : "memory");
-
- pte_tlbie(&lpte, ptex);
-
- /* We never touch pp0, and PP bits in flags are in the right
- * order */
- lpte.bits.pp1 = flags & (H_PP1 | H_PP2);
- lpte.bits.n = (flags & H_N) ? 1 : 0;
-
- lpte.bits.v = 1;
- lpte.bits.r = 0;
-
- asm volatile(
- "std %1, 8(%0); eieio; std %2, 0(%0); ptesync"
- :
- : "b" (ppte), "r" (lpte.words.rpn), "r" (lpte.words.vsid)
- : "memory");
-
- regs->gprs[3] = H_Success;
-}
-
-static void h_clear_ref(struct cpu_user_regs *regs)
-{
- ulong ptex = regs->gprs[5];
- struct vcpu *v = get_current();
- struct domain *d = v->domain;
- struct domain_htab *htab = &d->arch.htab;
- union pte volatile *pte;
- union pte lpte;
-
- DBG_LOW("%s: flags: 0x%lx ptex: 0x%lx\n", __func__,
- regs->gprs[4], ptex);
-
-#ifdef DEBUG
- if (regs->gprs[4] != 0) {
- DBG("WARNING: %s: "
- "flags are undefined and should be 0: 0x%lx\n",
- __func__, regs->gprs[4]);
- }
-#endif
-
- if (ptex > (1UL << htab->log_num_ptes)) {
- DBG("%s: bad ptex: 0x%lx\n", __func__, ptex);
- regs->gprs[3] = H_Parameter;
- return;
- }
- pte = &htab->map[ptex];
- lpte.words.rpn = pte->words.rpn;
-
- regs->gprs[4] = lpte.words.rpn;
-
- if (lpte.bits.r != 0) {
- lpte.bits.r = 0;
-
- asm volatile("std %1, 8(%0); eieio; ptesync"
- :
- : "b" (pte), "r" (lpte.words.rpn) : "memory");
-
- pte_tlbie(&lpte, ptex);
- }
- regs->gprs[3] = H_Success;
-}
-
-static void h_clear_mod(struct cpu_user_regs *regs)
-{
- ulong ptex = regs->gprs[5];
- struct vcpu *v = get_current();
- struct domain *d = v->domain;
- struct domain_htab *htab = &d->arch.htab;
- union pte volatile *pte;
- union pte lpte;
-
- DBG_LOW("%s: flags: 0x%lx ptex: 0x%lx\n", __func__,
- regs->gprs[4], ptex);
-
-#ifdef DEBUG
- if (regs->gprs[4] != 0) {
- DBG("WARNING: %s: "
- "flags are undefined and should be 0: 0x%lx\n",
- __func__, regs->gprs[4]);
- }
-#endif
-
- if (ptex > (1UL << htab->log_num_ptes)) {
- DBG("%s: bad ptex: 0x%lx\n", __func__, ptex);
- regs->gprs[3] = H_Parameter;
- return;
- }
- pte = &htab->map[ptex];
- lpte.words.vsid = pte->words.vsid;
- lpte.words.rpn = pte->words.rpn;
-
- regs->gprs[3] = H_Success;
- regs->gprs[4] = lpte.words.rpn;
-
- if (lpte.bits.c != 0) {
- /* invalidate */
- asm volatile(
- "eieio; std %1, 0(%0); ptesync"
- :
- : "b" (pte), "r" (0)
- : "memory");
-
- pte_tlbie(&lpte, ptex);
-
- lpte.bits.c = 0;
- asm volatile(
- "std %1, 8(%0); eieio; std %2, 0(%0); ptesync"
- :
- : "b" (pte), "r" (lpte.words.rpn), "r" (lpte.words.vsid)
- : "memory");
- }
-}
-
-long pte_remove(ulong flags, ulong ptex, ulong avpn, ulong *hi, ulong *lo)
-{
- struct vcpu *v = get_current();
- struct domain *d = v->domain;
- struct domain_htab *htab = &d->arch.htab;
- union pte volatile *pte;
- union pte lpte;
-
- DBG_LOW("%s: flags: 0x%lx ptex: 0x%lx avpn: 0x%lx\n", __func__,
- flags, ptex, avpn);
-
- if ( ptex > (1UL << htab->log_num_ptes) ) {
- DBG("%s: bad ptex: 0x%lx\n", __func__, ptex);
- return H_Parameter;
- }
- pte = &htab->map[ptex];
- lpte.words.vsid = pte->words.vsid;
- lpte.words.rpn = pte->words.rpn;
-
- if ((flags & H_AVPN) && lpte.bits.avpn != (avpn >> 7)) {
- DBG_LOW("%s: AVPN does not match\n", __func__);
- return H_Not_Found;
- }
-
- if ((flags & H_ANDCOND) && ((avpn & pte->words.vsid) != 0)) {
- DBG("%s: andcond does not match\n", __func__);
- return H_Not_Found;
- }
-
- /* return old PTE in regs 4 and 5 */
- *hi = lpte.words.vsid;
- *lo = lpte.words.rpn;
-
-#ifdef DEBUG_LOW
- /* XXX - I'm very skeptical of doing ANYTHING if not bits.v */
- /* XXX - I think the spec should be questioned in this case (MFM) */
- if (lpte.bits.v == 0) {
- DBG_LOW("%s: removing invalid entry\n", __func__);
- }
-#endif
-
- if (lpte.bits.v) {
- ulong mfn = lpte.bits.rpn;
- if (!platform_io_mfn(mfn)) {
- struct page_info *pg = mfn_to_page(mfn);
- struct domain *f = page_get_owner(pg);
-
- if (f != d) {
- put_domain(f);
- put_page(pg);
- }
- }
- }
-
- asm volatile("eieio; std %1, 0(%0); ptesync"
- :
- : "b" (pte), "r" (0)
- : "memory");
-
- pte_tlbie(&lpte, ptex);
-
- return H_Success;
-}
-
-static void h_remove(struct cpu_user_regs *regs)
-{
- ulong flags = regs->gprs[4];
- ulong ptex = regs->gprs[5];
- ulong avpn = regs->gprs[6];
- ulong hi, lo;
- long ret;
-
- ret = pte_remove(flags, ptex, avpn, &hi, &lo);
-
- regs->gprs[3] = ret;
-
- if (ret == H_Success) {
- regs->gprs[4] = hi;
- regs->gprs[5] = lo;
- }
- return;
-}
-
-static void h_read(struct cpu_user_regs *regs)
-{
- ulong flags = regs->gprs[4];
- ulong ptex = regs->gprs[5];
- struct vcpu *v = get_current();
- struct domain *d = v->domain;
- struct domain_htab *htab = &d->arch.htab;
- union pte volatile *pte;
-
- if (flags & H_READ_4)
- ptex &= ~0x3UL;
-
- if (ptex > (1UL << htab->log_num_ptes)) {
- DBG("%s: bad ptex: 0x%lx\n", __func__, ptex);
- regs->gprs[3] = H_Parameter;
- return;
- }
- pte = &htab->map[ptex];
- regs->gprs[4] = pte[0].words.vsid;
- regs->gprs[5] = pte[0].words.rpn;
-
- if (!(flags & H_READ_4)) {
- /* dump another 3 PTEs */
- regs->gprs[6] = pte[1].words.vsid;
- regs->gprs[7] = pte[1].words.rpn;
- regs->gprs[8] = pte[2].words.vsid;
- regs->gprs[9] = pte[2].words.rpn;
- regs->gprs[10] = pte[3].words.vsid;
- regs->gprs[11] = pte[3].words.rpn;
- }
-
- regs->gprs[3] = H_Success;
-}
-
-__init_papr_hcall(H_ENTER, h_enter);
-__init_papr_hcall(H_READ, h_read);
-__init_papr_hcall(H_REMOVE, h_remove);
-__init_papr_hcall(H_CLEAR_MOD, h_clear_mod);
-__init_papr_hcall(H_CLEAR_REF, h_clear_ref);
-__init_papr_hcall(H_PROTECT, h_protect);
diff --git a/xen/arch/powerpc/physdev.c b/xen/arch/powerpc/physdev.c
deleted file mode 100644
index b7dd98b827..0000000000
--- a/xen/arch/powerpc/physdev.c
+++ /dev/null
@@ -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: Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#include <xen/types.h>
-#include <public/xen.h>
-extern long do_physdev_op(int cmd, XEN_GUEST_HANDLE(void) arg);
-#include "../x86/physdev.c"
diff --git a/xen/arch/powerpc/platform.c b/xen/arch/powerpc/platform.c
deleted file mode 100644
index 459450ef59..0000000000
--- a/xen/arch/powerpc/platform.c
+++ /dev/null
@@ -1,43 +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. 2007
- *
- * Authors: Ryan Harper <ryanh@us.ibm.com>
- * Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#include <asm/page.h>
-#include <asm/platform.h>
-
-#define IO_RANGE_START (2UL << 30)
-#define IO_RANGE_END (4UL << 30)
-#define IO_SIZE (IO_RANGE_END - IO_RANGE_START)
-
-unsigned long platform_iohole_base(void)
-{
- return IO_RANGE_START;
-}
-
-unsigned long platform_iohole_size(void)
-{
- return IO_SIZE;
-}
-
-int platform_io_mfn(unsigned long mfn)
-{
- unsigned long maddr = mfn << PAGE_SHIFT;
- return maddr > IO_RANGE_START && maddr < IO_RANGE_END;
-}
diff --git a/xen/arch/powerpc/powerpc64/Makefile b/xen/arch/powerpc/powerpc64/Makefile
deleted file mode 100644
index dbdc18e0ce..0000000000
--- a/xen/arch/powerpc/powerpc64/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-io.o: CFLAGS += -Wa,-mppc64bridge
-
-obj-y += domain.o
-obj-y += exceptions.o
-obj-y += hypercall_table.o
-obj-y += io.o
-obj-y += memcpy.o
-obj-y += ppc970.o
-obj-y += ppc970_machinecheck.o
-obj-y += ppc970_scom.o
-obj-y += prom_call.o
-obj-y += string.o
-obj-y += traps.o
-
diff --git a/xen/arch/powerpc/powerpc64/asm-offsets.c b/xen/arch/powerpc/powerpc64/asm-offsets.c
deleted file mode 100644
index 5c6f2aa530..0000000000
--- a/xen/arch/powerpc/powerpc64/asm-offsets.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* from xen/arch/x86/x86_32/asm-offsets.c */
-
-/*
- * Generate definitions needed by assembly language modules.
- * This code generates raw asm output which is post-processed
- * to extract and format the required data.
- */
-
-#include <xen/sched.h>
-#include <public/xen.h>
-#include <asm/powerpc64/procarea.h>
-#include <asm/hardirq.h>
-
-#define DEFINE(_sym, _val) \
- __asm__ __volatile__ ( "\n->" #_sym " %0 " #_val : : "i" (_val) )
-#define BLANK() \
- __asm__ __volatile__ ( "\n->" : : )
-#define OFFSET(_sym, _str, _mem) \
- DEFINE(_sym, offsetof(_str, _mem));
-
-/* base-2 logarithm */
-#define __L2(_x) (((_x) & 0x00000002) ? 1 : 0)
-#define __L4(_x) (((_x) & 0x0000000c) ? ( 2 + __L2( (_x)>> 2)) : __L2( _x))
-#define __L8(_x) (((_x) & 0x000000f0) ? ( 4 + __L4( (_x)>> 4)) : __L4( _x))
-#define __L16(_x) (((_x) & 0x0000ff00) ? ( 8 + __L8( (_x)>> 8)) : __L8( _x))
-#define LOG_2(_x) (((_x) & 0xffff0000) ? (16 + __L16((_x)>>16)) : __L16(_x))
-
-extern void __dummy__(void);
-void __dummy__(void)
-{
- DEFINE(GPR_WIDTH, sizeof(unsigned long));
- DEFINE(FPR_WIDTH, sizeof(double));
-
- OFFSET(PAREA_vcpu, struct processor_area, cur_vcpu);
- OFFSET(PAREA_stack, struct processor_area, hyp_stack_base);
- OFFSET(PAREA_r1, struct processor_area, saved_regs[0]);
- OFFSET(PAREA_cr, struct processor_area, saved_regs[1]);
-
- OFFSET(UREGS_gprs, struct cpu_user_regs, gprs);
- OFFSET(UREGS_r0, struct cpu_user_regs, gprs[0]);
- OFFSET(UREGS_r1, struct cpu_user_regs, gprs[1]);
- OFFSET(UREGS_r13, struct cpu_user_regs, gprs[13]);
- OFFSET(UREGS_srr0, struct cpu_user_regs, srr0);
- OFFSET(UREGS_srr1, struct cpu_user_regs, srr1);
- OFFSET(UREGS_pc, struct cpu_user_regs, pc);
- OFFSET(UREGS_msr, struct cpu_user_regs, msr);
- OFFSET(UREGS_lr, struct cpu_user_regs, lr);
- OFFSET(UREGS_ctr, struct cpu_user_regs, ctr);
- OFFSET(UREGS_xer, struct cpu_user_regs, xer);
- OFFSET(UREGS_hid4, struct cpu_user_regs, hid4);
- OFFSET(UREGS_dar, struct cpu_user_regs, dar);
- OFFSET(UREGS_dsisr, struct cpu_user_regs, dsisr);
- OFFSET(UREGS_cr, struct cpu_user_regs, cr);
- OFFSET(UREGS_fpscr, struct cpu_user_regs, fpscr);
- DEFINE(UREGS_sizeof, sizeof(struct cpu_user_regs));
-
- OFFSET(VCPU_fprs, struct vcpu, arch.fprs);
- OFFSET(VCPU_fpscr, struct vcpu, arch.ctxt.fpscr);
- OFFSET(VCPU_vrs, struct vcpu, arch.vrs);
- OFFSET(VCPU_vscr, struct vcpu, arch.vscr);
- OFFSET(VCPU_vrsave, struct vcpu, arch.vrsave);
- OFFSET(VCPU_dec, struct vcpu, arch.dec);
- OFFSET(VCPU_processor, struct vcpu, processor);
-
- DEFINE(IRQSTAT_shift, LOG_2(sizeof(irq_cpustat_t)));
- OFFSET(IRQSTAT_pending, irq_cpustat_t, __softirq_pending);
-}
diff --git a/xen/arch/powerpc/powerpc64/domain.c b/xen/arch/powerpc/powerpc64/domain.c
deleted file mode 100644
index acf5969c7a..0000000000
--- a/xen/arch/powerpc/powerpc64/domain.c
+++ /dev/null
@@ -1,222 +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@watson.ibm.com>
- * Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/lib.h>
-#include <xen/sched.h>
-#include <xen/mm.h>
-#include <xen/domain.h>
-#include <asm/current.h>
-
-void save_pmc_sprs(perf_sprs_t *p_sprs)
-{
- p_sprs->mmcr0 = mfmmcr0();
- p_sprs->mmcr1 = mfmmcr1();
- p_sprs->mmcra = mfmmcra();
- p_sprs->pmc[0] = mfpmc1();
- p_sprs->pmc[1] = mfpmc2();
- p_sprs->pmc[2] = mfpmc3();
- p_sprs->pmc[3] = mfpmc4();
- p_sprs->pmc[4] = mfpmc5();
- p_sprs->pmc[5] = mfpmc6();
- p_sprs->pmc[6] = mfpmc7();
- p_sprs->pmc[7] = mfpmc8();
-}
-
-void load_pmc_sprs(perf_sprs_t *p_sprs)
-{
- mtpmc1(p_sprs->pmc[0]);
- mtpmc2(p_sprs->pmc[1]);
- mtpmc3(p_sprs->pmc[2]);
- mtpmc4(p_sprs->pmc[3]);
- mtpmc5(p_sprs->pmc[4]);
- mtpmc6(p_sprs->pmc[5]);
- mtpmc7(p_sprs->pmc[6]);
- mtpmc8(p_sprs->pmc[7]);
- mtmmcra(p_sprs->mmcra);
- mtmmcr1(p_sprs->mmcr1);
- mtmmcr0(p_sprs->mmcr0);
-}
-
-void save_sprs(struct vcpu *v)
-{
- v->arch.timebase = mftb();
-
- v->arch.sprg[0] = mfsprg0();
- v->arch.sprg[1] = mfsprg1();
- v->arch.sprg[2] = mfsprg2();
- v->arch.sprg[3] = mfsprg3();
-
- v->arch.dar = mfdar();
- v->arch.dsisr = mfdsisr();
-
- if (v->arch.pmu_enabled) {
- save_pmc_sprs(&(v->arch.perf_sprs));
- v->arch.perf_sprs_stored = 1;
- }
-
- save_cpu_sprs(v);
-}
-
-void load_sprs(struct vcpu *v)
-{
- ulong timebase_delta;
-
- mtsprg0(v->arch.sprg[0]);
- mtsprg1(v->arch.sprg[1]);
- mtsprg2(v->arch.sprg[2]);
- mtsprg3(v->arch.sprg[3]);
- mtdar(v->arch.dar);
- mtdsisr(v->arch.dsisr);
-
- if (v->arch.pmu_enabled) {
- if (v->arch.perf_sprs_stored)
- load_pmc_sprs(&(v->arch.perf_sprs));
- else
- load_pmc_sprs(&perf_clear_sprs);
- }
-
- load_cpu_sprs(v);
-
- /* adjust the DEC value to account for cycles while not
- * running this OS */
- timebase_delta = mftb() - v->arch.timebase;
- if (timebase_delta > v->arch.dec)
- v->arch.dec = 0;
- else
- v->arch.dec -= timebase_delta;
-}
-
-/* XXX evaluate all isyncs in segment code */
-
-void flush_segments(void)
-{
- struct slb_entry slb0;
- ulong zero = 0;
-
- __asm__ __volatile__(
- "slbmfev %0,%2\n"
- "slbmfee %1,%2\n"
- :"=&r"(slb0.slb_vsid), "=&r"(slb0.slb_esid)
- :"r"(zero)
- :"memory");
-
- /* we manually have to invalidate SLB[0] since slbia doesn't. */
- /* XXX name magic constants! */
- if (slb0.slb_esid & SLB_ESID_VALID) {
- ulong rb;
- ulong class;
-
- class = !!(slb0.slb_vsid & SLB_ESID_CLASS);
- rb = slb0.slb_esid & SLB_ESID_MASK;
- rb |= class << SLBIE_CLASS_LOG;
-
- slbie(rb);
- }
- slbia();
-}
-
-void save_segments(struct vcpu *v)
-{
- struct slb_entry *slb_entry = v->arch.slb_entries;
- int i;
-
- /* save all extra SLBs */
- for (i = 0; i < NUM_SLB_ENTRIES; i++) {
- ulong vsid;
- ulong esid;
-
- __asm__ __volatile__(
- "slbmfev %0,%2\n"
- "slbmfee %1,%2\n"
- :"=&r"(vsid), "=&r"(esid)
- :"r"(i)
- :"memory");
-
- /* FIXME: should we bother to save invalid entries? */
- slb_entry[i].slb_vsid = vsid;
- slb_entry[i].slb_esid = esid;
-#ifdef SLB_DEBUG
- if (vsid != 0) {
- printk("%s: DOM[0x%x]: S%02d: 0x%016lx 0x%016lx\n",
- __func__, v->domain->domain_id, i, vsid, esid);
- }
-#endif
- }
-
- flush_segments();
-}
-
-void load_segments(struct vcpu *v)
-{
- struct slb_entry *slb_entry = v->arch.slb_entries;
- int i;
-
- /* restore all extra SLBs */
- for (i = 0; i < NUM_SLB_ENTRIES; i++) {
- ulong vsid = slb_entry[i].slb_vsid;
- ulong esid = slb_entry[i].slb_esid;
-
- /* FIXME: should we bother to restore invalid entries */
- /* stuff in the index here */
- esid &= ~SLBMTE_ENTRY_MASK;
- esid |= i;
-
- __asm__ __volatile__(
- "isync\n"
- "slbmte %0,%1\n"
- "isync\n"
- :
- :"r" (vsid), "r"(esid)
- :"memory");
-
-#ifdef SLB_DEBUG
- if (vsid != 0) {
- printk("%s: DOM[0x%x]: R%02d: 0x%016lx 0x%016lx\n",
- __func__, v->domain->domain_id, i, vsid, esid);
- }
-#endif
- }
-}
-
-void dump_segments(int valid)
-{
- int i;
-
- printk("Dump %s SLB entries:\n", valid ? "VALID" : "ALL");
-
- /* save all extra SLBs */
- for (i = 0; i < NUM_SLB_ENTRIES; i++) {
- ulong vsid;
- ulong esid;
-
- __asm__ __volatile__(
- "slbmfev %0,%2\n"
- "slbmfee %1,%2\n"
- :"=&r"(vsid), "=&r"(esid)
- :"r"(i)
- :"memory");
-
- if (valid && !(esid & SLB_ESID_VALID))
- continue;
- printk("S%02d: 0x%016lx 0x%016lx\n", i, vsid, esid);
- }
-}
diff --git a/xen/arch/powerpc/powerpc64/exceptions.S b/xen/arch/powerpc/powerpc64/exceptions.S
deleted file mode 100644
index 9eec6d9d10..0000000000
--- a/xen/arch/powerpc/powerpc64/exceptions.S
+++ /dev/null
@@ -1,644 +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@watson.ibm.com>
- * Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#include <asm/config.h>
-#include <asm/asm-offsets.h>
-#include <asm/reg_defs.h>
-#include <asm/msr.h>
-#include <asm/processor.h>
-#include <asm/percpu.h>
-
-.macro SAVE_GPR regno uregs
-std \regno, (UREGS_gprs + GPR_WIDTH * \regno)(\uregs)
-.endm
-
-.macro SAVE_GPRS from to uregs
-.ifge \to-\from
-SAVE_GPR \from, \uregs
-SAVE_GPRS "(\from+1)", \to, \uregs
-.endif
-.endm
-
-.macro LOAD_GPR regno uregs
-ld \regno, (UREGS_gprs + GPR_WIDTH * \regno)(\uregs)
-.endm
-
-.macro LOAD_GPRS from to uregs
-.ifge \to-\from
-LOAD_GPR \from, \uregs
-LOAD_GPRS "(\from+1)", \to, \uregs
-.endif
-.endm
-
-.macro GET_STACK parea srr1
- /* get processor area pointer and save off a couple registers there */
- mtspr SPRN_HSPRG1, \parea
- mfspr \parea, SPRN_HSPRG0
- std r1, PAREA_r1(\parea)
- mfcr r1
- std r1, PAREA_cr(\parea)
- mfspr r1, \srr1
- rldicl. r1, r1, 4, 63 /* test (H)SRR1:HV */
- /* assume we interrupted the guest, in which case we start at top of this
- * processsor's hypervisor stack (as found in parea). */
- ld r1, PAREA_stack(\parea)
- beq 1f
- /* nope, we interrupted the hypervisor. continue on that stack. */
- ld r1, PAREA_r1(\parea)
-1:
-.endm
-
-/* SAVE_C_STATE: set up enough state to jump to C code
- * r14-r31 are non-volatile in the C ABI, so not saved here
- */
-.macro SAVE_C_STATE uregs
- SAVE_GPRS r2, r12, \uregs /* save r2-r12 */
-
- mflr r0
- std r0, UREGS_lr(\uregs) /* save LR */
- mfxer r0
- std r0, UREGS_xer(\uregs) /* save XER */
-.endm
-
-.macro LOAD_C_STATE uregs
- ld r0, UREGS_lr(\uregs) /* load LR */
- mtlr r0
- ld r0, UREGS_xer(\uregs) /* load XER */
- mtxer r0
- lwz r0, UREGS_cr(\uregs) /* load CR */
- mtcr r0
-
- LOAD_GPRS r2, r12, \uregs /* load r2-r12 */
-.endm
-
-.macro LOADADDR reg symbol
- lis \reg,\symbol@highest
- ori \reg,\reg,\symbol@higher
- rldicr \reg,\reg,32,31
- oris \reg,\reg,\symbol@h
- ori \reg,\reg,\symbol@l
-.endm
-
-.macro CALL_CFUNC reg
- ld r2, 8(\reg) /* load function's TOC value */
- ld \reg, 0(\reg)
- mtctr \reg
- bctrl
- nop
-.endm
-
-.macro PMU_SAVE_STATE scratch
- mfspr \scratch,SPRN_MMCR0 /* ensure MMCR0[FCH] is 1 */
- ori \scratch,\scratch,MMCR0_FCH
- mtspr SPRN_MMCR0, \scratch
-.endm
-
-.macro EXCEPTION_HEAD parea continue
- /* make room for cpu_user_regs */
- subi r1, r1, STACK_VOLATILE_AREA + UREGS_sizeof
-
- /* get all we need from the processor_area */
- std r0, UREGS_r0(r1) /* get scratch register */
- ld r0, PAREA_r1(\parea)
- std r0, UREGS_r1(r1) /* save R1 */
- ld r0, PAREA_cr(\parea)
- stw r0, UREGS_cr(r1) /* save CR */
- mfspr r0, SPRN_HSPRG1
- std r0, UREGS_r13(r1) /* save R13 from HSPRG1 */
-
- /* Only _one_ larx is allowed at a time. Any future use will be
- * rejected until the earlier one (if any) completes. Since we
- * may have interrupted a larx in the Domain, or Xen we need to
- * clear any larx that may currently exist. We could probably
- * skip which for hcalls */
- ldx r0, 0, r1
- stdcx. r0, 0, r1
-
- /* save CTR and use it to jump */
- mfctr r0
- std r0, UREGS_ctr(r1)
- LOADADDR r0, \continue
- mtctr r0
-.endm
-
-/* For normal exceptions. */
-.macro EXCEPTION_SAVE_STATE uregs
- SAVE_C_STATE \uregs
-
- /* save DEC */
- mfdec r0
- ld r3, PAREA_vcpu(r13)
- stw r0, VCPU_dec(r3)
-
- /* save PC, MSR */
- mfspr r0, SPRN_SRR0
- std r0, UREGS_pc(\uregs)
- mfspr r0, SPRN_SRR1
- std r0, UREGS_msr(\uregs)
- li r0, -1 /* we clobbered the OS's SRR0/SRR1 to get here. */
- std r0, UREGS_srr0(\uregs)
- std r0, UREGS_srr1(\uregs)
-
- /* done with processor_area; re-enable MSR:RI */
- mfmsr r0
- ori r0, r0, MSR_RI@l
- mtmsrd r0
-
- PMU_SAVE_STATE r0
-.endm
-
-/* For exceptions that use HSRR0/1 (preserving the OS's SRR0/1). */
-.macro H_EXCEPTION_SAVE_STATE uregs
- SAVE_C_STATE \uregs
-
- /* save DEC */
- mfdec r0
- ld r3, PAREA_vcpu(r13)
- stw r0, VCPU_dec(r3)
-
- /* save PC, MSR */
- mfspr r0, SPRN_HSRR0
- std r0, UREGS_pc(\uregs)
- mfspr r0, SPRN_HSRR1
- std r0, UREGS_msr(\uregs)
- mfspr r0, SPRN_SRR0
- std r0, UREGS_srr0(\uregs)
- mfspr r0, SPRN_SRR1
- std r0, UREGS_srr1(\uregs)
-
- /* done with processor_area; re-enable MSR:RI */
- mfmsr r0
- ori r0, r0, MSR_RI@l
- mtmsrd r0
-
- PMU_SAVE_STATE r0
-.endm
-
-/* Hypervisor exception handling code; copied to physical address zero. */
- .align 3
- .globl exception_vectors
-exception_vectors:
-
- . = 0x0 # wild branch to 0
-zero:
- GET_STACK r13 SPRN_SRR1
- EXCEPTION_HEAD r13 ex_program_continued
- li r0, 0x0 /* exception vector for GDB stub */
- bctr
-
- /* The following byte array is where any per-CPU state flags
- * that can be be used across interrupts. Currently it is only used
- * to track Cache Inhibited Mode when a Machine Check occurs. */
- /* NOTE: This array is indexed by PIR NOT CPUID */
- . = MCK_CPU_STAT_BASE
- .space NR_CPUS
- . = MCK_GOOD_HID4
- .quad 0
- . = 0x100 # System Reset
-ex_reset:
- /* XXX thread initialization */
- GET_STACK r13 SPRN_SRR1
- EXCEPTION_HEAD r13 ex_program_continued
- li r0, 0x100 /* exception vector for GDB stub */
- bctr
-
- . = 0x200 # Machine Check
-ex_machcheck:
- /* Restore HID4 to a known state early, we do not recover from
- * machine check yet, but when we do we shoul dbe able to restore
- * HID4 to it proper value */
- mtspr SPRN_HSPRG1, r13
- ld r13, MCK_GOOD_HID4(0)
- sync
- mtspr SPRN_HID4, r13
- isync
- /* Hopefully we don't have to worry about the ERAT */
- mfspr r13, SPRN_HSPRG1
- /* and now back to our regularly schedualed program */
- GET_STACK r13 SPRN_SRR1
- EXCEPTION_HEAD r13 ex_machcheck_continued
- li r0, 0x200 /* exception vector for GDB stub */
- bctr
-
- . = 0x300
-ex_dsi:
- GET_STACK r13 SPRN_SRR1
- EXCEPTION_HEAD r13 ex_program_continued
- li r0, 0x300 /* exception vector for GDB stub */
- bctr
-
- . = 0x380
-ex_data_slb:
- GET_STACK r13 SPRN_SRR1
- EXCEPTION_HEAD r13 ex_program_continued
- li r0, 0x380 /* exception vector for GDB stub */
- bctr
-
- . = 0x400
-ex_isi:
- GET_STACK r13 SPRN_SRR1
- EXCEPTION_HEAD r13 ex_program_continued
- li r0, 0x400 /* exception vector for GDB stub */
- bctr
-
- . = 0x480
-ex_inst_slb:
- GET_STACK r13 SPRN_SRR1
- EXCEPTION_HEAD r13 ex_program_continued
- li r0, 0x480 /* exception vector for GDB stub */
- bctr
-
- . = 0x500
-ex_external:
- GET_STACK r13 SPRN_SRR1
- EXCEPTION_HEAD r13 ex_external_continued
- bctr
-
- . = 0x600
-ex_alignment:
- GET_STACK r13 SPRN_SRR1
- EXCEPTION_HEAD r13 ex_program_continued
- li r0, 0x600 /* exception vector for GDB stub */
- bctr
-
- . = 0x700
-ex_program:
- GET_STACK r13 SPRN_SRR1
- EXCEPTION_HEAD r13 ex_program_continued
- li r0, 0x700 /* exception vector for GDB stub */
- bctr
-
- . = 0x800
-ex_float:
- GET_STACK r13 SPRN_SRR1
- EXCEPTION_HEAD r13 ex_program_continued
- li r0, 0x800 /* exception vector for GDB stub */
- bctr
-
- . = 0x900
-ex_dec:
- /* delivered to hypervisor when MSR:EE is set... */
-#ifdef SLOW_TRAP
- GET_STACK r13 SPRN_SRR1
- EXCEPTION_HEAD r13 ex_dec_continued
- bctr
-#else
- /* XXX for now just reset DEC and return */
- mtspr SPRN_HSPRG1, r3
- lis r3, 0x7fff
- mtdec r3
- mfspr r3, SPRN_HSPRG1
- rfid
-#endif
-
- . = 0x980
-ex_hdec:
- GET_STACK r13 SPRN_HSRR1
- EXCEPTION_HEAD r13 ex_hdec_continued
- bctr
-
- . = 0xc00
-ex_syscall:
- GET_STACK r13 SPRN_SRR1
- EXCEPTION_HEAD r13 ex_hcall_continued
- bctr
-
- . = 0xd00
-ex_trace:
- GET_STACK r13 SPRN_SRR1
- EXCEPTION_HEAD r13 ex_program_continued
- li r0, 0xd00 /* exception vector for GDB stub */
- bctr
-
- . = 0xe00
-ex_fp:
- GET_STACK r13 SPRN_SRR1
- EXCEPTION_HEAD r13 ex_program_continued
- li r0, 0xe00 /* exception vector for GDB stub */
- bctr
-
- . = 0xf00
-ex_perfmon:
- GET_STACK r13 SPRN_SRR1
- EXCEPTION_HEAD r13 ex_perfmon_continued
- bctr
-
- .align 3
- .globl exception_vectors_end
-
-exception_vectors_end:
- /* put some stuff here so we see the next symbol */
- .long 0xdeadbeef
- .long 0xdeadbeef
-
-.macro FAST_RESUME
- LOAD_C_STATE r1 /* restore most C volatiles */
-
- ld r0, UREGS_ctr(r1)
- mtctr r0
-
- /* clear MSR:RI/EE to set SRR0/SRR1 */
- li r0, 0
- mtmsrd r0, 1
-
- ld r0, UREGS_pc(r1)
- mtspr SPRN_HSRR0, r0
- ld r0, UREGS_msr(r1)
- mtspr SPRN_HSRR1, r0
-
- ld r0, UREGS_srr0(r1)
- mtspr SPRN_SRR0, r0
- ld r0, UREGS_srr1(r1)
- mtspr SPRN_SRR1, r0
-
- ld r13, UREGS_r13(r1)
- ld r0, UREGS_r0(r1)
- ld r1, UREGS_r1(r1)
- HRFID
- b . /* prevent speculative icache fetch */
-.endm
-
-/* Not a whole lot just yet */
-ex_machcheck_continued:
-
-
-/* We enter with the exception number in r0. The EXCEPTION_SAVE_STATE macro
- * clobbers r0 though, so we have to move it around a little bit. Not ideal,
- * but hopefully program exception is not performance-critical... Maybe there's
- * a better way, but this works for now. */
-ex_program_continued:
- SAVE_GPRS r14, r31, r1 /* save all the non-volatiles */
-
- /* save these for debug, no needed for restore */
- mfspr r14, SPRN_HID4
- std r14, UREGS_hid4(r1)
- mfdar r14
- std r14, UREGS_dar(r1)
- mfdsisr r14
- stw r14, UREGS_dsisr(r1)
-
- mr r14, r0
- EXCEPTION_SAVE_STATE r1
- mr r4, r14
- LOADADDR r12, program_exception
- mr r3, r1 /* pass pointer to cpu_user_regs */
- subi r1, r1, STACK_FRAME_OVERHEAD /* make a "caller" stack frame */
- CALL_CFUNC r12
-
- /* reload state and rfid */
- addi r1, r1, STACK_FRAME_OVERHEAD /* restore stack to cpu_user_regs */
- LOAD_GPRS r14, r31, r1
- FAST_RESUME
-
-ex_external_continued:
- EXCEPTION_SAVE_STATE r1
- LOADADDR r12, do_external
- mr r3, r1 /* pass pointer to cpu_user_regs */
- subi r1, r1, STACK_FRAME_OVERHEAD /* make a "caller" stack frame */
- CALL_CFUNC r12
-
- addi r1, r1, STACK_FRAME_OVERHEAD /* restore stack to cpu_user_regs */
- b fast_resume
-
-ex_hcall_continued:
- /* We have to save the non-volatiles here in case of a block hcall (which
- * will end up in context_switch()). */
- SAVE_GPRS r14, r31, r1
- EXCEPTION_SAVE_STATE r1
- LOADADDR r12, do_hcall
- mr r3, r1 /* pass pointer to cpu_user_regs */
- subi r1, r1, STACK_FRAME_OVERHEAD /* make a "caller" stack frame */
- CALL_CFUNC r12 /* call hcall handler */
-
- /* test for pending softirqs, and loop until there are no more. */
- mfmsr r14
- ori r14, r14, MSR_EE
- xori r15, r14, MSR_EE
-
-hcall_test_all_events:
- mtmsrd r15, 1 /* disable interrupts */
- ld r3, PAREA_vcpu(r13)
- lwz r3, VCPU_processor(r3)
- LOADADDR r4, irq_stat
- sldi r3, r3, IRQSTAT_shift
- add r4, r3, r4
- ld r5, IRQSTAT_pending(r4)
- cmpldi r5, 0
- beq hcall_out /* no more softirqs; exit loop */
-
- LOADADDR r6, do_softirq
- mtmsrd r14, 1 /* enable interrupts */
- CALL_CFUNC r6 /* process softirqs */
- b hcall_test_all_events /* look for more */
-
-hcall_out:
- addi r1, r1, STACK_FRAME_OVERHEAD /* restore stack to cpu_user_regs */
- LOAD_GPRS r14, r15, r1 /* we clobbered r14/r15 */
- b fast_resume
-
-
-ex_dec_continued:
- EXCEPTION_SAVE_STATE r1
- LOADADDR r12, do_dec
- mr r3, r1 /* pass pointer to cpu_user_regs */
- subi r1, r1, STACK_FRAME_OVERHEAD /* make a "caller" stack frame */
- CALL_CFUNC r12
-
- addi r1, r1, STACK_FRAME_OVERHEAD /* restore stack to cpu_user_regs */
- b fast_resume
-
-ex_perfmon_continued:
- EXCEPTION_SAVE_STATE r1
- LOADADDR r12, do_perfmon
- mr r3, r1 /* pass pointer to cpu_user_regs */
- subi r1, r1, STACK_FRAME_OVERHEAD /* make a "caller" stack frame */
- CALL_CFUNC r12
-
- addi r1, r1, STACK_FRAME_OVERHEAD /* restore stack to cpu_user_regs */
- b fast_resume
-
-ex_hdec_continued:
- /* When we get an HDEC, we (almost?) always context_switch, so we need to
- * save the nonvolatiles. */
- SAVE_GPRS r14, r31, r1
- H_EXCEPTION_SAVE_STATE r1
-
- LOADADDR r12, do_timer
- mr r3, r1
- subi r1, r1, STACK_FRAME_OVERHEAD /* make a "caller" stack frame */
- CALL_CFUNC r12
-
- /* if we are resuming into hypervisor, don't handle softirqs */
- ld r10, (UREGS_msr + STACK_FRAME_OVERHEAD)(r1)
- rldicl. r11, r10, 4, 63 /* test SRR1:HV */
- bne hdec_out
-
- /* test for pending softirqs, and loop until there are no more. */
- mfmsr r14
- ori r14, r14, MSR_EE
- xori r15, r14, MSR_EE
-test_all_events:
- mtmsrd r15, 1 /* disable interrupts */
- ld r3, PAREA_vcpu(r13)
- lwz r3, VCPU_processor(r3)
- LOADADDR r4, irq_stat
- sldi r3, r3, IRQSTAT_shift
- add r4, r3, r4
- ld r5, IRQSTAT_pending(r4)
- cmpldi r5, 0
- beq hdec_out /* no more softirqs; exit loop */
-
- LOADADDR r6, do_softirq
- mtmsrd r14, 1 /* enable interrupts */
- CALL_CFUNC r6 /* process softirqs */
- b test_all_events /* look for more */
-
-hdec_out:
- addi r1, r1, STACK_FRAME_OVERHEAD /* restore stack to cpu_user_regs */
- LOAD_GPRS r14, r15, r1 /* we clobbered r14/r15 in the loop */
-
-/* r1 points to the to-be-restored cpu_user_regs. These could be mid-hypervisor
- * stack (returning into elsewhere in Xen) or at the top of the stack
- * (restoring the domain). */
-_GLOBAL(full_resume)
- /* disable MSR:EE, since we could have come from do_softirq() */
- mfmsr r7
- ori r7, r7, MSR_EE
- xori r7, r7, MSR_EE
- mtmsrd r7, 1
-
- LOAD_GPRS r14, r31, r1 /* restore all non-volatiles */
-
-fast_resume:
- ld r10, UREGS_msr(r1)
- rldicl. r11, r10, 4, 63 /* test SRR1:HV */
- bne 1f /* returning to hypervisor */
-
- /* check for pending irqs */
- mr r3, r1
- subi r1, r1, STACK_FRAME_OVERHEAD
- bl .deliver_ee
- addi r1, r1, STACK_FRAME_OVERHEAD
-
- /* if we took a DEC in hypervisor mode, we don't want to reload the DEC
- * until we return to the domain. MSR_EE is clear, so the domain will take
- * any impending DEC. */
- ld r3, PAREA_vcpu(r13)
- lwz r0, VCPU_dec(r3)
- mtdec r0
-
-1:
- FAST_RESUME
- /* not reached */
-
-/* move all of the below somewhere else */
-
-_GLOBAL(papr_hcall_jump)
- mtctr r4
- bctr
- /* return to caller via LR */
-
-/* XXX don't need to load all the registers */
-_GLOBAL(xen_hvcall_jump)
- mtctr r4
- ld r10, (UREGS_gprs + GPR_WIDTH * 11)(r3)
- ld r9, (UREGS_gprs + GPR_WIDTH * 10)(r3)
- ld r8, (UREGS_gprs + GPR_WIDTH * 9)(r3)
- ld r7, (UREGS_gprs + GPR_WIDTH * 8)(r3)
- ld r6, (UREGS_gprs + GPR_WIDTH * 7)(r3)
- ld r5, (UREGS_gprs + GPR_WIDTH * 6)(r3)
- ld r4, (UREGS_gprs + GPR_WIDTH * 5)(r3)
- ld r3, (UREGS_gprs + GPR_WIDTH * 4)(r3)
- bctr
-
-_GLOBAL(_reset_stack_and_jump)
- ld r2, 8(r3)
- ld r3, 0(r3)
- mtctr r3
- mr r1, r4
- bctr
-
-_GLOBAL(sleep)
- mfmsr r3
- ori r4, r3, MSR_EE
- oris r4, r4, MSR_POW@h
- sync
- mtmsrd r4
- isync
- mtmsrd r3
- blr
-
-/* The primary processor issues a firmware call to spin us up at this
- * address, passing our CPU number in r3. We only need a function
- * entry point instead of a descriptor since this is never called from
- * C code.
- */
- .globl spin_start
-spin_start:
- /* We discovered by experiment that the ERAT must be flushed early. */
- isync
- slbia
- isync
-
- /* Do a cache flush for our text, in case the loader didn't */
- LOADADDR(r9, _start)
- LOADADDR(r8, _etext)
-4: dcbf r0,r9
- icbi r0,r9
- addi r9,r9,0x20 /* up to a 4 way set per line */
- cmpld cr0,r9,r8
- blt 4b
- sync
- isync
-
- /* Write our processor number as an acknowledgment that we're alive. */
- LOADADDR(r14, __spin_ack)
- stw r3, 0(r14)
- sync
- /* If NR_CPUS is too small, we should just spin forever. */
- LOADADDR(r15, NR_CPUS)
- cmpd r3, r15
- blt 2f
- b .
- /* Find our index in the array of processor_area struct pointers. */
-2: LOADADDR(r14, global_cpu_table)
- mulli r15, r3, 8
- add r14, r14, r15
- /* Spin until the pointer for our processor goes valid. */
-1: ld r15, 0(r14)
- cmpldi r15, 0
- beq 1b
- /* Dereference the pointer and load our stack pointer. */
- isync
- ld r1, PAREA_stack(r15)
- li r14, STACK_FRAME_OVERHEAD
- sub r1, r1, r14
- /* Load up the TOC and entry point for the C function to be called. */
- LOADADDR(r14, secondary_cpu_init)
- ld r2, 8(r14)
- ld r11, 0(r14)
- mtctr r11
- /* Warning: why do we need this synchronizing instruction on 970FX? */
- isync
- /* Jump into C code now. */
- bctrl
- nop
- b .
diff --git a/xen/arch/powerpc/powerpc64/hypercall_table.S b/xen/arch/powerpc/powerpc64/hypercall_table.S
deleted file mode 100644
index 090b9592ef..0000000000
--- a/xen/arch/powerpc/powerpc64/hypercall_table.S
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <asm/config.h>
-
- .data
- .align 3
- .globl __hypercall_table
-__hypercall_table:
- .quad 0 /* do_set_trap_table */ /* 0 */
- .quad 0 /* do_mmu_update */
- .quad 0 /* do_set_gdt */
- .quad 0 /* do_stack_switch */
- .quad 0 /* do_set_callbacks */
- .quad 0 /* do_fpu_taskswitch */ /* 5 */
- .quad do_sched_op
- .quad 0 /* do_platform_op */
- .quad 0 /* do_set_debugreg */
- .quad 0 /* do_get_debugreg */
- .quad 0 /* do_update_descriptor */ /* 10 */
- .quad do_ni_hypercall
- .quad do_memory_op
- .quad 0 /* do_multicall */
- .quad 0 /* do_update_va_mapping */
- .quad do_set_timer_op /* 15 */
- .quad 0 /* do_event_channel_op_compat */
- .quad do_xen_version
- .quad do_console_io
- .quad 0 /* do_physdev_op_compat */
- .quad do_grant_table_op /* 20 */
- .quad do_vm_assist
- .quad 0 /* do_update_va_mapping_otherdomain */
- .quad do_rtas_proxy /* do_switch_vm86 */
- .quad do_vcpu_op
- .quad do_ni_hypercall /* 25 */
- .quad 0 /* do_mmuext_op */
- .quad do_acm_op
- .quad do_nmi_op
- .quad do_sched_op /* do_arch_sched_op */
- .quad 0 /* do_callback_op */ /* 30 */
- .quad 0 /* do_xenoprof_op */
- .quad do_event_channel_op
- .quad do_physdev_op
- .quad 0 /* do_hvm_op */
- .quad do_sysctl /* 35 */
- .quad do_domctl
- .rept NR_hypercalls-((.-__hypercall_table)/8)
- .quad do_ni_hypercall
- .endr
diff --git a/xen/arch/powerpc/powerpc64/io.S b/xen/arch/powerpc/powerpc64/io.S
deleted file mode 100644
index 7a12b78ea5..0000000000
--- a/xen/arch/powerpc/powerpc64/io.S
+++ /dev/null
@@ -1,193 +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@watson.ibm.com>
- * Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#include <asm/config.h>
-#include <asm/processor.h>
-#include <asm/percpu.h>
-
-/* There is no reason why I can't use a tlbie, which should be less
- * "destructive" but useing SLBIE proves to be more stable result.
- */
-#define INVALIDATE_ERAT_WITH_SLBIE
-
-/* Xen runs in real mode (i.e. untranslated, MMU disabled). This avoids TLB
- * flushes and also makes it easy to access all domains' memory. However, on
- * PowerPC real mode accesses are cacheable, which is good for general
- * performance, but not good when trying to do IO.
- *
- * POWER4 and PowerPC 970 have a bit (RM_CI: Real Mode Cache Inhibit) in HID4
- * which disables the data cache when running in real mode. Unfortunately, to
- * change RM_CI we need to go through a fairly complicated set of instructions,
- * make the access, then re-enable it...
- */
-
-#ifdef INVALIDATE_ERAT_WITH_SLBIE
-/* Not all useful assemblers understand 'tlbiel'.
- * 'addr' is a GPR containing the address being accessed.
- */
-.macro tlbiel addr
- .long 0x7c000224 | (\addr << 11)
-.endm
-#endif
-
-.macro DISABLE_DCACHE addr
- mfmsr r8
- /* disable interrupts */
- li r6, 0
- ori r6, r6, MSR_EE
- andc r5, r8, r6
- mtmsr r5
- sync
-
-#ifdef INVALIDATE_ERAT_WITH_SLBIE
- /* create an slbie entry for the io setting a high order bit
- * to avoid any important SLBs */
- extldi r0, \addr, 36, 0
-#endif
- /* setup HID4.RM_CI */
- mfspr r9, SPRN_HID4
- li r6, 0x100
- sldi r6, r6, 32
- or r10, r9, r6
-
- /* Mark the processor as "in CI mode" */
- li r7,0
- mfspr r5, SPRN_PIR
- li r6, MCK_CPU_STAT_CI
- /* store that we are in a CI routine */
- stb r6, MCK_CPU_STAT_BASE(r5)
- /* r7 = MCK_CPU_STAT_CI IO in progress */
- mr r7, r5
- lwsync
-
- /* switch modes */
- mtspr SPRN_HID4, r10
- /* invalidate the ERAT entry */
-#ifdef INVALIDATE_ERAT_WITH_SLBIE
- slbie r0
-#else
- tlbiel \addr
-#endif
- isync
-
-.endm
-
-.macro ENABLE_DCACHE addr
- /* r7 = 0, IO is complete */
- li r7, 0
- lwsync
- /* restore HID4.RM_CI */
- mtspr SPRN_HID4, r9
- /* invalidate the ERAT entry */
-#ifdef INVALIDATE_ERAT_WITH_SLBIE
- slbie r0
-#else
- tlbiel \addr /* invalidate the ERAT entry */
-#endif
- isync
-
- /* Mark the processor as "out of CI mode" */
- mfspr r5, SPRN_PIR
- li r6, 0
- stb r6, MCK_CPU_STAT_BASE(r5)
- sync
-
- /* re-enable interrupts */
- mtmsr r8
-.endm
-
-/* The following assembly cannot use some registers since they hold original
- * values of we need to keep
- */
-#undef r0
-#define r0 do_not_use_r0
-#undef r7
-#define r7 do_not_use_r7
-#undef r8
-#define r8 do_not_use_r8
-#undef r9
-#define r9 do_not_use_r9
-
-/* XXX remove isyncs */
-
-_GLOBAL(in_8)
- DISABLE_DCACHE r3
- lbz r4,0(r3)
- twi 0,r4,0
- isync
- ENABLE_DCACHE r3
- mr r3, r4
- blr
-
-_GLOBAL(out_8)
- DISABLE_DCACHE r3
- stb r4,0(r3)
- sync
- ENABLE_DCACHE r3
- blr
-
-_GLOBAL(in_32)
- DISABLE_DCACHE r3
- lwz r4,0(r3)
- twi 0,r4,0
- isync
- ENABLE_DCACHE r3
- mr r3, r4
- blr
-
-_GLOBAL(out_32)
- DISABLE_DCACHE r3
- stw r4,0(r3)
- sync
- ENABLE_DCACHE r3
- blr
-
-_GLOBAL(in_le16)
- DISABLE_DCACHE r3
- lhbrx r4,0,r3
- twi 0,r4,0
- isync
- ENABLE_DCACHE r3
- mr r3, r4
- blr
-
-_GLOBAL(out_le16)
- DISABLE_DCACHE r3
- sthbrx r4,0,r3
- sync
- ENABLE_DCACHE r3
- blr
-
-_GLOBAL(in_le32)
- DISABLE_DCACHE r3
- lwbrx r4,0,r3
- twi 0,r4,0
- isync
- ENABLE_DCACHE r3
- mr r3, r4
- blr
-
-_GLOBAL(out_le32)
- DISABLE_DCACHE r3
- stwbrx r4,0,r3
- sync
- ENABLE_DCACHE r3
- blr
diff --git a/xen/arch/powerpc/powerpc64/memcpy.S b/xen/arch/powerpc/powerpc64/memcpy.S
deleted file mode 100644
index e2a2c400cc..0000000000
--- a/xen/arch/powerpc/powerpc64/memcpy.S
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (C) 2002 Paul Mackerras, IBM Corp.
- *
- * 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 <asm/config.h>
-#include <asm/processor.h>
-
- .align 7
-_GLOBAL(memcpy)
- mtcrf 0x01,r5
- cmpldi cr1,r5,16
- neg r6,r3 # LS 3 bits = # bytes to 8-byte dest bdry
- andi. r6,r6,7
- dcbt 0,r4
- blt cr1,.Lshort_copy
- bne .Ldst_unaligned
-.Ldst_aligned:
- andi. r0,r4,7
- addi r3,r3,-16
- bne .Lsrc_unaligned
- srdi r7,r5,4
- ld r9,0(r4)
- addi r4,r4,-8
- mtctr r7
- andi. r5,r5,7
- bf cr7*4+0,2f
- addi r3,r3,8
- addi r4,r4,8
- mr r8,r9
- blt cr1,3f
-1: ld r9,8(r4)
- std r8,8(r3)
-2: ldu r8,16(r4)
- stdu r9,16(r3)
- bdnz 1b
-3: std r8,8(r3)
- beqlr
- addi r3,r3,16
- ld r9,8(r4)
-.Ldo_tail:
- bf cr7*4+1,1f
- rotldi r9,r9,32
- stw r9,0(r3)
- addi r3,r3,4
-1: bf cr7*4+2,2f
- rotldi r9,r9,16
- sth r9,0(r3)
- addi r3,r3,2
-2: bf cr7*4+3,3f
- rotldi r9,r9,8
- stb r9,0(r3)
-3: blr
-
-.Lsrc_unaligned:
- srdi r6,r5,3
- addi r5,r5,-16
- subf r4,r0,r4
- srdi r7,r5,4
- sldi r10,r0,3
- cmpdi cr6,r6,3
- andi. r5,r5,7
- mtctr r7
- subfic r11,r10,64
- add r5,r5,r0
-
- bt cr7*4+0,0f
-
- ld r9,0(r4) # 3+2n loads, 2+2n stores
- ld r0,8(r4)
- sld r6,r9,r10
- ldu r9,16(r4)
- srd r7,r0,r11
- sld r8,r0,r10
- or r7,r7,r6
- blt cr6,4f
- ld r0,8(r4)
- # s1<< in r8, d0=(s0<<|s1>>) in r7, s3 in r0, s2 in r9, nix in r6 & r12
- b 2f
-
-0: ld r0,0(r4) # 4+2n loads, 3+2n stores
- ldu r9,8(r4)
- sld r8,r0,r10
- addi r3,r3,-8
- blt cr6,5f
- ld r0,8(r4)
- srd r12,r9,r11
- sld r6,r9,r10
- ldu r9,16(r4)
- or r12,r8,r12
- srd r7,r0,r11
- sld r8,r0,r10
- addi r3,r3,16
- beq cr6,3f
-
- # d0=(s0<<|s1>>) in r12, s1<< in r6, s2>> in r7, s2<< in r8, s3 in r9
-1: or r7,r7,r6
- ld r0,8(r4)
- std r12,8(r3)
-2: srd r12,r9,r11
- sld r6,r9,r10
- ldu r9,16(r4)
- or r12,r8,r12
- stdu r7,16(r3)
- srd r7,r0,r11
- sld r8,r0,r10
- bdnz 1b
-
-3: std r12,8(r3)
- or r7,r7,r6
-4: std r7,16(r3)
-5: srd r12,r9,r11
- or r12,r8,r12
- std r12,24(r3)
- beqlr
- cmpwi cr1,r5,8
- addi r3,r3,32
- sld r9,r9,r10
- ble cr1,.Ldo_tail
- ld r0,8(r4)
- srd r7,r0,r11
- or r9,r7,r9
- b .Ldo_tail
-
-.Ldst_unaligned:
- mtcrf 0x01,r6 # put #bytes to 8B bdry into cr7
- subf r5,r6,r5
- li r7,0
- cmpldi r1,r5,16
- bf cr7*4+3,1f
- lbz r0,0(r4)
- stb r0,0(r3)
- addi r7,r7,1
-1: bf cr7*4+2,2f
- lhzx r0,r7,r4
- sthx r0,r7,r3
- addi r7,r7,2
-2: bf cr7*4+1,3f
- lwzx r0,r7,r4
- stwx r0,r7,r3
-3: mtcrf 0x01,r5
- add r4,r6,r4
- add r3,r6,r3
- b .Ldst_aligned
-
-.Lshort_copy:
- bf cr7*4+0,1f
- lwz r0,0(r4)
- lwz r9,4(r4)
- addi r4,r4,8
- stw r0,0(r3)
- stw r9,4(r3)
- addi r3,r3,8
-1: bf cr7*4+1,2f
- lwz r0,0(r4)
- addi r4,r4,4
- stw r0,0(r3)
- addi r3,r3,4
-2: bf cr7*4+2,3f
- lhz r0,0(r4)
- addi r4,r4,2
- sth r0,0(r3)
- addi r3,r3,2
-3: bf cr7*4+3,4f
- lbz r0,0(r4)
- stb r0,0(r3)
-4: blr
-
diff --git a/xen/arch/powerpc/powerpc64/ppc970.c b/xen/arch/powerpc/powerpc64/ppc970.c
deleted file mode 100644
index 415f8bbdce..0000000000
--- a/xen/arch/powerpc/powerpc64/ppc970.c
+++ /dev/null
@@ -1,302 +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@us.ibm.com>
- * Jimi Xenidis <jimix@watson.ibm.com>
- * Amos Waterland <apw@us.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/mm.h>
-#include <xen/sched.h>
-#include <xen/lib.h>
-#include <asm/time.h>
-#include <asm/current.h>
-#include <asm/powerpc64/procarea.h>
-#include <asm/powerpc64/processor.h>
-#include <asm/powerpc64/ppc970-hid.h>
-#include "scom.h"
-
-#undef DEBUG
-#undef SERIALIZE
-
-struct cpu_caches cpu_caches = {
- .dline_size = 0x80,
- .log_dline_size = 7,
- .dlines_per_page = PAGE_SIZE >> 7,
- .isize = (64 << 10), /* 64 KiB */
- .iline_size = 0x80,
- .log_iline_size = 7,
- .ilines_per_page = PAGE_SIZE >> 7,
-};
-
-
-void cpu_flush_icache(void)
-{
- union hid1 hid1;
- ulong flags;
- ulong ea;
-
- local_irq_save(flags);
-
- /* uses special processor mode that forces a real address match on
- * the whole line */
- hid1.word = mfhid1();
- hid1.bits.en_icbi = 1;
- mthid1(hid1.word);
-
- for (ea = 0; ea < cpu_caches.isize; ea += cpu_caches.iline_size)
- icbi(ea);
-
- sync();
-
- hid1.bits.en_icbi = 0;
- mthid1(hid1.word);
-
- local_irq_restore(flags);
-}
-
-
-struct rma_settings {
- int log;
- int rmlr_0;
- int rmlr_1_2;
-};
-
-static struct rma_settings rma_logs[] = {
- { .log = 26, .rmlr_0 = 0, .rmlr_1_2 = 3, }, /* 64 MB */
- { .log = 27, .rmlr_0 = 1, .rmlr_1_2 = 3, }, /* 128 MB */
- { .log = 28, .rmlr_0 = 1, .rmlr_1_2 = 0, }, /* 256 MB */
- { .log = 30, .rmlr_0 = 0, .rmlr_1_2 = 2, }, /* 1 GB */
- { .log = 34, .rmlr_0 = 0, .rmlr_1_2 = 1, }, /* 16 GB */
- { .log = 38, .rmlr_0 = 0, .rmlr_1_2 = 0, }, /* 256 GB */
-};
-
-static uint log_large_page_sizes[] = {
- 4 + 20, /* (1 << 4) == 16M */
-};
-
-static struct rma_settings *cpu_find_rma(unsigned int log)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(rma_logs); i++) {
- if (rma_logs[i].log == log)
- return &rma_logs[i];
- }
- return NULL;
-}
-
-unsigned int cpu_default_rma_order_pages(void)
-{
- return rma_logs[0].log - PAGE_SHIFT;
-}
-
-int cpu_rma_valid(unsigned int order)
-{
- return cpu_find_rma(order + PAGE_SHIFT) != NULL;
-}
-
-unsigned int cpu_large_page_orders(uint *sizes, uint max)
-{
- uint i = 0;
-
- while (i < max && i < ARRAY_SIZE(log_large_page_sizes)) {
- sizes[i] = log_large_page_sizes[i] - PAGE_SHIFT;
- ++i;
- }
-
- return i;
-}
-
-unsigned int cpu_extent_order(void)
-{
- return log_large_page_sizes[0] - PAGE_SHIFT;
-}
-
-int cpu_threads(int cpuid)
-{
- return 1;
-}
-
-
-static u64 cpu0_hids[6];
-static u64 cpu0_hior;
-
-void cpu_initialize(int cpuid)
-{
- union hid0 hid0;
- union hid1 hid1;
- union hid4 hid4;
- union hid5 hid5;
-
- if (cpuid == 0) {
- /* we can assume that these are sane to start with. We
- * _do_not_ store the results in case we want to mess with them
- * on a per-cpu basis later. */
- cpu0_hids[0] = mfhid0();
- cpu0_hids[1] = mfhid1();
- cpu0_hids[4] = mfhid4();
- cpu0_hids[5] = mfhid5();
- cpu0_hior = 0;
- }
-
- hid0.word = cpu0_hids[0];
- hid1.word = cpu0_hids[1];
- hid4.word = cpu0_hids[4];
- hid5.word = cpu0_hids[5];
-
- /* This is SMP safe because the compiler must use r13 for it. */
- parea = global_cpu_table[cpuid];
- ASSERT(parea != NULL);
-
- mthsprg0((ulong)parea); /* now ready for exceptions */
-
- printk("CPU[PIR:%u IPI:%u Logical:%u] Hello World!\n",
- mfpir(), hard_smp_processor_id(), smp_processor_id());
-
-#ifdef DEBUG
- {
- ulong r1, r2;
-
- asm volatile ("mr %0, 1" : "=r" (r1));
- asm volatile ("mr %0, 2" : "=r" (r2));
- printk(" SP = %lx TOC = %lx\n", r1, r2);
- }
-#endif
-
- /* Set decrementers for 1 second to keep them out of the way during
- * intialization. */
- /* XXX make tickless */
- mtdec(timebase_freq);
- mthdec(timebase_freq);
-
- /* FIXME Do not set the NAP bit in HID0 until we have had a chance
- * to audit the safe halt and idle loop code. */
- hid0.bits.nap = 0; /* NAP */
- hid0.bits.dpm = 1; /* Dynamic Power Management */
-
- hid0.bits.nhr = 1; /* Not Hard Reset */
- hid0.bits.hdice_en = 1; /* enable HDEC */
- hid0.bits.en_therm = 0; /* ! Enable ext thermal ints */
- /* only debug Xen should activate ATTN */
- hid0.bits.en_attn = 1; /* Enable attn instruction */
- hid0.bits.en_mck = 1; /* Enable external machine check interrupts */
-
-#ifdef SERIALIZE
- hid0.bits.one_ppc = 1;
- hid0.bits.isync_sc = 1;
- hid0.bits.inorder = 1;
- /* may not want these */
- hid0.bits.do_single = 1;
- hid0.bits.ser-gp = 1;
-#endif
-
- mthid0(hid0.word);
-
- hid1.bits.bht_pm = 7; /* branch history table prediction mode */
- hid1.bits.en_ls = 1; /* enable link stack */
-
- hid1.bits.en_cc = 1; /* enable count cache */
- hid1.bits.en_ic = 1; /* enable inst cache */
-
- hid1.bits.pf_mode = 2; /* prefetch mode */
-
- hid1.bits.en_if_cach = 1; /* i-fetch cacheability control */
- hid1.bits.en_ic_rec = 1; /* i-cache parity error recovery */
- hid1.bits.en_id_rec = 1; /* i-dir parity error recovery */
- hid1.bits.en_er_rec = 1; /* i-ERAT parity error recovery */
-
- hid1.bits.en_sp_itw = 1; /* En speculative tablewalks */
- mthid1(hid1.word);
-
- /* no changes to hid4 but we want to make sure that secondaries
- * are sane */
- hid4.bits.lg_pg_dis = 0; /* make sure we enable large pages */
- mthid4(hid4.word);
-
- hid5.bits.DC_mck = 1; /* Machine check enabled for dcache errors */
- hid5.bits.DCBZ_size = 0; /* make dcbz size 32 bytes */
- hid5.bits.DCBZ32_ill = 0; /* make dzbz 32byte illeagal */
- mthid5(hid5.word);
-
-#ifdef DEBUG
- printk("hid0 0x%016lx\n"
- "hid1 0x%016lx\n"
- "hid4 0x%016lx\n"
- "hid5 0x%016lx\n",
- mfhid0(), mfhid1(), mfhid4(), mfhid5());
-#endif
-
- /* Make sure firmware has not left this dirty */
- mthior(cpu0_hior);
-
- /* some machine check goodness */
- /* save this for checkstop processing */
- if (cpuid == 0)
- *mck_good_hid4 = hid4.word;
-
- if (mfpir() > NR_CPUS)
- panic("we do not expect a processor to have a PIR (%u) "
- "to be larger that NR_CPUS(%u)\n",
- mfpir(), NR_CPUS);
-
- cpu_scom_init();
-
- /* initialize the SLB */
-#ifdef DEBUG
- dump_segments(1);
-#endif
- flush_segments();
- local_flush_tlb();
-}
-
-void cpu_init_vcpu(struct vcpu *v)
-{
- struct domain *d = v->domain;
- union hid4 hid4;
- struct rma_settings *rma_settings;
-
- hid4.word = mfhid4();
-
- hid4.bits.lpes_0 = 0; /* external exceptions set MSR_HV=1 */
- hid4.bits.lpes_1 = 1; /* RMA applies */
-
- hid4.bits.rmor_0_15 = page_to_maddr(d->arch.rma_page) >> 26;
-
- hid4.bits.lpid_0_1 = d->domain_id & 3;
- hid4.bits.lpid_2_5 = (d->domain_id >> 2) & 0xf;
-
- rma_settings = cpu_find_rma(d->arch.rma_order + PAGE_SHIFT);
- ASSERT(rma_settings != NULL);
- hid4.bits.rmlr_0 = rma_settings->rmlr_0;
- hid4.bits.rmlr_1_2 = rma_settings->rmlr_1_2;
-
- v->arch.cpu.hid4.word = hid4.word;
-}
-
-void save_cpu_sprs(struct vcpu *v)
-{
- /* HID4 is initialized with a per-domain value at domain creation time, and
- * does not change after that. */
-}
-
-void load_cpu_sprs(struct vcpu *v)
-{
- mthid4(v->arch.cpu.hid4.word);
-}
diff --git a/xen/arch/powerpc/powerpc64/ppc970_machinecheck.c b/xen/arch/powerpc/powerpc64/ppc970_machinecheck.c
deleted file mode 100644
index 53fc3e5cd5..0000000000
--- a/xen/arch/powerpc/powerpc64/ppc970_machinecheck.c
+++ /dev/null
@@ -1,125 +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: Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/lib.h>
-#include <public/xen.h>
-#include <asm/processor.h>
-#include <asm/percpu.h>
-#include <asm/debugger.h>
-#include "scom.h"
-
-#define MCK_SRR1_INSN_FETCH_UNIT 0x0000000000200000 /* 42 */
-#define MCK_SRR1_LOAD_STORE 0x0000000000100000 /* 43 */
-#define MCK_SRR1_CAUSE_MASK 0x00000000000c0000 /* 44:45 */
-#define MCK_SRR1_CAUSE_NONE 0x0000000000000000 /* 0b00 */
-#define MCK_SRR1_CAUSE_SLB_PAR 0x0000000000040000 /* 0b01 */
-#define MCK_SRR1_CAUSE_TLB_PAR 0x0000000000080000 /* 0b10 */
-#define MCK_SRR1_CAUSE_UE 0x00000000000c0000 /* 0b11 */
-#define MCK_SRR1_RI MSR_RI
-
-#define MCK_DSISR_UE 0x00008000 /* 16 */
-#define MCK_DSISR_UE_TABLE_WALK 0x00004000 /* 17 */
-#define MCK_DSISR_L1_DCACHE_PAR 0x00002000 /* 18 */
-#define MCK_DSISR_L1_DCACHE_TAG_PAR 0x00001000 /* 19 */
-#define MCK_DSISR_D_ERAT_PAR 0x00000800 /* 20 */
-#define MCK_DSISR_TLB_PAR 0x00000400 /* 21 */
-#define MCK_DSISR_SLB_PAR 0x00000100 /* 23 */
-
-int cpu_machinecheck(struct cpu_user_regs *regs)
-{
- int recover = 0;
- u32 dsisr = mfdsisr();
-
- if (regs->msr & MCK_SRR1_RI)
- recover = 1;
-
- printk("MACHINE CHECK: %s Recoverable\n", recover ? "IS": "NOT");
- if (mck_cpu_stats[mfpir()] != 0)
- printk("While in CI IO\n");
-
- show_backtrace_regs(regs);
-
- printk("SRR1: 0x%016lx\n", regs->msr);
- if (regs->msr & MCK_SRR1_INSN_FETCH_UNIT)
- printk("42: Exception caused by Instruction Fetch Unit (IFU)\n"
- " detection of a hardware uncorrectable error (UE).\n");
-
- if (regs->msr & MCK_SRR1_LOAD_STORE)
- printk("43: Exception caused by load/store detection of error\n"
- " (see DSISR)\n");
-
- switch (regs->msr & MCK_SRR1_CAUSE_MASK) {
- case 0:
- printk("0b00: Likely caused by an asynchronous machine check,\n"
- " see SCOM Asynchronous Machine Check Register\n");
- cpu_scom_AMCR();
- break;
- case MCK_SRR1_CAUSE_SLB_PAR:
- printk("0b01: Exception caused by an SLB parity error detected\n"
- " while translating an instruction fetch address.\n");
- break;
- case MCK_SRR1_CAUSE_TLB_PAR:
- printk("0b10: Exception caused by a TLB parity error detected\n"
- " while translating an instruction fetch address.\n");
- break;
- case MCK_SRR1_CAUSE_UE:
- printk("0b11: Exception caused by a hardware uncorrectable\n"
- " error (UE) detected while doing a reload of an\n"
- " instruction-fetch TLB tablewalk.\n");
- break;
- }
-
- printk("\nDSISR: 0x%08x\n", dsisr);
- if (dsisr & MCK_DSISR_UE)
- printk("16: Exception caused by a UE deferred error\n"
- " (DAR is undefined).\n");
-
- if (dsisr & MCK_DSISR_UE_TABLE_WALK)
- printk("17: Exception caused by a UE deferred error\n"
- " during a tablewalk (D-side).\n");
-
- if (dsisr & MCK_DSISR_L1_DCACHE_PAR)
- printk("18: Exception was caused by a software recoverable\n"
- " parity error in the L1 D-cache.\n");
-
- if (dsisr & MCK_DSISR_L1_DCACHE_TAG_PAR)
- printk("19: Exception was caused by a software recoverable\n"
- " parity error in the L1 D-cache tag.\n");
-
- if (dsisr & MCK_DSISR_D_ERAT_PAR)
- printk("20: Exception was caused by a software recoverable parity\n"
- " error in the D-ERAT.\n");
-
- if (dsisr & MCK_DSISR_TLB_PAR)
- printk("21: Exception was caused by a software recoverable parity\n"
- " error in the TLB.\n");
-
- if (dsisr & MCK_DSISR_SLB_PAR) {
- printk("23: Exception was caused by an SLB parity error (may not be\n"
- " recoverable). This condition could occur if the\n"
- " effective segment ID (ESID) fields of two or more SLB\n"
- " entries contain the same value.\n");
- dump_segments(0);
- }
-
- return 0; /* for now lets not recover */
-}
diff --git a/xen/arch/powerpc/powerpc64/ppc970_scom.c b/xen/arch/powerpc/powerpc64/ppc970_scom.c
deleted file mode 100644
index 4688b007b3..0000000000
--- a/xen/arch/powerpc/powerpc64/ppc970_scom.c
+++ /dev/null
@@ -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. 2006
- *
- * Authors: Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/lib.h>
-#include <xen/console.h>
-#include <xen/errno.h>
-#include <asm/delay.h>
-#include <asm/processor.h>
-#include "scom.h"
-
-#undef CONFIG_SCOM
-
-#define SPRN_SCOMC 276
-#define SPRN_SCOMD 277
-#define SCOMC_READ 1
-#define SCOMC_WRITE (!(SCOMC_READ))
-
-union scomc {
- struct scomc_bits {
- ulong _reserved_0_31: 32;
- ulong addr: 16;
- ulong RW: 1;
- ulong _reserved_49_55: 7;
- ulong _reserved_56: 1;
- ulong proto_error: 1;
- ulong addr_error: 1;
- ulong iface_error: 1;
- ulong disabled: 1;
- ulong _reserved_61_62: 2;
- ulong failure: 1;
- } bits;
- ulong word;
-};
-
-
-int cpu_scom_read(uint addr, ulong *d)
-{
- union scomc c;
- ulong flags;
-
- /* drop the low 8bits (including parity) */
- addr >>= 8;
-
- /* these give iface errors because the addresses are not software
- * accessible */
- BUG_ON(addr & 0x8000);
-
- for (;;) {
- c.word = 0;
- c.bits.addr = addr;
- c.bits.RW = SCOMC_READ;
-
- local_irq_save(flags);
- asm volatile (
- "sync \n\t"
- "mtspr %2, %0 \n\t"
- "isync \n\t"
- "mfspr %1, %3 \n\t"
- "isync \n\t"
- "mfspr %0, %2 \n\t"
- "isync \n\t"
- : "+r" (c.word), "=r" (*d)
- : "i"(SPRN_SCOMC), "i"(SPRN_SCOMD));
-
- local_irq_restore(flags);
- /* WARNING! older 970s (pre FX) shift the bits right 1 position */
-
- if (!c.bits.failure)
- return 0;
-
- /* deal with errors */
- /* has SCOM been disabled? */
- if (c.bits.disabled)
- return -ENOSYS;
-
- /* we were passed a bad addr return -1 */
- if (c.bits.addr_error)
- return -EINVAL;
-
- /* this is way bad and we will checkstop soon */
- BUG_ON(c.bits.proto_error);
-
- if (c.bits.iface_error)
- udelay(10);
- }
-}
-
-int cpu_scom_write(uint addr, ulong d)
-{
- union scomc c;
- ulong flags;
-
- /* drop the low 8bits (including parity) */
- addr >>= 8;
-
- /* these give iface errors because the addresses are not software
- * accessible */
- BUG_ON(addr & 0x8000);
-
- for (;;) {
- c.word = 0;
- c.bits.addr = addr;
- c.bits.RW = SCOMC_WRITE;
-
- local_irq_save(flags);
- asm volatile(
- "sync \n\t"
- "mtspr %3, %1 \n\t"
- "isync \n\t"
- "mtspr %2, %0 \n\t"
- "isync \n\t"
- "mfspr %0, %2 \n\t"
- "isync \n\t"
- : "+r" (c.word)
- : "r" (d), "i"(SPRN_SCOMC), "i"(SPRN_SCOMD));
- local_irq_restore(flags);
-
- if (!c.bits.failure)
- return 0;
-
- /* has SCOM been disabled? */
- if (c.bits.disabled)
- return -ENOSYS;
-
- /* we were passed a bad addr return -1 */
- if (c.bits.addr_error)
- return -EINVAL;
-
- /* this is way bad and we will checkstop soon */
- BUG_ON(c.bits.proto_error);
-
- /* check for iface and retry */
- if (c.bits.iface_error)
- udelay(10);
- }
-}
-
-void cpu_scom_init(void)
-{
-#ifdef CONFIG_SCOM
- ulong val;
- if (PVR_REV(mfpvr()) == PV_970FX) {
- /* these address are only good for 970FX */
- console_start_sync();
- if (!cpu_scom_read(SCOM_PTSR, &val))
- printk("SCOM PTSR: 0x%016lx\n", val);
-
- console_end_sync();
- }
-#endif
-}
-
-void cpu_scom_AMCR(void)
-{
-#ifdef CONFIG_SCOM
- ulong val;
-
- if (PVR_REV(mfpvr()) == PV_970FX) {
- /* these address are only good for 970FX */
- cpu_scom_read(SCOM_AMC_REG, &val);
- printk("SCOM AMCR: 0x%016lx\n", val);
- }
-#endif
-}
-
diff --git a/xen/arch/powerpc/powerpc64/prom_call.S b/xen/arch/powerpc/powerpc64/prom_call.S
deleted file mode 100644
index f92fae34bf..0000000000
--- a/xen/arch/powerpc/powerpc64/prom_call.S
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) 2005 Jimi Xenidis <jimix@watson.ibm.com>, 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/processor.h>
-
- .macro save_gprs rsave, rend, off, rbase
- std \rsave, \off(\rbase)
- .if \rend-\rsave
- save_gprs "(\rsave+1)",\rend,"(\off+8)",\rbase
- .endif
- .endm
-
- .macro restore_gprs rsave, rend, off, rbase
- ld \rsave, \off(\rbase)
- .if \rend-\rsave
- restore_gprs "(\rsave+1)",\rend,"(\off+8)",\rbase
- .endif
- .endm
-
-/*
- * s32 prom_call(void *arg, ulong base, ulong func, ulong msr);
- * r3 is arg pointer
- * r4 is RTAS base, should be 0 for OF
- * r5 is Prom vector
- * r6 is the MSR we should use
- */
-_GLOBAL(prom_call)
- SET_REG_TO_LABEL(r7, gpr_store)
-
- std r1, 0(r7)
- std r2, 8(r7)
- SAVE_GPRS r13, r31, 16, r7 # save all volatiles
-
- /*
- * We can stuff the LT, MSR, SRR0/1 into GPRS that the caller
- * must retore
- */
-
- mflr r18
- sradi r19, r18, 32 /* store lr in r18, r19 */
-
- mfmsr r20
- sradi r21, r20, 32 /* r20,r21 contain caller's msr */
-
- /* save SRR0/1 */
- mfsrr0 r24
- sradi r25, r24, 32
- mfsrr1 r26
- sradi r27, r26, 32
-
- bl go_to_real
-
- /* come back here after rfid in "native_of_call" */
- insrdi r18, r19, 32, 0 /* restore lr */
- mtlr r18
-
- /* restore SRR0/1 */
- insrdi r24, r25, 32, 0
- mtsrr0 r24
- insrdi r26, r27, 32, 0
- mtsrr1 r26
-
-
-
- SET_REG_TO_LABEL(r7, gpr_store)
-
- ld r1, 0(r7)
- ld r2, 8(r7)
- RESTORE_GPRS r13, r31, 16, r7
- blr
-
-native_call:
- mtctr r5
- bctrl /* call of or rtas */
-
- insrdi r22, r23, 32, 0 /* reconstruct return point iar */
- insrdi r20, r21, 32, 0 /* reconstruct caller's msr */
-
- mtsrr0 r22
- mtsrr1 r20
- rfid
-
-
-go_to_real:
- mflr r22
- sradi r23, r22, 32 /* save address we rfid back to*/
-
- SET_REG_TO_LABEL(r8, native_call)
-
- mtsrr0 r8
- mtsrr1 r6
- rfid
-
-
- .data
- .p2align 3
-gpr_store:
- .space 8 # r1
- .space 8 # r2
- .space (32 - 13) * 8 # r13 - r31
diff --git a/xen/arch/powerpc/powerpc64/scom.h b/xen/arch/powerpc/powerpc64/scom.h
deleted file mode 100644
index a68651f9ea..0000000000
--- a/xen/arch/powerpc/powerpc64/scom.h
+++ /dev/null
@@ -1,39 +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: Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#ifndef _ARCH_POWERPC_POWERPC64_SCOM_H_
-#define _ARCH_POWERPC_POWERPC64_SCOM_H_
-
-extern void cpu_scom_init(void);
-int cpu_scom_read(unsigned int addr, unsigned long *d);
-int cpu_scom_write(unsigned int addr, unsigned long d);
-void cpu_scom_AMCR(void);
-
-/* SCOMC addresses are 16bit but we are given 24 bits in the
- * books. The low oerder 8 bits are some kinda parity thin and should
- * be ignored */
-#define SCOM_AMC_REG 0x022601
-#define SCOM_AMC_AND_MASK 0x022700
-#define SCOM_AMC_OR_MASK 0x022800
-#define SCOM_CMCE 0x030901
-#define SCOM_PMCR 0x400801
-#define SCOM_PTSR 0x408001
-
-#endif
diff --git a/xen/arch/powerpc/powerpc64/string.S b/xen/arch/powerpc/powerpc64/string.S
deleted file mode 100644
index 4baaecc96f..0000000000
--- a/xen/arch/powerpc/powerpc64/string.S
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * String handling functions for PowerPC.
- *
- * Copyright (C) 1996 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 <asm/config.h>
-#include <asm/processor.h>
-#include <xen/errno.h>
-
-_GLOBAL(strcpy)
- addi r5,r3,-1
- addi r4,r4,-1
-1: lbzu r0,1(r4)
- cmpwi 0,r0,0
- stbu r0,1(r5)
- bne 1b
- blr
-
-_GLOBAL(strncpy)
- cmpwi 0,r5,0
- beqlr
- mtctr r5
- addi r6,r3,-1
- addi r4,r4,-1
-1: lbzu r0,1(r4)
- cmpwi 0,r0,0
- stbu r0,1(r6)
- bdnzf 2,1b /* dec ctr, branch if ctr != 0 && !cr0.eq */
- blr
-
-_GLOBAL(strcat)
- addi r5,r3,-1
- addi r4,r4,-1
-1: lbzu r0,1(r5)
- cmpwi 0,r0,0
- bne 1b
- addi r5,r5,-1
-1: lbzu r0,1(r4)
- cmpwi 0,r0,0
- stbu r0,1(r5)
- bne 1b
- blr
-
-_GLOBAL(strcmp)
- addi r5,r3,-1
- addi r4,r4,-1
-1: lbzu r3,1(r5)
- cmpwi 1,r3,0
- lbzu r0,1(r4)
- subf. r3,r0,r3
- beqlr 1
- beq 1b
- blr
-
-_GLOBAL(strlen)
- addi r4,r3,-1
-1: lbzu r0,1(r4)
- cmpwi 0,r0,0
- bne 1b
- subf r3,r3,r4
- blr
-
-_GLOBAL(memset)
- neg r0,r3
- rlwimi r4,r4,8,16,23
- andi. r0,r0,7 /* # bytes to be 8-byte aligned */
- rlwimi r4,r4,16,0,15
- cmplw cr1,r5,r0 /* do we get that far? */
- rldimi r4,r4,32,0
- mtcrf 1,r0
- mr r6,r3
- blt cr1,8f
- beq+ 3f /* if already 8-byte aligned */
- subf r5,r0,r5
- bf 31,1f
- stb r4,0(r6)
- addi r6,r6,1
-1: bf 30,2f
- sth r4,0(r6)
- addi r6,r6,2
-2: bf 29,3f
- stw r4,0(r6)
- addi r6,r6,4
-3: srdi. r0,r5,6
- clrldi r5,r5,58
- mtctr r0
- beq 5f
-4: std r4,0(r6)
- std r4,8(r6)
- std r4,16(r6)
- std r4,24(r6)
- std r4,32(r6)
- std r4,40(r6)
- std r4,48(r6)
- std r4,56(r6)
- addi r6,r6,64
- bdnz 4b
-5: srwi. r0,r5,3
- clrlwi r5,r5,29
- mtcrf 1,r0
- beq 8f
- bf 29,6f
- std r4,0(r6)
- std r4,8(r6)
- std r4,16(r6)
- std r4,24(r6)
- addi r6,r6,32
-6: bf 30,7f
- std r4,0(r6)
- std r4,8(r6)
- addi r6,r6,16
-7: bf 31,8f
- std r4,0(r6)
- addi r6,r6,8
-8: cmpwi r5,0
- mtcrf 1,r5
- beqlr+
- bf 29,9f
- stw r4,0(r6)
- addi r6,r6,4
-9: bf 30,10f
- sth r4,0(r6)
- addi r6,r6,2
-10: bflr 31
- stb r4,0(r6)
- blr
-
-_GLOBAL(memmove)
- cmplw 0,r3,r4
- bgt .backwards_memcpy
- b .memcpy
-
-_GLOBAL(backwards_memcpy)
- rlwinm. r7,r5,32-3,3,31 /* r0 = r5 >> 3 */
- add r6,r3,r5
- add r4,r4,r5
- beq 2f
- andi. r0,r6,3
- mtctr r7
- bne 5f
-1: lwz r7,-4(r4)
- lwzu r8,-8(r4)
- stw r7,-4(r6)
- stwu r8,-8(r6)
- bdnz 1b
- andi. r5,r5,7
-2: cmplwi 0,r5,4
- blt 3f
- lwzu r0,-4(r4)
- subi r5,r5,4
- stwu r0,-4(r6)
-3: cmpwi 0,r5,0
- beqlr
- mtctr r5
-4: lbzu r0,-1(r4)
- stbu r0,-1(r6)
- bdnz 4b
- blr
-5: mtctr r0
-6: lbzu r7,-1(r4)
- stbu r7,-1(r6)
- bdnz 6b
- subf r5,r0,r5
- rlwinm. r7,r5,32-3,3,31
- beq 2b
- mtctr r7
- b 1b
-
-_GLOBAL(memcmp)
- cmpwi 0,r5,0
- ble- 2f
- mtctr r5
- addi r6,r3,-1
- addi r4,r4,-1
-1: lbzu r3,1(r6)
- lbzu r0,1(r4)
- subf. r3,r0,r3
- bdnzt 2,1b
- blr
-2: li r3,0
- blr
-
-_GLOBAL(memchr)
- cmpwi 0,r5,0
- ble- 2f
- mtctr r5
- addi r3,r3,-1
-1: lbzu r0,1(r3)
- cmpw 0,r0,r4
- bdnzf 2,1b
- beqlr
-2: li r3,0
- blr
-
-_GLOBAL(__clear_user)
- addi r6,r3,-4
- li r3,0
- li r5,0
- cmplwi 0,r4,4
- blt 7f
- /* clear a single word */
-11: stwu r5,4(r6)
- beqlr
- /* clear word sized chunks */
- andi. r0,r6,3
- add r4,r0,r4
- subf r6,r0,r6
- srwi r0,r4,2
- andi. r4,r4,3
- mtctr r0
- bdz 7f
-1: stwu r5,4(r6)
- bdnz 1b
- /* clear byte sized chunks */
-7: cmpwi 0,r4,0
- beqlr
- mtctr r4
- addi r6,r6,3
-8: stbu r5,1(r6)
- bdnz 8b
- blr
-90: mr r3,r4
- blr
-91: mfctr r3
- slwi r3,r3,2
- add r3,r3,r4
- blr
-92: mfctr r3
- blr
-
- .section __ex_table,"a"
- .align 3
- .llong 11b,90b
- .llong 1b,91b
- .llong 8b,92b
- .text
-
-/* r3 = dst, r4 = src, r5 = count */
-_GLOBAL(__strncpy_from_user)
- addi r6,r3,-1
- addi r4,r4,-1
- cmpwi 0,r5,0
- beq 2f
- mtctr r5
-1: lbzu r0,1(r4)
- cmpwi 0,r0,0
- stbu r0,1(r6)
- bdnzf 2,1b /* dec ctr, branch if ctr != 0 && !cr0.eq */
- beq 3f
-2: addi r6,r6,1
-3: subf r3,r3,r6
- blr
-99: li r3,-EFAULT
- blr
-
- .section __ex_table,"a"
- .align 3
- .llong 1b,99b
- .text
-
-/* r3 = str, r4 = len (> 0) */
-_GLOBAL(__strnlen_user)
- addi r7,r3,-1
- mtctr r4 /* ctr = len */
-1: lbzu r0,1(r7) /* get next byte */
- cmpwi 0,r0,0
- bdnzf 2,1b /* loop if --ctr != 0 && byte != 0 */
- addi r7,r7,1
- subf r3,r3,r7 /* number of bytes we have looked at */
- beqlr /* return if we found a 0 byte */
- cmpw 0,r3,r4 /* did we look at all len bytes? */
- blt 99f /* if not, must have hit top */
- addi r3,r4,1 /* return len + 1 to indicate no null found */
- blr
-99: li r3,0 /* bad address, return 0 */
- blr
-
- .section __ex_table,"a"
- .align 3
- .llong 1b,99b
-
diff --git a/xen/arch/powerpc/powerpc64/traps.c b/xen/arch/powerpc/powerpc64/traps.c
deleted file mode 100644
index 21411ef39b..0000000000
--- a/xen/arch/powerpc/powerpc64/traps.c
+++ /dev/null
@@ -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) IBM Corp. 2005, 2006
- *
- * Authors: Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/lib.h>
-#include <xen/console.h>
-#include <public/xen.h>
-#include <xen/version.h>
-#include <xen/sched.h>
-
-void show_registers(struct cpu_user_regs *regs)
-{
- int i;
-
- console_start_sync();
-
- printk("----[ Xen-%d.%d%s ]----\n",
- xen_major_version(), xen_minor_version(), xen_extra_version());
- printk("CPU: %08x DOMID: %08x\n",
- smp_processor_id(), current->domain->domain_id);
- printk("pc %016lx msr %016lx\n"
- "lr %016lx ctr %016lx\n"
- "srr0 %016lx srr1 %016lx\n",
- regs->pc, regs->msr,
- regs->lr, regs->ctr,
- regs->srr0, regs->srr1);
-
- /* These come in handy for debugging but are not always saved, so
- * what is "actually" in the register should be good */
- printk("dar %016lx dsisr %08x *** saved\n"
- "dar %016lx dsisr %08x *** actual\n",
- regs->dar, regs->dsisr,
- mfdar(), mfdsisr());
-
- for (i = 0; i < 32; i += 4) {
- printk("r%02i: %016lx %016lx %016lx %016lx\n", i,
- regs->gprs[i], regs->gprs[i+1], regs->gprs[i+2], regs->gprs[i+3]);
- }
- console_end_sync();
-}
-
diff --git a/xen/arch/powerpc/ppc32/prom_call.c b/xen/arch/powerpc/ppc32/prom_call.c
deleted file mode 100644
index 6c6a34917b..0000000000
--- a/xen/arch/powerpc/ppc32/prom_call.c
+++ /dev/null
@@ -1,41 +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@watson.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <asm/processor.h>
-
-typedef s32 (*prom_call_t)(void *, ulong);
-
-s32
-prom_call(void *arg, uval base, uval func, uval msr __attribute__ ((unused)))
-{
- prom_call_t f = (prom_call_t)func;
- ulong srr0 = mfsrr0();
- ulong srr1 = mfsrr1();
- s32 ret;
-
- ret = f(arg, base);
-
- mtsrr0(srr0);
- mtsrr1(srr1);
-
- return ret;
-}
diff --git a/xen/arch/powerpc/rtas.c b/xen/arch/powerpc/rtas.c
deleted file mode 100644
index 4584444ee0..0000000000
--- a/xen/arch/powerpc/rtas.c
+++ /dev/null
@@ -1,201 +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, 2007
- *
- * Authors: Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/init.h>
-#include <xen/lib.h>
-#include <xen/errno.h>
-#include <xen/sched.h>
-#include "of-devtree.h"
-#include "rtas.h"
-
-int rtas_entry;
-unsigned long rtas_msr;
-unsigned long rtas_base;
-unsigned long rtas_end;
-
-int rtas_call(void *r)
-{
- if (rtas_entry == 0)
- return -ENOSYS;
-
- return prom_call(r, rtas_base, rtas_entry, rtas_msr);
-}
-
-/* rtas always uses physical address */
-void *rtas_remote_addr(ulong addr, ulong length)
-{
- struct vcpu *v = get_current();
- struct domain *d = v->domain;
- ulong mfn;
- ulong mfn_end;
-
- mfn = gmfn_to_mfn(d, addr >> PAGE_SHIFT);
- if (mfn == INVALID_MFN)
- return NULL;
-
- /* a little paranoid since almost everyone will pass us page
- * bounded thingies, but just in case */
- mfn_end = gmfn_to_mfn(d, (addr + length) >> PAGE_SHIFT);
- if (mfn_end == INVALID_MFN)
- return NULL;
-
- return (void *)((mfn << PAGE_SHIFT) | (addr & (PAGE_SIZE - 1)));
-}
-
-/* these do not proxy */
-#define RTAS_HALT 0
-#define RTAS_REBOOT 1
-
-struct rtas_token rt_power_off = { .name = "power-off", .token = -1, };
-struct rtas_token rt_system_reboot = { .name = "system-reboot", .token = -1};
-
-static struct rtas_token *tokens[] = {
- /* these do not proxy */
- [RTAS_HALT] = &rt_power_off,
- [RTAS_REBOOT] = &rt_system_reboot,
- &rt_nvram_store,
- &rt_nvram_fetch,
- &rt_manage_flash,
- &rt_validate_flash,
- &rt_update_reboot_flash
-};
-
-static int rtas_proxy;
-
-int __init rtas_init(void *m)
-{
- ofdn_t n;
- int i;
-
- if (rtas_entry == 0)
- return -ENOSYS;
-
- n = ofd_node_find(m, "/rtas");
- if (n <= 0)
- return -ENOSYS;
-
- for (i = 0; i < ARRAY_SIZE(tokens); i++) {
- ofd_getprop(m, n, tokens[i]->name,
- &tokens[i]->token, sizeof (tokens[i]->token));
- if (!rtas_proxy && tokens[i]->proxy && tokens[i]->token != -1)
- rtas_proxy = 1;
- }
- return 1;
-}
-
-int rtas_proxy_init(void *m)
-{
- static const char path[] = "/rtas";
- ofdn_t p;
- ofdn_t n;
- int i;
-
- if (!rtas_proxy)
- return -1;
-
- printk("Create a new /rtas with tokens Xen is willing to proxy\n");
-
- p = ofd_node_find(m, "/");
-
- n = ofd_node_add(m, p, path, sizeof(path));
- ofd_prop_add(m, n, "name", &path[1], sizeof (path) - 1);
-
- /* and the tokens for proxy */
- for (i = 0; i < ARRAY_SIZE(tokens); i++) {
- if (tokens[i]->proxy && tokens[i]->token != -1)
- ofd_prop_add(m, n, tokens[i]->name, &i, sizeof (i));
- }
- return n;
-}
-
-int do_rtas_proxy(ulong arg)
-{
- struct rtas_args *r;
- unsigned i;
- int token;
- ulong sz;
-
- if (!IS_PRIV(current->domain))
- return -EPERM;
- if (!rtas_proxy)
- return -ENOSYS;
-
- /* has to be at least 5 words */
- sz = (3 + 1 + 1) * sizeof (int);
- r = rtas_remote_addr(arg, sz);
- if (r == NULL) {
- /* this is about all we can do at this point */
- return -1;
- }
- /* make sure we can deal with everything */
- sz = (3 + r->ra_nargs + r->ra_nrets) * sizeof (int);
- if (rtas_remote_addr(arg, sz) == NULL) {
- r->ra_args[r->ra_nargs] = RTAS_HW;
- return -1;
- }
-
- i = r->ra_token;
- token = tokens[i]->token;
-
- if (i < ARRAY_SIZE(tokens) &&
- tokens[i]->proxy != NULL &&
- token != -1)
- return tokens[i]->proxy(token, r);
-
- return -1;
-}
-
-int
-rtas_halt(void)
-{
- struct rtas_args r;
- int token = tokens[RTAS_HALT]->token;
-
- if (token == -1)
- return -1;
-
- r.ra_token = token;
- r.ra_nargs = 2;
- r.ra_nrets = 1;
- r.ra_args[0] = 0;
- r.ra_args[1] = 0;
-
- return rtas_call(&r);
-}
-
-int
-rtas_reboot(void)
-{
- struct rtas_args r;
-
- int token = tokens[RTAS_REBOOT]->token;
-
- if (token == -1)
- return -1;
-
- r.ra_token = token;
- r.ra_nargs = 2;
- r.ra_nrets = 1;
- r.ra_args[0] = 0;
- r.ra_args[1] = 0;
-
- return rtas_call(&r);
-}
diff --git a/xen/arch/powerpc/rtas.h b/xen/arch/powerpc/rtas.h
deleted file mode 100644
index 1718530b74..0000000000
--- a/xen/arch/powerpc/rtas.h
+++ /dev/null
@@ -1,65 +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: Jimi Xenidis <jimix@us.ibm.com>
- */
-
-#ifndef _ARCH_POWERPC_RTAS_H_
-#define _ARCH_POWERPC_RTAS_H_
-
-extern int rtas_entry;
-extern unsigned long rtas_msr;
-extern unsigned long rtas_base;
-extern unsigned long rtas_end;
-
-struct rtas_args {
- int ra_token;
- int ra_nargs;
- int ra_nrets;
- int ra_args[10];
-} __attribute__ ((aligned(8)));
-
-struct rtas_token {
- char *name;
- int (*proxy)(int token, struct rtas_args *r);
- int token;
-};
-
-extern struct rtas_token rt_power_off;
-extern struct rtas_token rt_system_reboot;
-extern struct rtas_token rt_nvram_fetch;
-extern struct rtas_token rt_nvram_store;
-extern struct rtas_token rt_manage_flash;
-extern struct rtas_token rt_validate_flash;
-extern struct rtas_token rt_update_reboot_flash;
-
-/* RTAS errors */
-#define RTAS_HW -1
-#define RTAS_BUSY -2
-#define RTAS_PARAMETER -3
-
-
-extern int prom_call(void *arg, unsigned base,
- unsigned long func, unsigned long msr);
-extern int rtas_init(void *);
-extern int rtas_halt(void);
-extern int rtas_reboot(void);
-extern int rtas_proxy_init(void *m);
-extern int do_rtas_proxy(ulong arg);
-extern void *rtas_remote_addr(ulong addr, ulong length);
-extern int rtas_call(void *r);
-#endif
diff --git a/xen/arch/powerpc/rtas_flash.c b/xen/arch/powerpc/rtas_flash.c
deleted file mode 100644
index c48898b9cb..0000000000
--- a/xen/arch/powerpc/rtas_flash.c
+++ /dev/null
@@ -1,182 +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. 2007
- *
- * Authors: Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/init.h>
-#include <xen/lib.h>
-#include <xen/sched.h>
-#include "rtas.h"
-
-static int rtas_manage_flash(int token, struct rtas_args *ra)
-{
- struct rtas_args r;
- ulong sz = (3 + ra->ra_nargs + ra->ra_nrets) * sizeof (int);
- int ret;
-
- if (ra->ra_nargs != 1 || ra->ra_nrets != 1) {
- ra->ra_args[ra->ra_nargs] = RTAS_PARAMETER;
- return -1;
- }
- memcpy(&r, ra, sz);
- r.ra_token = token;
-
- ret = rtas_call(&r);
- ra->ra_args[ra->ra_nargs] = r.ra_args[r.ra_nargs];
- return ret;
-}
-struct rtas_token rt_manage_flash = {
- .name = "ibm,manage-flash-image",
- .proxy = rtas_manage_flash,
- .token = -1
-};
-
-static int rtas_validate_flash(int token, struct rtas_args *ra)
-{
- ulong length = ra->ra_args[1];
- char *buffer;
- char *local;
- struct rtas_args r;
- ulong sz = (3 + ra->ra_nargs + ra->ra_nrets) * sizeof (int);
- int ret;
-
- if (ra->ra_nargs != 2 || ra->ra_nrets != 2) {
- ra->ra_args[ra->ra_nargs] = RTAS_PARAMETER;
- return -1;
- }
-
- /* the original pointer can be in memory that is too high so we
- * need to do it locally */
- buffer = rtas_remote_addr(ra->ra_args[0], length);
- if (buffer == NULL) {
- ra->ra_args[ra->ra_nargs] = RTAS_PARAMETER;
- return -1;
- }
-
- local = xmalloc_bytes(length);
- if (local == NULL) {
- printk("%s: could not allocate local buffer size: 0x%lx\n",
- __func__, length);
- ra->ra_args[ra->ra_nargs] = RTAS_HW;
- return -1;
- }
- /* RTAS is 32bits so we need to make sure that that local
- * buffer is in that range */
- BUG_ON(((ulong)local + length) & ~0xffffffffUL);
-
- /* copy the remote buffer to the local one */
- memcpy(local, buffer, length);
-
- memcpy(&r, ra, sz);
- r.ra_token = token;
- r.ra_args[0] = (unsigned)(ulong)local;
- ret = rtas_call(&r);
- ra->ra_args[ra->ra_nargs] = r.ra_args[r.ra_nargs];
- ra->ra_args[ra->ra_nargs + 1] = r.ra_args[r.ra_nargs + 1];
- xfree(local);
- return ret;
-}
-
-struct rtas_token rt_validate_flash = {
- .name = "ibm,validate-flash-image",
- .proxy = rtas_validate_flash,
- .token = -1
-};
-
-/* flash data structs */
-struct flash_block {
- u64 addr;
- u64 length;
-};
-struct flash_block_list {
- struct {
- u64 ver:8;
- u64 bytes:56;
- } header;
- u64 *next;
- struct flash_block blocks[0];
-};
-
-static int safe_to_flash;
-static int rtas_update_reboot_flash(int token, struct rtas_args *ra)
-{
- struct rtas_args r;
- ulong sz = (3 + ra->ra_nargs + ra->ra_nrets) * sizeof (int);
- int ret;
- void *local;
- struct flash_block_list *l;
- ulong blocks;
-
- if (ra->ra_nargs != 1 || ra->ra_nrets != 1) {
- ra->ra_args[ra->ra_nargs] = RTAS_PARAMETER;
- return -1;
- }
-
- if (!safe_to_flash) {
- printk("%s: this has not been fully tested yet\n", __func__);
- ra->ra_args[ra->ra_nargs] = RTAS_HW;
- return -1;
- }
-
- /* we only need to relocate the first block address to 4G, for now
- * lets just bug on that */
- local = rtas_remote_addr(ra->ra_args[0], 16);
- BUG_ON((ulong)local & ~0xffffffffUL);
-
- /* now we run through the block list and translate base addresses */
- l = (struct flash_block_list *)local;
-
- /* header and next count as one block */
- blocks = (l->header.bytes / sizeof (struct flash_block)) - 1;
- if (blocks == 0) {
- ra->ra_args[ra->ra_nargs] = RTAS_PARAMETER;
- return -1;
- }
-
- /* go thru the block lists */
- do {
- int i = 0;
-
- /* go thru the block in the list */
- for (i = 0; i < blocks; i++) {
- void *addr;
-
- addr = rtas_remote_addr(l->blocks[i].addr, l->blocks[i].length);
- BUG_ON(addr == NULL);
- l->blocks[i].addr = (u64)addr;
- }
- l = (struct flash_block_list *)l->next;
- } while (l != NULL);
-
- memcpy(&r, ra, sz);
- r.ra_token = token;
-
- /* this arguement is a pointer to a block list */
- r.ra_args[0] = (unsigned)(ulong)local;
-
- ret = rtas_call(&r);
- ra->ra_args[ra->ra_nargs] = r.ra_args[r.ra_nargs];
- return ret;
-}
-
-struct rtas_token rt_update_reboot_flash = {
- .name = "ibm,update-flash-64-and-reboot",
- .proxy = rtas_update_reboot_flash,
- .token = -1
-};
diff --git a/xen/arch/powerpc/rtas_nvram.c b/xen/arch/powerpc/rtas_nvram.c
deleted file mode 100644
index ec9c57f922..0000000000
--- a/xen/arch/powerpc/rtas_nvram.c
+++ /dev/null
@@ -1,129 +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. 2007
- *
- * Authors: Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/init.h>
-#include <xen/lib.h>
-#include <xen/sched.h>
-#include "rtas.h"
-
-static int rtas_nvram_store(int token, struct rtas_args *ra)
-{
- ulong length = ra->ra_args[2];
- char *buffer;
- char *local;
- struct rtas_args r;
- ulong sz = (3 + ra->ra_nargs + ra->ra_nrets) * sizeof (int);
- int ret;
-
- if (ra->ra_nargs != 3 || ra->ra_nrets != 2) {
- ra->ra_args[ra->ra_nargs] = RTAS_PARAMETER;
- return -1;
- }
-
- /* the original pointer can be in memory that is too high so we
- * need to do it locally */
- buffer = rtas_remote_addr(ra->ra_args[1], length);
- if (buffer == NULL) {
- ra->ra_args[ra->ra_nargs] = RTAS_PARAMETER;
- return -1;
- }
-
- local = xmalloc_bytes(length);
- if (local == NULL) {
- printk("%s: could not allocate local buffer size: 0x%lx\n",
- __func__, length);
- ra->ra_args[ra->ra_nargs] = RTAS_HW;
- return -1;
- }
- /* RTAS is 32bits so we need to make sure that that local
- * buffer is in that range */
- BUG_ON(((ulong)local + length) & ~0xffffffffUL);
-
- /* copy the remote buffer to the local one */
- memcpy(local, buffer, length);
-
- memcpy(&r, ra, sz);
- r.ra_token = token;
- r.ra_args[1] = (unsigned)(ulong)local;
-
- ret = rtas_call(&r);
- ra->ra_args[ra->ra_nargs] = r.ra_args[r.ra_nargs];
- ra->ra_args[ra->ra_nargs + 1] = r.ra_args[r.ra_nargs + 1];
- xfree(local);
- return ret;
-}
-
-struct rtas_token rt_nvram_store = {
- .name = "nvram-store",
- .proxy = rtas_nvram_store,
- .token = -1
-};
-
-static int rtas_nvram_fetch(int token, struct rtas_args *ra)
-{
- ulong length = ra->ra_args[2];
- char *buffer;
- char *local;
- struct rtas_args r;
- ulong sz = (3 + ra->ra_nargs + ra->ra_nrets) * sizeof (int);
- int ret;
-
- if (ra->ra_nargs != 3 || ra->ra_nrets != 2) {
- ra->ra_args[ra->ra_nargs] = RTAS_PARAMETER;
- return -1;
- }
- /* the original pointer can be in ememory that is too high so
- * we need to do it locally */
- buffer = rtas_remote_addr(ra->ra_args[1], length);
-
- local = xmalloc_bytes(length);
- if (local == NULL) {
- printk("%s: could not allocate local buffer size: 0x%lx\n",
- __func__, length);
- ra->ra_args[ra->ra_nargs] = RTAS_HW;
- return -1;
- }
- /* RTAS is 32bits so we need to make sure that that local
- * buffer is in that range */
- BUG_ON(((ulong)local + length) & ~0xffffffffUL);
-
- memcpy(&r, ra, sz);
- r.ra_token = token;
- r.ra_args[1] = (unsigned)(ulong)local;
-
- ret = rtas_call(&r);
- ra->ra_args[ra->ra_nargs] = r.ra_args[r.ra_nargs];
- ra->ra_args[ra->ra_nargs + 1] = r.ra_args[r.ra_nargs + 1];
- if (r.ra_args[r.ra_nargs] >= 0) {
- /* copy from local to remote */
- sz = r.ra_args[r.ra_nargs + 1];
- memcpy(buffer, local, sz);
- }
- xfree(local);
- return ret;
-}
-
-struct rtas_token rt_nvram_fetch = {
- .name = "nvram-fetch",
- .proxy = rtas_nvram_fetch,
- .token = -1
-};
-
diff --git a/xen/arch/powerpc/setup.c b/xen/arch/powerpc/setup.c
deleted file mode 100644
index 7f2f5d2572..0000000000
--- a/xen/arch/powerpc/setup.c
+++ /dev/null
@@ -1,509 +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@watson.ibm.com>
- * Amos Waterland <apw@us.ibm.com>
- * Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/init.h>
-#include <xen/lib.h>
-#include <xen/cpumask.h>
-#include <xen/sched.h>
-#include <xen/multiboot2.h>
-#include <xen/serial.h>
-#include <xen/softirq.h>
-#include <xen/console.h>
-#include <xen/trace.h>
-#include <xen/mm.h>
-#include <xen/domain.h>
-#include <xen/gdbstub.h>
-#include <xen/symbols.h>
-#include <xen/keyhandler.h>
-#include <xen/numa.h>
-#include <xen/rcupdate.h>
-#include <xen/version.h>
-#include <xsm/acm/acm_hooks.h>
-#include <public/version.h>
-#include <asm/mpic.h>
-#include <asm/processor.h>
-#include <asm/desc.h>
-#include <asm/cache.h>
-#include <asm/debugger.h>
-#include <asm/delay.h>
-#include <asm/percpu.h>
-#include <asm/io.h>
-#include <asm/boot.h>
-#include "exceptions.h"
-#include "of-devtree.h"
-#include "oftree.h"
-#include "rtas.h"
-
-#define DEBUG
-
-/* opt_noht: If true, Hyperthreading is ignored. */
-int opt_noht = 0;
-boolean_param("noht", opt_noht);
-
-int opt_earlygdb = 0;
-boolean_param("earlygdb", opt_earlygdb);
-
-/* opt_nosmp: If true, secondary processors are ignored. */
-static int opt_nosmp = 0;
-boolean_param("nosmp", opt_nosmp);
-
-/* maxcpus: maximum number of CPUs to activate. */
-static unsigned int max_cpus = NR_CPUS;
-integer_param("maxcpus", max_cpus);
-
-u32 tlbflush_clock = 1U;
-DEFINE_PER_CPU(u32, tlbflush_time);
-
-unsigned int watchdog_on;
-unsigned long wait_init_idle;
-ulong oftree;
-ulong oftree_len;
-ulong oftree_end;
-
-/* linked-in dom0: */
-extern char dom0_start[] __attribute__ ((weak));
-extern char dom0_size[] __attribute__ ((weak));
-
-char *xen_cmdline;
-char *dom0_cmdline;
-ulong dom0_addr;
-ulong dom0_len;
-ulong initrd_start;
-ulong initrd_len;
-
-uint cpu_hard_id[NR_CPUS] __initdata;
-cpumask_t cpu_present_map;
-
-/* XXX get this from ISA node in device tree */
-char *vgabase;
-ulong isa_io_base;
-struct ns16550_defaults ns16550;
-
-extern char __per_cpu_start[], __per_cpu_data_end[], __per_cpu_end[];
-
-static struct domain *idle_domain;
-
-volatile struct processor_area * volatile global_cpu_table[NR_CPUS];
-
-static void __init do_initcalls(void)
-{
- initcall_t *call;
- for (call = &__initcall_start; call < &__initcall_end; call++) {
- (*call)();
- }
-}
-
-
-void noinline __attn(void)
-{
- /* To continue the probe will step over the ATTN instruction. The
- * NOP is there to make sure there is something sane to "step
- * over" to. */
- console_start_sync();
- asm volatile(".long 0x200;nop");
- console_end_sync();
-}
-
-static void key_hw_probe_attn(unsigned char key)
-{
- __attn();
-}
-
-static void key_ofdump(unsigned char key)
-{
- printk("ofdump:\n");
- /* make sure the OF devtree is good */
- ofd_walk((void *)oftree, "devtree", OFD_ROOT,
- ofd_dump_props, OFD_DUMP_ALL);
-}
-
-static void percpu_init_areas(void)
-{
- unsigned int i, data_size = __per_cpu_data_end - __per_cpu_start;
-
- BUG_ON(data_size > PERCPU_SIZE);
-
- for ( i = 1; i < NR_CPUS; i++ )
- memcpy(__per_cpu_start + (i << PERCPU_SHIFT),
- __per_cpu_start,
- data_size);
-}
-
-static void percpu_free_unused_areas(void)
-{
- unsigned int i, first_unused;
-
- /* Find first unused CPU number. */
- for ( i = 0; i < NR_CPUS; i++ )
- if ( !cpu_online(i) )
- break;
- first_unused = i;
-
- /* Check that there are no holes in cpu_online_map. */
- for ( ; i < NR_CPUS; i++ )
- BUG_ON(cpu_online(i));
-
- init_xenheap_pages((ulong)__per_cpu_start + (first_unused << PERCPU_SHIFT),
- (ulong)__per_cpu_end);
-}
-
-static void __init start_of_day(void)
-{
- init_IRQ();
-
- scheduler_init();
-
- /* create idle domain */
- idle_domain = domain_create(IDLE_DOMAIN_ID, 0, 0);
- if ((idle_domain == NULL) || (alloc_vcpu(idle_domain, 0, 0) == NULL))
- BUG();
- set_current(idle_domain->vcpu[0]);
- idle_vcpu[0] = current;
-
- initialize_keytable();
- /* Register another key that will allow for the the Harware Probe
- * to be contacted, this works with RiscWatch probes and should
- * work with Chronos and FSPs */
- register_keyhandler('^', key_hw_probe_attn, "Trap to Hardware Probe");
-
- /* allow the dumping of the devtree */
- register_keyhandler('D', key_ofdump , "Dump OF Devtree");
-
- timer_init();
- rcu_init();
- serial_init_postirq();
- do_initcalls();
-}
-
-void startup_cpu_idle_loop(void)
-{
- struct vcpu *v = current;
-
- ASSERT(is_idle_vcpu(v));
- cpu_set(smp_processor_id(), v->domain->domain_dirty_cpumask);
- cpu_set(smp_processor_id(), v->vcpu_dirty_cpumask);
-
- /* Finally get off the boot stack. */
- reset_stack_and_jump(idle_loop);
-}
-
-/* The boot_pa is enough "parea" for the boot CPU to get thru
- * initialization, it will ultimately get replaced later */
-static __init void init_boot_cpu(void)
-{
- static struct processor_area boot_pa;
- boot_pa.whoami = 0;
- parea = &boot_pa;
-}
-
-static void init_parea(int cpuid)
-{
- /* Be careful not to shadow the global variable. */
- volatile struct processor_area *pa;
- void *stack;
-
- pa = xmalloc(struct processor_area);
- if (pa == NULL)
- panic("%s: failed to allocate parea for cpu #%d\n", __func__, cpuid);
-
- stack = alloc_xenheap_pages(STACK_ORDER);
- if (stack == NULL)
- panic("%s: failed to allocate stack (order %d) for cpu #%d\n",
- __func__, STACK_ORDER, cpuid);
-
- pa->whoami = cpuid;
- pa->hard_id = cpu_hard_id[cpuid];
- pa->hyp_stack_base = (void *)((ulong)stack + STACK_SIZE);
- mb();
-
- /* This store has the effect of invoking secondary_cpu_init. */
- global_cpu_table[cpuid] = pa;
- mb();
-}
-
-static int kick_secondary_cpus(int maxcpus)
-{
- int cpuid;
-
- for_each_present_cpu(cpuid) {
- int threads;
- int i;
-
- threads = cpu_threads(cpuid);
- for (i = 0; i < threads; i++)
- cpu_set(i, cpu_sibling_map[cpuid]);
-
- /* For now everything is single core */
- cpu_set(cpuid, cpu_core_map[cpuid]);
-
- rcu_online_cpu(cpuid);
-
- numa_set_node(cpuid, 0);
- numa_add_cpu(cpuid);
-
- if (cpuid == 0)
- continue;
- if (cpuid >= maxcpus)
- break;
- init_parea(cpuid);
- smp_generic_give_timebase();
-
- /* wait for it */
- while (!cpu_online(cpuid))
- cpu_relax();
- }
-
- return 0;
-}
-
-/* This is the first C code that secondary processors invoke. */
-void secondary_cpu_init(int cpuid, unsigned long r4)
-{
- struct vcpu *vcpu;
-
- cpu_initialize(cpuid);
- smp_generic_take_timebase();
-
- /* If we are online, we must be able to ACK IPIs. */
- mpic_setup_this_cpu();
- cpu_set(cpuid, cpu_online_map);
-
- vcpu = alloc_vcpu(idle_domain, cpuid, cpuid);
- BUG_ON(vcpu == NULL);
-
- set_current(idle_domain->vcpu[cpuid]);
- idle_vcpu[cpuid] = current;
- startup_cpu_idle_loop();
-
- panic("should never get here\n");
-}
-
-static void __init __start_xen(void)
-{
- memcpy(0, exception_vectors, exception_vectors_end - exception_vectors);
- synchronize_caches(0, exception_vectors_end - exception_vectors);
-
- ticks_per_usec = timebase_freq / 1000000ULL;
-
- /* Parse the command-line options. */
- cmdline_parse(xen_cmdline);
-
- /* we need to be able to identify this CPU early on */
- init_boot_cpu();
-
- /* We initialise the serial devices very early so we can get debugging. */
- ns16550.io_base = 0x3f8;
- ns16550_init(0, &ns16550);
- ns16550.io_base = 0x2f8;
- ns16550_init(1, &ns16550);
- serial_init_preirq();
-
- init_console();
- console_start_sync(); /* Stay synchronous for early debugging. */
-
- rtas_init((void *)oftree);
-
- memory_init();
-
- printk("xen_cmdline: %016lx\n", (ulong)xen_cmdline);
- printk("dom0_cmdline: %016lx\n", (ulong)dom0_cmdline);
- printk("dom0_addr: %016lx\n", (ulong)dom0_addr);
- printk("dom0_len: %016lx\n", (ulong)dom0_len);
- printk("initrd_start: %016lx\n", (ulong)initrd_start);
- printk("initrd_len: %016lx\n", (ulong)initrd_len);
-
- printk("dom0: %016llx\n", *(unsigned long long *)dom0_addr);
-
-#ifdef OF_DEBUG
- key_ofdump(0);
-#endif
- percpu_init_areas();
-
- init_parea(0);
- cpu_initialize(0);
-
-#ifdef CONFIG_GDB
- initialise_gdb();
- if (opt_earlygdb)
- debugger_trap_immediate();
-#endif
-
- start_of_day();
-
- acm_init(NULL, 0);
-
- mpic_setup_this_cpu();
-
- /* Deal with secondary processors. */
- if (opt_nosmp || ofd_boot_cpu == -1) {
- printk("nosmp: leaving secondary processors spinning forever\n");
- } else {
- printk("spinning up at most %d total processors ...\n", max_cpus);
- kick_secondary_cpus(max_cpus);
- }
-
- /* This cannot be called before secondary cpus are marked online. */
- percpu_free_unused_areas();
-
- /* Create initial domain 0. */
- dom0 = domain_create(0, 0, DOM0_SSIDREF);
- if (dom0 == NULL)
- panic("Error creating domain 0\n");
-
- /* The Interrupt Controller will route everything to CPU 0 so we
- * need to make sure Dom0's vVCPU 0 is pinned to the CPU */
- dom0->vcpu[0]->cpu_affinity = cpumask_of_cpu(0);
-
- dom0->is_privileged = 1;
- dom0->target = NULL;
-
- /* scrub_heap_pages() requires IRQs enabled, and we're post IRQ setup... */
- local_irq_enable();
- /* Scrub RAM that is still free and so may go to an unprivileged domain. */
- scrub_heap_pages();
-
- if ((dom0_addr == 0) || (dom0_len == 0))
- panic("No domain 0 found.\n");
-
- if (construct_dom0(dom0, dom0_addr, dom0_len,
- initrd_start, initrd_len,
- dom0_cmdline) != 0) {
- panic("Could not set up DOM0 guest OS\n");
- }
-
- init_xenheap_pages(ALIGN_UP(dom0_addr, PAGE_SIZE),
- ALIGN_DOWN(dom0_addr + dom0_len, PAGE_SIZE));
- if (initrd_start)
- init_xenheap_pages(ALIGN_UP(initrd_start, PAGE_SIZE),
- ALIGN_DOWN(initrd_start + initrd_len, PAGE_SIZE));
-
- init_trace_bufs();
-
- console_endboot();
-
- /* Hide UART from DOM0 if we're using it */
- serial_endboot();
-
- console_end_sync();
-
- domain_unpause_by_systemcontroller(dom0);
-#ifdef DEBUG_IPI
- ipi_torture_test();
-#endif
- startup_cpu_idle_loop();
-}
-
-static void ofd_bootargs(void)
-{
- static const char *sepr[] = {" -- ", " || "};
- char *p;
- ofdn_t chosen;
- int sepr_index;
- int rc;
-
- if (builtin_cmdline[0] == '\0') {
- chosen = ofd_node_find((void *)oftree, "/chosen");
- rc = ofd_getprop((void *)oftree, chosen, "bootargs", builtin_cmdline,
- CONFIG_CMDLINE_SIZE);
- }
-
- /* look for delimiter: "--" or "||" */
- for (sepr_index = 0; sepr_index < ARRAY_SIZE(sepr); sepr_index++){
- p = strstr(builtin_cmdline, sepr[sepr_index]);
- if (p != NULL) {
- /* Xen proper should never know about the dom0 args. */
- *p = '\0';
- p += strlen(sepr[sepr_index]);
- dom0_cmdline = p;
- break;
- }
- }
-
- xen_cmdline = builtin_cmdline;
-}
-
-void __init __start_xen_ppc(ulong, ulong, ulong, ulong, ulong, ulong);
-void __init __start_xen_ppc(
- ulong r3, ulong r4, ulong r5, ulong r6, ulong r7, ulong orig_msr)
-{
- /* clear bss */
- memset(__bss_start, 0, (ulong)_end - (ulong)__bss_start);
-
- if (r5) {
- /* We came from Open Firmware. */
- boot_of_init(r5, orig_msr);
- oftree = (ulong)boot_of_devtree(); /* Copy the device tree. */
- /* Use the device tree to find the Xen console. */
- boot_of_serial((void *)oftree);
- boot_of_finish(); /* End firmware. */
- } else {
- /* XXX handle flat device tree here */
- __builtin_trap();
- }
-
- ofd_bootargs();
-
- if (r3 == MB2_BOOTLOADER_MAGIC) {
- /* Get dom0 info from multiboot structures. */
- parse_multiboot(r4);
- }
-
- if ((dom0_len == 0) && r3 && r4) {
- /* Maybe dom0's location handed to us in registers. */
- dom0_addr = r3;
- dom0_len = r4;
- }
-
- if (dom0_len == 0) {
- /* Dom0 had better be built in. */
- dom0_addr = (ulong)dom0_start;
- dom0_len = (ulong)dom0_size;
- }
-
- __start_xen();
-}
-
-extern void arch_get_xen_caps(xen_capabilities_info_t *info);
-void arch_get_xen_caps(xen_capabilities_info_t *info)
-{
- /* Interface name is always xen-3.0-* for Xen-3.x. */
- int major = 3, minor = 0;
- char s[32];
-
- (*info)[0] = '\0';
-
- snprintf(s, sizeof(s), "xen-%d.%d-powerpc64 ", major, minor);
- safe_strcat(*info, s);
-}
-
-
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/arch/powerpc/shadow.c b/xen/arch/powerpc/shadow.c
deleted file mode 100644
index 5cf7a56582..0000000000
--- a/xen/arch/powerpc/shadow.c
+++ /dev/null
@@ -1,155 +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: Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/paging.h>
-
-static ulong htab_calc_sdr1(ulong htab_addr, ulong log_htab_size)
-{
- ulong sdr1_htabsize;
-
- ASSERT((htab_addr & ((1UL << log_htab_size) - 1)) == 0);
- ASSERT(log_htab_size <= SDR1_HTABSIZE_MAX);
- ASSERT(log_htab_size >= HTAB_MIN_LOG_SIZE);
-
- sdr1_htabsize = log_htab_size - LOG_PTEG_SIZE - SDR1_HTABSIZE_BASEBITS;
-
- return (htab_addr | (sdr1_htabsize & SDR1_HTABSIZE_MASK));
-}
-
-static ulong htab_alloc(struct domain *d, uint order)
-{
- ulong htab_raddr;
- uint log_htab_bytes = order + PAGE_SHIFT;
- uint htab_bytes = 1UL << log_htab_bytes;
-
- /* we use xenheap pages to keep domheap pages usefull for domains */
-
- if (order < 6)
- order = 6; /* architectural minimum is 2^18 */
- if (order > 34)
- order = 34; /* architectural minimum is 2^46 */
-
- htab_raddr = (ulong)alloc_xenheap_pages(order);
- if (htab_raddr > 0) {
- ASSERT((htab_raddr & (htab_bytes - 1)) == 0);
-
- d->arch.htab.order = order;
- d->arch.htab.log_num_ptes = log_htab_bytes - LOG_PTE_SIZE;
- d->arch.htab.sdr1 = htab_calc_sdr1(htab_raddr, log_htab_bytes);
- d->arch.htab.map = (union pte *)htab_raddr;
- }
- return htab_raddr;
-}
-
-static void htab_free(struct domain *d)
-{
- ulong htab_raddr = GET_HTAB(d);
-
- free_xenheap_pages((void *)htab_raddr, d->arch.htab.order);
-}
-
-
-unsigned int shadow_teardown(struct domain *d)
-{
- htab_free(d);
- return 0;
-}
-
-unsigned int shadow_set_allocation(struct domain *d,
- unsigned int megabytes,
- int *preempted)
-{
- uint pages;
- uint p;
- uint order;
- ulong addr;
-
-
- if (d->arch.htab.order)
- return -EBUSY;
-
- if (megabytes == 0) {
- /* old management tools */
- megabytes = 1; /* 1/64th of 64M */
- printk("%s: WARNING!!: Update your managment tools\n"
- " using %d MiB htab\n",
- __func__, megabytes);
- }
- pages = megabytes << (20 - PAGE_SHIFT);
- order = fls(pages) - 1; /* log2 truncated */
- if (pages & ((1 << order) - 1))
- ++order; /* round up */
-
- addr = htab_alloc(d, order);
-
- if (addr == 0)
- return -ENOMEM;
-
- /* XXX make this a continuation */
- for (p = 0; p < (1 << order); p++)
- clear_page((void *)(addr + (p << PAGE_SHIFT)));
-
- return 0;
-}
-
-int shadow_domctl(struct domain *d,
- xen_domctl_shadow_op_t *sc,
- XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
-{
- if ( unlikely(d == current->domain) )
- {
- gdprintk(XENLOG_INFO, "Don't try to do a shadow op on yourself!\n");
- return -EINVAL;
- }
-
- switch ( sc->op )
- {
- case XEN_DOMCTL_SHADOW_OP_OFF:
- gdprintk(XENLOG_INFO, "Shadow is mandatory!\n");
- return -EINVAL;
-
- case XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION:
- sc->mb = shadow_get_allocation(d);
- return 0;
-
- case XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION: {
- int rc;
- int preempted = 0;
-
- rc = shadow_set_allocation(d, sc->mb, &preempted);
-
- if (preempted)
- /* Not finished. Set up to re-run the call. */
- rc = hypercall_create_continuation(
- __HYPERVISOR_domctl, "h", u_domctl);
- else
- /* Finished. Return the new allocation */
- sc->mb = shadow_get_allocation(d);
- return rc;
- }
-
- default:
- printk("Bad shadow op %u\n", sc->op);
- BUG();
- return -EINVAL;
- }
-}
diff --git a/xen/arch/powerpc/smp-tbsync.c b/xen/arch/powerpc/smp-tbsync.c
deleted file mode 100644
index c45278cc35..0000000000
--- a/xen/arch/powerpc/smp-tbsync.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Smp timebase synchronization for ppc.
- *
- * Copyright (C) 2003 Samuel Rydh (samuel@ibrium.se)
- *
- */
-/* XXX Xen hacks ... */
-#define get_tb() get_timebase()
-#define set_tb(u,l) set_timebase(u,l)
-#define kmalloc(s,f) xmalloc_bytes(s);
-#define kfree(p) xfree(p)
-#define abs(x) ({ \
- int __x = (x); \
- (__x < 0) ? -__x : __x; \
- })
-
-#include <xen/kernel.h>
-#include <xen/sched.h>
-#include <xen/smp.h>
-#ifndef __XEN__
-#include <linux/unistd.h>
-#endif
-#include <xen/init.h>
-#include <asm/atomic.h>
-#include <asm/smp.h>
-#include <asm/time.h>
-
-
-/* don't mess with IRQs */
-#define local_irq_enable()
-#define local_irq_disable()
-
-#define NUM_ITER 300
-
-#undef DEBUG
-#ifdef DEBUG
-#define DBG(fmt...) printk(fmt)
-#else
-#define DBG(fmt...)
-#endif
-
-enum {
- kExit=0, kSetAndTest, kTest
-};
-
-static struct {
- volatile u64 tb;
- volatile u64 mark;
- volatile int cmd;
- volatile int handshake;
- int filler[2];
-
- volatile int ack;
- int filler2[7];
-
- volatile int race_result;
-} *tbsync;
-
-static volatile int running;
-
-static void __devinit enter_contest(u64 mark, long add)
-{
- while (get_tb() < mark)
- tbsync->race_result = add;
-}
-
-void __devinit smp_generic_take_timebase(void)
-{
- int cmd;
- u64 tb;
-
- local_irq_disable();
- while (!running)
- barrier();
- rmb();
-
- for (;;) {
- tbsync->ack = 1;
- while (!tbsync->handshake)
- barrier();
- rmb();
-
- cmd = tbsync->cmd;
- tb = tbsync->tb;
- mb();
- tbsync->ack = 0;
- if (cmd == kExit)
- break;
-
- while (tbsync->handshake)
- barrier();
- if (cmd == kSetAndTest)
- set_tb(tb >> 32, tb & 0xfffffffful);
- enter_contest(tbsync->mark, -1);
- }
- local_irq_enable();
-}
-
-static int __devinit start_contest(int cmd, long offset, int num)
-{
- int i, score=0;
- u64 tb;
- long mark;
-
- tbsync->cmd = cmd;
-
- local_irq_disable();
- for (i = -3; i < num; ) {
- tb = get_tb() + 400;
- tbsync->tb = tb + offset;
- tbsync->mark = mark = tb + 400;
-
- wmb();
-
- tbsync->handshake = 1;
- while (tbsync->ack)
- barrier();
-
- while (get_tb() <= tb)
- barrier();
- tbsync->handshake = 0;
- enter_contest(mark, 1);
-
- while (!tbsync->ack)
- barrier();
-
- if (i++ > 0)
- score += tbsync->race_result;
- }
- local_irq_enable();
- return score;
-}
-
-void __devinit smp_generic_give_timebase(void)
-{
- int i, score, score2, old, min=0, max=5000, offset=1000;
-
- printk("Synchronizing timebase...\n");
-
- /* if this fails then this kernel won't work anyway... */
- tbsync = kmalloc( sizeof(*tbsync), GFP_KERNEL );
- memset( tbsync, 0, sizeof(*tbsync) );
- mb();
- running = 1;
-
- while (!tbsync->ack)
- barrier();
-
- DBG("Got ack\n");
-
- /* binary search */
- for (old = -1; old != offset ; offset = (min+max) / 2) {
- score = start_contest(kSetAndTest, offset, NUM_ITER);
-
- DBG("score %d, offset %d\n", score, offset );
-
- if( score > 0 )
- max = offset;
- else
- min = offset;
- old = offset;
- }
- score = start_contest(kSetAndTest, min, NUM_ITER);
- score2 = start_contest(kSetAndTest, max, NUM_ITER);
-
- DBG("Min %d (score %d), Max %d (score %d)\n",
- min, score, max, score2);
- score = abs(score);
- score2 = abs(score2);
- offset = (score < score2) ? min : max;
-
- /* guard against inaccurate mttb */
- for (i = 0; i < 10; i++) {
- start_contest(kSetAndTest, offset, NUM_ITER/10);
-
- if ((score2 = start_contest(kTest, offset, NUM_ITER)) < 0)
- score2 = -score2;
- if (score2 <= score || score2 < 20)
- break;
- }
- DBG("Final offset: %d (%d/%d)\n", offset, score2, NUM_ITER );
-
- /* exiting */
- tbsync->cmd = kExit;
- wmb();
- tbsync->handshake = 1;
- while (tbsync->ack)
- barrier();
- tbsync->handshake = 0;
- kfree(tbsync);
- tbsync = NULL;
- running = 0;
-}
diff --git a/xen/arch/powerpc/smp.c b/xen/arch/powerpc/smp.c
deleted file mode 100644
index 57f2186df5..0000000000
--- a/xen/arch/powerpc/smp.c
+++ /dev/null
@@ -1,214 +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@us.ibm.com>
- * Authors: Amos Waterland <apw@us.ibm.com>
- */
-
-#include <xen/cpumask.h>
-#include <xen/smp.h>
-#include <asm/flushtlb.h>
-#include <asm/debugger.h>
-#include <asm/mpic.h>
-#include <asm/mach-default/irq_vectors.h>
-
-int smp_num_siblings = 1;
-int smp_num_cpus = 1;
-int ht_per_core = 1;
-
-void __flush_tlb_mask(cpumask_t mask, unsigned long addr)
-{
- if (cpu_isset(smp_processor_id(), mask)) {
- cpu_clear(smp_processor_id(), mask);
- if (cpus_empty(mask)) {
- /* only local */
- if (addr == FLUSH_ALL_ADDRS)
- local_flush_tlb();
- else
- local_flush_tlb_one(addr);
- return;
- }
- }
- /* if we are still here and the mask is non-empty, then we need to
- * flush other TLBs so we flush em all */
- if (!cpus_empty(mask))
- unimplemented();
-}
-
-void smp_send_event_check_mask(cpumask_t mask)
-{
- cpu_clear(smp_processor_id(), mask);
- if (!cpus_empty(mask))
- send_IPI_mask(mask, EVENT_CHECK_VECTOR);
-}
-
-
-int smp_call_function(void (*func) (void *info), void *info, int retry,
- int wait)
-{
- cpumask_t allbutself = cpu_online_map;
- cpu_clear(smp_processor_id(), allbutself);
-
- return on_selected_cpus(allbutself, func, info, retry, wait);
-}
-
-void smp_send_stop(void)
-{
- BUG();
-}
-
-struct call_data_struct {
- void (*func) (void *info);
- void *info;
- int wait;
- atomic_t started;
- atomic_t finished;
- cpumask_t selected;
-};
-
-static DEFINE_SPINLOCK(call_lock);
-static struct call_data_struct call_data;
-
-int on_selected_cpus(
- cpumask_t selected,
- void (*func) (void *info),
- void *info,
- int retry,
- int wait)
-{
- int retval = 0, nr_cpus = cpus_weight(selected);
- unsigned long start, stall = SECONDS(1);
-
- spin_lock(&call_lock);
-
- call_data.func = func;
- call_data.info = info;
- call_data.wait = wait;
- atomic_set(&call_data.started, 0);
- atomic_set(&call_data.finished, 0);
- mb();
-
- send_IPI_mask(selected, CALL_FUNCTION_VECTOR);
-
- /* We always wait for an initiation ACK from remote CPU. */
- for (start = NOW(); atomic_read(&call_data.started) != nr_cpus; ) {
- if (NOW() > start + stall) {
- printk("IPI start stall: %d ACKS to %d SYNS\n",
- atomic_read(&call_data.started), nr_cpus);
- start = NOW();
- }
- }
-
- /* If told to, we wait for a completion ACK from remote CPU. */
- if (wait) {
- for (start = NOW(); atomic_read(&call_data.finished) != nr_cpus; ) {
- if (NOW() > start + stall) {
- printk("IPI finish stall: %d ACKS to %d SYNS\n",
- atomic_read(&call_data.finished), nr_cpus);
- start = NOW();
- }
- }
- }
-
- spin_unlock(&call_lock);
-
- return retval;
-}
-
-void smp_call_function_interrupt(struct cpu_user_regs *regs)
-{
-
- void (*func)(void *info) = call_data.func;
- void *info = call_data.info;
- int wait = call_data.wait;
-
- atomic_inc(&call_data.started);
- mb();
- (*func)(info);
- mb();
-
- if (wait)
- atomic_inc(&call_data.finished);
-
- return;
-}
-
-void smp_event_check_interrupt(void)
-{
- /* We are knocked out of NAP state at least. */
- return;
-}
-
-void smp_message_recv(int msg, struct cpu_user_regs *regs)
-{
- switch(msg) {
- case CALL_FUNCTION_VECTOR:
- smp_call_function_interrupt(regs);
- break;
- case EVENT_CHECK_VECTOR:
- smp_event_check_interrupt();
- break;
- default:
- BUG();
- break;
- }
-}
-
-#ifdef DEBUG_IPI
-static void debug_ipi_ack(void *info)
-{
- if (info) {
- unsigned long start, stall = SECONDS(5);
- for (start = NOW(); NOW() < start + stall; );
- printk("IPI recv on cpu #%d: %s\n", smp_processor_id(), (char *)info);
- }
- return;
-}
-
-void ipi_torture_test(void)
-{
- int cpu;
- unsigned long before, after, delta;
- unsigned long min = ~0, max = 0, mean = 0, sum = 0, trials = 0;
- cpumask_t mask;
-
- cpus_clear(mask);
-
- while (trials < 1000000) {
- for_each_online_cpu(cpu) {
- cpu_set(cpu, mask);
- before = mftb();
- on_selected_cpus(mask, debug_ipi_ack, NULL, 1, 1);
- after = mftb();
- cpus_clear(mask);
-
- delta = after - before;
- if (delta > max) max = delta;
- if (delta < min) min = delta;
- sum += delta;
- trials++;
- }
- }
-
- mean = tb_to_ns(sum / trials);
-
- printk("IPI latency: min = %ld ticks, max = %ld ticks, mean = %ldns\n",
- min, max, mean);
-
- smp_call_function(debug_ipi_ack, "Hi", 0, 1);
-}
-#endif
diff --git a/xen/arch/powerpc/smpboot.c b/xen/arch/powerpc/smpboot.c
deleted file mode 100644
index 90dff38d22..0000000000
--- a/xen/arch/powerpc/smpboot.c
+++ /dev/null
@@ -1,29 +0,0 @@
-
-#include <xen/config.h>
-#include <xen/init.h>
-#include <xen/types.h>
-#include <xen/cpumask.h>
-#include <asm/cache.h>
-
-/* representing HT siblings of each logical CPU */
-cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly;
-EXPORT_SYMBOL(cpu_sibling_map);
-
-/* representing HT and core siblings of each logical CPU */
-cpumask_t cpu_core_map[NR_CPUS] __read_mostly;
-EXPORT_SYMBOL(cpu_core_map);
-
-/* bitmap of online cpus */
-cpumask_t cpu_online_map __read_mostly;
-EXPORT_SYMBOL(cpu_online_map);
-
-
-#ifdef CONFIG_HOTPLUG_CPU
-cpumask_t cpu_possible_map = CPU_MASK_ALL;
-#else
-cpumask_t cpu_possible_map;
-#endif
-EXPORT_SYMBOL(cpu_possible_map);
-
-u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = 0xff };
-EXPORT_SYMBOL(x86_cpu_to_apicid);
diff --git a/xen/arch/powerpc/start.S b/xen/arch/powerpc/start.S
deleted file mode 100644
index 9f4c21c29a..0000000000
--- a/xen/arch/powerpc/start.S
+++ /dev/null
@@ -1,62 +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) 2005, 2006 IBM Corp.
- *
- * Authors: Jimi Xenidis <jimix@watson.ibm.com>
- * Hollis Blanchard <hollisb@us.ibm.com>
- *
- */
-
-#include <asm/config.h>
-#include <asm/msr.h>
-#include <asm/processor.h>
-#include <asm/page.h>
-
- .globl _start
-_start:
- /* pass the original MSR along */
- mfmsr r8
-
- /* set initial MSR */
- li r22, 0
- ori r22, r22, (MSR_SF | MSR_HV) >> 48
- sldi r22, r22, 48
- mtmsrd r22
-
-_start64:
- /* load up the stack */
- SET_REG_TO_LABEL(r1, cpu0_stack)
-
- /* call the init function */
- LOADADDR(r21,__start_xen_ppc)
- ld r2, 8(r21)
- ld r21, 0(r21)
- mtctr r21
- bctrl
- /* should never return */
- trap
-
- /* Note! GDB 6.3 makes the very stupid assumption that PC > SP means we are
- * in a Linux signal trampoline, and it begins groping for a struct
- * rt_sigframe on the stack. Naturally, this fails miserably for our
- * backtrace. To work around this behavior, we must make certain that our
- * stack is always above our text, e.g. in the data section. */
- .data /* DO NOT REMOVE; see GDB note above */
- .align 4
-cpu0_stack_bottom:
- .space STACK_SIZE
-cpu0_stack:
- .space STACK_FRAME_OVERHEAD
diff --git a/xen/arch/powerpc/sysctl.c b/xen/arch/powerpc/sysctl.c
deleted file mode 100644
index 24db2a9141..0000000000
--- a/xen/arch/powerpc/sysctl.c
+++ /dev/null
@@ -1,65 +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@watson.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/lib.h>
-#include <xen/nodemask.h>
-#include <xen/sched.h>
-#include <xen/guest_access.h>
-#include <public/xen.h>
-#include <public/domctl.h>
-#include <public/sysctl.h>
-#include <asm/processor.h>
-
-long arch_do_sysctl(struct xen_sysctl *sysctl,
- XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl);
-long arch_do_sysctl(struct xen_sysctl *sysctl,
- XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
-{
- long ret = 0;
-
- switch (sysctl->cmd) {
- case XEN_SYSCTL_physinfo:
- {
- xen_sysctl_physinfo_t *pi = &sysctl->u.physinfo;
-
- memset(pi, 0, sizeof(*pi));
- pi->threads_per_core =
- cpus_weight(cpu_sibling_map[0]);
- pi->cores_per_socket =
- cpus_weight(cpu_core_map[0]) / pi->threads_per_core;
- pi->nr_cpus = (u32)num_online_cpus();
- pi->nr_nodes = num_online_nodes();
- pi->total_pages = total_pages;
- pi->free_pages = avail_domheap_pages();
- pi->cpu_khz = cpu_khz;
- ret = copy_to_guest(u_sysctl, sysctl, 1) ? -EFAULT : 0;
- }
- break;
-
- default:
- printk("%s: unsupported sysctl: 0x%x\n", __func__, (sysctl->cmd));
- ret = -ENOSYS;
- break;
- }
-
- return ret;
-}
diff --git a/xen/arch/powerpc/systemsim.S b/xen/arch/powerpc/systemsim.S
deleted file mode 100644
index 14e1013fb3..0000000000
--- a/xen/arch/powerpc/systemsim.S
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2005 Jimi Xenidis <jimix@watson.ibm.com>, 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/processor.h>
-
-_GLOBAL(systemsim_callthru)
- .long 0x000eaeb0
- blr
-
-_GLOBAL(systemsim_write)
- mr r5, r4
- mr r4, r3
- li r3, 0 # Write console code
-
- li r6, 0
- /* need to fix return value */
- mflr r7
- bl _ENTRY(systemsim_callthru)
- mtlr r7
- mr r3, r5
- blr
-
-_GLOBAL(systemsim_memset)
- mr r6, r5
- mr r5, r4
- mr r4, r3
- li r3, 0x47 # memset
- /* need to fix return value */
- mflr r7
- bl _ENTRY(systemsim_callthru)
- mtlr r7
- mr r3, r4
- blr
-
-_GLOBAL(systemsim_memcpy)
- mr r6, r5
- mr r5, r4
- mr r4, r3
- li r3, 0x45 # memcpy
- /* need to fix return value */
- mflr r7
- bl _ENTRY(systemsim_callthru)
- mtlr r7
- mr r3, r4
- blr
-
-
diff --git a/xen/arch/powerpc/tce.h b/xen/arch/powerpc/tce.h
deleted file mode 100644
index f0e76e40ad..0000000000
--- a/xen/arch/powerpc/tce.h
+++ /dev/null
@@ -1,71 +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@watson.ibm.com>
- */
-
-#ifndef _TCE_H
-#define _TCE_H
-
-#include <xen/config.h>
-#include <xen/types.h>
-
-union tce {
- u64 tce_dword;
- struct tce_bits {
- /* the bits here reflect the definition in Linux */
- /* the RPA considers all 52 bits to be the RPN */
- u64 tce_cache : 6;
- u64 _tce_r0 : 6; /* reserved */
- u64 tce_rpn :40; /* Real Page Number */
-
- /* The RPA considers the next 10 bits reserved */
- u64 tce_v : 1; /* Valid bit */
- u64 tce_vlps : 1; /* Valid for LPs */
- u64 tce_lpx : 8; /* LP index */
-
- /* the RPA defines the following two bits as:
- * 00: no access
- * 01: System Address read only
- * 10: System Address write only
- * 11: read/write
- */
- u64 tce_write : 1;
- u64 tce_read : 1;
- } tce_bits;
-};
-
-union tce_bdesc {
- u64 lbd_dword;
- struct lbd_bits {
- u64 lbd_ctrl_v : 1;
- u64 lbd_ctrl_vtoggle : 1;
- u64 _lbd_ctrl_res0 : 6;
- u64 lbd_len :24;
- u64 lbd_addr :32;
- } lbd_bits;
-};
-
-struct tce_data {
- ulong t_entries;
- ulong t_base;
- ulong t_alloc_size;
- union tce *t_tce;
-};
-
-#endif /* _TCE_H */
-
diff --git a/xen/arch/powerpc/time.c b/xen/arch/powerpc/time.c
deleted file mode 100644
index 3a5a05d2e2..0000000000
--- a/xen/arch/powerpc/time.c
+++ /dev/null
@@ -1,90 +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@watson.ibm.com>
- */
-
-#include <xen/config.h>
-#include <xen/time.h>
-#include <xen/smp.h>
-#include <xen/lib.h>
-#include <xen/sched.h>
-#include <asm/processor.h>
-#include <asm/current.h>
-#include <asm/debugger.h>
-
-#define Dprintk(x...)
-
-static int cpu_has_hdec = 1;
-ulong ticks_per_usec;
-unsigned long cpu_khz;
-s64 timebase_freq;
-
-s_time_t get_s_time(void)
-{
- return tb_to_ns(get_timebase());
-}
-
-static void set_preempt(unsigned ns)
-{
- ulong ticks = ns_to_tb(ns);
- if (cpu_has_hdec) {
- mthdec(ticks);
- } else {
- mtdec(ticks);
- }
-}
-
-/*
- * set preemption timer Timeout value is in ticks from start of boot
- * returns 1 on success
- * returns 0 if the timeout value is too small or in the past.
- */
-extern int reprogram_timer(s_time_t timeout);
-int reprogram_timer(s_time_t timeout)
-{
- s_time_t expire;
-
- if (timeout == 0) {
- expire = INT_MAX;
- } else {
- s_time_t now;
-
- now = get_s_time();
- expire = timeout - now; /* value from now */
-
- if (expire <= 0) {
- Dprintk("%s[%02d] Timeout in the past "
- "0x%08X%08X > 0x%08X%08X\n", __func__,
- smp_processor_id(), (u32)(now >> 32),
- (u32)now, (u32)(timeout >> 32), (u32)timeout);
- return 0;
- }
- }
- set_preempt(expire);
- return 1;
-}
-
-void send_timer_event(struct vcpu *v)
-{
- v->arch.dec = 1;
- vcpu_unblock(v);
-}
-
-void update_vcpu_system_time(struct vcpu *v)
-{
-}
diff --git a/xen/arch/powerpc/usercopy.c b/xen/arch/powerpc/usercopy.c
deleted file mode 100644
index 4fb2546dcb..0000000000
--- a/xen/arch/powerpc/usercopy.c
+++ /dev/null
@@ -1,50 +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@us.ibm.com>
- */
-
-#include <xen/sched.h>
-#include <xen/lib.h>
-#include <asm/current.h>
-#include <asm/page.h>
-#include <asm/debugger.h>
-
-/* XXX need to return error, not panic, if domain passed a bad pointer */
-unsigned long paddr_to_maddr(unsigned long paddr)
-{
- struct vcpu *v = get_current();
- struct domain *d = v->domain;
- ulong gpfn;
- ulong offset;
- ulong pa = paddr;
-
- offset = pa & ~PAGE_MASK;
- gpfn = pa >> PAGE_SHIFT;
-
- pa = gmfn_to_mfn(d, gpfn);
- if (pa == INVALID_MFN) {
- printk("%s: Dom:%d bad paddr: 0x%lx\n",
- __func__, d->domain_id, paddr);
- return 0;
- }
-
- pa <<= PAGE_SHIFT;
- pa |= offset;
-
- return pa;
-}
diff --git a/xen/arch/powerpc/xen.lds.S b/xen/arch/powerpc/xen.lds.S
deleted file mode 100644
index 823d7fc42b..0000000000
--- a/xen/arch/powerpc/xen.lds.S
+++ /dev/null
@@ -1,250 +0,0 @@
-#include <asm/config.h>
-#include <asm/page.h>
-#include <asm/percpu.h>
-
-/* Script for -z combreloc: combine and sort reloc sections */
-OUTPUT_FORMAT("elf64-powerpc", "elf64-powerpc",
- "elf64-powerpc")
-OUTPUT_ARCH(powerpc:common64)
-ENTRY(_start)
-SEARCH_DIR("=/usr/local/lib64"); SEARCH_DIR("=/lib64"); SEARCH_DIR("=/usr/lib64"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
-/* Do we need any of these for elf?
- __DYNAMIC = 0; */
-PHDRS
-{
- text PT_LOAD;
-}
-SECTIONS
-{
- . = 0x00400000;
- PROVIDE(_text = .);
- PROVIDE(_stext = .);
- /* Read-only sections, merged into text segment: */
- .interp : { *(.interp) } :text
- .hash : { *(.hash) }
- .dynsym : { *(.dynsym) }
- .dynstr : { *(.dynstr) }
- .gnu.version : { *(.gnu.version) }
- .gnu.version_d : { *(.gnu.version_d) }
- .gnu.version_r : { *(.gnu.version_r) }
- .rel.dyn :
- {
- *(.rel.init)
- *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
- *(.rel.fini)
- *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
- *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
- *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
- *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
- *(.rel.ctors)
- *(.rel.dtors)
- *(.rel.got)
- *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
- *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
- *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
- *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
- *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
- }
- .rela.dyn :
- {
- *(.rela.init)
- *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
- *(.rela.fini)
- *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
- *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
- *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
- *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
- *(.rela.ctors)
- *(.rela.dtors)
- *(.rela.got)
- *(.rela.toc)
- *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
- *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
- *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
- *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
- *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
- }
- .rel.plt : { *(.rel.plt) }
- .rela.plt : { *(.rela.plt) }
- .rela.tocbss : { *(.rela.tocbss) }
- .init :
- {
- KEEP (*(.init))
- } =0x60000000
- .text :
- {
- *(.text .stub .text.* .gnu.linkonce.t.*)
- /* .gnu.warning sections are handled specially by elf32.em. */
- *(.gnu.warning)
- *(.sfpr .glink)
- } =0x60000000
- .fini :
- {
- KEEP (*(.fini))
- } =0x60000000
- PROVIDE (__etext = .);
- PROVIDE (_etext = .);
- PROVIDE (etext = .);
- .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
- .rodata1 : { *(.rodata1) }
- .sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) }
- .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
- .eh_frame_hdr : { *(.eh_frame_hdr) }
- /* Adjust the address for the data segment. We want to adjust up to
- the same address within the page on the next page up. */
- . = ALIGN (0x10000) - ((0x10000 - .) & (0x10000 - 1)); . = DATA_SEGMENT_ALIGN (0x10000, 0x1000);
- /* Ensure the __preinit_array_start label is properly aligned. We
- could instead move the label definition inside the section, but
- the linker would then create the section even if it turns out to
- be empty, which isn't pretty. */
- . = ALIGN(64 / 8);
- PROVIDE (__preinit_array_start = .);
- .preinit_array : { *(.preinit_array) }
- PROVIDE (__preinit_array_end = .);
- PROVIDE (__init_array_start = .);
- .init_array : { *(.init_array) }
- PROVIDE (__init_array_end = .);
- PROVIDE (__fini_array_start = .);
- .fini_array : { *(.fini_array) }
- PROVIDE (__fini_array_end = .);
- .data :
- {
- *(.data .gnu.linkonce.d.*)
- SORT(CONSTRUCTORS)
- }
-
- . = ALIGN(4096);
- __init_begin = .;
- _sinittext = .;
- .init.text : { *(.init.text) } : text
- _einittext = .;
- .init.data : { *(.init.data) } : text
- . = ALIGN(32);
- __setup_start = .;
- .init.setup : { *(.init.setup) } : text
- __setup_end = .;
- __initcall_start = .;
- .initcall.init : { *(.initcall1.init) } : text
- __initcall_end = .;
- __init_hcall_start = .;
- .init_hcall.init : { *(.init_hcall.init) } : text
- __init_hcall_end = .;
- __builtin_cmdline : { *(__builtin_cmdline) } : text
- . = ALIGN(4096);
- __init_end = .;
-
- __per_cpu_start = .;
- .data.percpu : { *(.data.percpu) }
- __per_cpu_data_end = .;
- . = __per_cpu_start + (NR_CPUS << PERCPU_SHIFT);
- . = ALIGN(STACK_SIZE);
- __per_cpu_end = .;
-
- .data1 : { *(.data1) }
- .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
- .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
- .eh_frame : { KEEP (*(.eh_frame)) }
- .gcc_except_table : { *(.gcc_except_table) }
- .toc1 ALIGN(8) : { *(.toc1) }
- .opd ALIGN(8) : { KEEP (*(.opd)) }
- .dynamic : { *(.dynamic) }
- .ctors :
- {
- /* gcc uses crtbegin.o to find the start of
- the constructors, so we make sure it is
- first. Because this is a wildcard, it
- doesn't matter if the user does not
- actually link against crtbegin.o; the
- linker won't look for a file to match a
- wildcard. The wildcard also means that it
- doesn't matter which directory crtbegin.o
- is in. */
- KEEP (*crtbegin*.o(.ctors))
- /* We don't want to include the .ctor section from
- from the crtend.o file until after the sorted ctors.
- The .ctor section from the crtend file contains the
- end of ctors marker and it must be last */
- KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
- KEEP (*(SORT(.ctors.*)))
- KEEP (*(.ctors))
- }
- .dtors :
- {
- KEEP (*crtbegin*.o(.dtors))
- KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
- KEEP (*(SORT(.dtors.*)))
- KEEP (*(.dtors))
- }
- .jcr : { KEEP (*(.jcr)) }
- .got ALIGN(8) : { *(.got .toc) }
- /* We want the small data sections together, so single-instruction offsets
- can access them all, and initialized data all before uninitialized, so
- we can shorten the on-disk segment size. */
- .sdata :
- {
- *(.sdata .sdata.* .gnu.linkonce.s.*)
- }
- _edata = .;
- PROVIDE (edata = .);
- __bss_start = .;
- .tocbss ALIGN(8) : { *(.tocbss)}
- .sbss :
- {
- PROVIDE (__sbss_start = .);
- PROVIDE (___sbss_start = .);
- *(.dynsbss)
- *(.sbss .sbss.* .gnu.linkonce.sb.*)
- *(.scommon)
- PROVIDE (__sbss_end = .);
- PROVIDE (___sbss_end = .);
- }
- .plt : { *(.plt) }
- .bss :
- {
- *(.dynbss)
- *(.bss .bss.* .gnu.linkonce.b.*)
- *(COMMON)
- /* Align here to ensure that the .bss section occupies space up to
- _end. Align after .bss to ensure correct alignment even if the
- .bss section disappears because there are no input sections. */
- . = ALIGN(64 / 8);
- }
- . = ALIGN(64 / 8);
- _end = .;
- PROVIDE (end = .);
- . = DATA_SEGMENT_END (.);
- /* Stabs debugging sections. */
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
- .stab.excl 0 : { *(.stab.excl) }
- .stab.exclstr 0 : { *(.stab.exclstr) }
- .stab.index 0 : { *(.stab.index) }
- .stab.indexstr 0 : { *(.stab.indexstr) }
- .comment 0 : { *(.comment) }
- /* DWARF debug sections.
- Symbols in the DWARF debugging sections are relative to the beginning
- of the section so we begin them at 0. */
- /* DWARF 1 */
- .debug 0 : { *(.debug) }
- .line 0 : { *(.line) }
- /* GNU DWARF 1 extensions */
- .debug_srcinfo 0 : { *(.debug_srcinfo) }
- .debug_sfnames 0 : { *(.debug_sfnames) }
- /* DWARF 1.1 and DWARF 2 */
- .debug_aranges 0 : { *(.debug_aranges) }
- .debug_pubnames 0 : { *(.debug_pubnames) }
- /* DWARF 2 */
- .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
- .debug_abbrev 0 : { *(.debug_abbrev) }
- .debug_line 0 : { *(.debug_line) }
- .debug_frame 0 : { *(.debug_frame) }
- .debug_str 0 : { *(.debug_str) }
- .debug_loc 0 : { *(.debug_loc) }
- .debug_macinfo 0 : { *(.debug_macinfo) }
- /* SGI/MIPS DWARF 2 extensions */
- .debug_weaknames 0 : { *(.debug_weaknames) }
- .debug_funcnames 0 : { *(.debug_funcnames) }
- .debug_typenames 0 : { *(.debug_typenames) }
- .debug_varnames 0 : { *(.debug_varnames) }
- /DISCARD/ : { *(.note.GNU-stack) }
-}
diff --git a/xen/include/asm-powerpc/acpi.h b/xen/include/asm-powerpc/acpi.h
deleted file mode 100644
index a5cbef475b..0000000000
--- a/xen/include/asm-powerpc/acpi.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#define MAX_LOCAL_APIC 256
-
diff --git a/xen/include/asm-powerpc/asm_defns.h b/xen/include/asm-powerpc/asm_defns.h
deleted file mode 100644
index 1c677a2a16..0000000000
--- a/xen/include/asm-powerpc/asm_defns.h
+++ /dev/null
@@ -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@watson.ibm.com>
- */
-
-#ifndef __PPC_ASM_DEFNS_H__
-#define __PPC_ASM_DEFNS_H__
-
-/* NB. Auto-generated from arch/.../asm-offsets.c */
-#include <asm/asm-offsets.h>
-#include <asm/processor.h>
-
-#endif /* __PPC_ASM_DEFNS_H__ */
diff --git a/xen/include/asm-powerpc/atomic.h b/xen/include/asm-powerpc/atomic.h
deleted file mode 100644
index 78df061498..0000000000
--- a/xen/include/asm-powerpc/atomic.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * PowerPC64 atomic operations
- *
- * Copyright (C) 2001 Paul Mackerras <paulus@au.ibm.com>, IBM
- * Copyright (C) 2001 Anton Blanchard <anton@au.ibm.com>, IBM
- *
- * 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.
- */
-
-#ifndef _ASM_PPC64_ATOMIC_H_
-#define _ASM_PPC64_ATOMIC_H_
-
-#include <asm/memory.h>
-#include <asm/system.h>
-
-typedef struct { volatile int counter; } atomic_t;
-
-#define ATOMIC_INIT(i) { (i) }
-
-#define atomic_read(v) ((v)->counter)
-#define _atomic_read(v) atomic_read(&v)
-#define atomic_set(v,i) (((v)->counter) = (i))
-#define _atomic_set(v,i) atomic_set(&v,i)
-
-static __inline__ void atomic_add(int a, atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
-"1: lwarx %0,0,%3 # atomic_add\n\
- add %0,%2,%0\n\
- stwcx. %0,0,%3\n\
- bne- 1b"
- : "=&r" (t), "=m" (v->counter)
- : "r" (a), "r" (&v->counter), "m" (v->counter)
- : "cc");
-}
-
-static __inline__ int atomic_add_return(int a, atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
- EIEIO_ON_SMP
-"1: lwarx %0,0,%2 # atomic_add_return\n\
- add %0,%1,%0\n\
- stwcx. %0,0,%2\n\
- bne- 1b"
- ISYNC_ON_SMP
- : "=&r" (t)
- : "r" (a), "r" (&v->counter)
- : "cc", "memory");
-
- return t;
-}
-
-#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
-
-static __inline__ void atomic_sub(int a, atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
-"1: lwarx %0,0,%3 # atomic_sub\n\
- subf %0,%2,%0\n\
- stwcx. %0,0,%3\n\
- bne- 1b"
- : "=&r" (t), "=m" (v->counter)
- : "r" (a), "r" (&v->counter), "m" (v->counter)
- : "cc");
-}
-
-static __inline__ int atomic_sub_return(int a, atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
- EIEIO_ON_SMP
-"1: lwarx %0,0,%2 # atomic_sub_return\n\
- subf %0,%1,%0\n\
- stwcx. %0,0,%2\n\
- bne- 1b"
- ISYNC_ON_SMP
- : "=&r" (t)
- : "r" (a), "r" (&v->counter)
- : "cc", "memory");
-
- return t;
-}
-
-static __inline__ void atomic_inc(atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
-"1: lwarx %0,0,%2 # atomic_inc\n\
- addic %0,%0,1\n\
- stwcx. %0,0,%2\n\
- bne- 1b"
- : "=&r" (t), "=m" (v->counter)
- : "r" (&v->counter), "m" (v->counter)
- : "cc");
-}
-
-static __inline__ int atomic_inc_return(atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
- EIEIO_ON_SMP
-"1: lwarx %0,0,%1 # atomic_inc_return\n\
- addic %0,%0,1\n\
- stwcx. %0,0,%1\n\
- bne- 1b"
- ISYNC_ON_SMP
- : "=&r" (t)
- : "r" (&v->counter)
- : "cc", "memory");
-
- return t;
-}
-
-/*
- * atomic_inc_and_test - increment and test
- * @v: pointer of type atomic_t
- *
- * Atomically increments @v by 1
- * and returns true if the result is zero, or false for all
- * other cases.
- */
-#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
-
-static __inline__ void atomic_dec(atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
-"1: lwarx %0,0,%2 # atomic_dec\n\
- addic %0,%0,-1\n\
- stwcx. %0,0,%2\n\
- bne- 1b"
- : "=&r" (t), "=m" (v->counter)
- : "r" (&v->counter), "m" (v->counter)
- : "cc");
-}
-
-static __inline__ int atomic_dec_return(atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
- EIEIO_ON_SMP
-"1: lwarx %0,0,%1 # atomic_dec_return\n\
- addic %0,%0,-1\n\
- stwcx. %0,0,%1\n\
- bne- 1b"
- ISYNC_ON_SMP
- : "=&r" (t)
- : "r" (&v->counter)
- : "cc", "memory");
-
- return t;
-}
-
-#define atomic_sub_and_test(a, v) (atomic_sub_return((a), (v)) == 0)
-#define atomic_dec_and_test(v) (atomic_dec_return((v)) == 0)
-
-/*
- * Atomically test *v and decrement if it is greater than 0.
- * The function returns the old value of *v minus 1.
- */
-static __inline__ int atomic_dec_if_positive(atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
- EIEIO_ON_SMP
-"1: lwarx %0,0,%1 # atomic_dec_if_positive\n\
- addic. %0,%0,-1\n\
- blt- 2f\n\
- stwcx. %0,0,%1\n\
- bne- 1b"
- ISYNC_ON_SMP
- "\n\
-2:" : "=&r" (t)
- : "r" (&v->counter)
- : "cc", "memory");
-
- return t;
-}
-
-
-static __inline__ atomic_t atomic_compareandswap(
- atomic_t old, atomic_t new, atomic_t *v)
-{
- atomic_t rc;
- rc.counter =
- __cmpxchg(&v->counter, old.counter, new.counter, sizeof(int));
- return rc;
-}
-
-
-#define smp_mb__before_atomic_dec() smp_mb()
-#define smp_mb__after_atomic_dec() smp_mb()
-#define smp_mb__before_atomic_inc() smp_mb()
-#define smp_mb__after_atomic_inc() smp_mb()
-
-#endif /* _ASM_PPC64_ATOMIC_H_ */
diff --git a/xen/include/asm-powerpc/bitops.h b/xen/include/asm-powerpc/bitops.h
deleted file mode 100644
index ec7e54d1f0..0000000000
--- a/xen/include/asm-powerpc/bitops.h
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * PowerPC64 atomic bit operations.
- * Dave Engebretsen, Todd Inglett, Don Reed, Pat McCarthy, Peter Bergner,
- * Anton Blanchard
- *
- * Originally taken from the 32b PPC code. Modified to use 64b values for
- * the various counters & memory references.
- *
- * Bitops are odd when viewed on big-endian systems. They were designed
- * on little endian so the size of the bitset doesn't matter (low order bytes
- * come first) as long as the bit in question is valid.
- *
- * Bits are "tested" often using the C expression (val & (1<<nr)) so we do
- * our best to stay compatible with that. The assumption is that val will
- * be unsigned long for such tests. As such, we assume the bits are stored
- * as an array of unsigned long (the usual case is a single unsigned long,
- * of course). Here's an example bitset with bit numbering:
- *
- * |63..........0|127........64|195.......128|255.......196|
- *
- * This leads to a problem. If an int, short or char is passed as a bitset
- * it will be a bad memory reference since we want to store in chunks
- * of unsigned long (64 bits here) size.
- *
- * There are a few little-endian macros used mostly for filesystem bitmaps,
- * these work on similar bit arrays layouts, but byte-oriented:
- *
- * |7...0|15...8|23...16|31...24|39...32|47...40|55...48|63...56|
- *
- * The main difference is that bit 3-5 in the bit number field needs to be
- * reversed compared to the big-endian bit fields. This can be achieved
- * by XOR with 0b111000 (0x38).
- *
- * 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.
- */
-
-#ifndef _PPC64_BITOPS_H
-#define _PPC64_BITOPS_H
-
-#include <asm/memory.h>
-
-/*
- * clear_bit doesn't imply a memory barrier
- */
-#define smp_mb__before_clear_bit() smp_mb()
-#define smp_mb__after_clear_bit() smp_mb()
-
-static __inline__ int test_bit(unsigned long nr, __const__ volatile unsigned long *addr)
-{
- volatile unsigned long *laddr = (volatile unsigned long *)addr;
- return (1UL & (laddr[nr >> 6] >> (nr & 63)));
-}
-
-static __inline__ void set_bit(unsigned long nr, volatile unsigned long *addr)
-{
- unsigned long old;
- unsigned long mask = 1UL << (nr & 0x3f);
- unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
- __asm__ __volatile__(
-"1: ldarx %0,0,%3 # set_bit\n\
- or %0,%0,%2\n\
- stdcx. %0,0,%3\n\
- bne- 1b"
- : "=&r" (old), "=m" (*p)
- : "r" (mask), "r" (p), "m" (*p)
- : "cc");
-}
-
-static __inline__ void clear_bit(unsigned long nr, volatile unsigned long *addr)
-{
- unsigned long old;
- unsigned long mask = 1UL << (nr & 0x3f);
- unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
- __asm__ __volatile__(
-"1: ldarx %0,0,%3 # clear_bit\n\
- andc %0,%0,%2\n\
- stdcx. %0,0,%3\n\
- bne- 1b"
- : "=&r" (old), "=m" (*p)
- : "r" (mask), "r" (p), "m" (*p)
- : "cc");
-}
-
-static __inline__ void change_bit(unsigned long nr, volatile unsigned long *addr)
-{
- unsigned long old;
- unsigned long mask = 1UL << (nr & 0x3f);
- unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
- __asm__ __volatile__(
-"1: ldarx %0,0,%3 # change_bit\n\
- xor %0,%0,%2\n\
- stdcx. %0,0,%3\n\
- bne- 1b"
- : "=&r" (old), "=m" (*p)
- : "r" (mask), "r" (p), "m" (*p)
- : "cc");
-}
-
-static __inline__ int test_and_set_bit(unsigned long nr, volatile unsigned long *addr)
-{
- unsigned long old, t;
- unsigned long mask = 1UL << (nr & 0x3f);
- unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
- __asm__ __volatile__(
- EIEIO_ON_SMP
-"1: ldarx %0,0,%3 # test_and_set_bit\n\
- or %1,%0,%2 \n\
- stdcx. %1,0,%3 \n\
- bne- 1b"
- ISYNC_ON_SMP
- : "=&r" (old), "=&r" (t)
- : "r" (mask), "r" (p)
- : "cc", "memory");
-
- return (old & mask) != 0;
-}
-
-static __inline__ int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
-{
- unsigned long old, t;
- unsigned long mask = 1UL << (nr & 0x3f);
- unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
- __asm__ __volatile__(
- EIEIO_ON_SMP
-"1: ldarx %0,0,%3 # test_and_clear_bit\n\
- andc %1,%0,%2\n\
- stdcx. %1,0,%3\n\
- bne- 1b"
- ISYNC_ON_SMP
- : "=&r" (old), "=&r" (t)
- : "r" (mask), "r" (p)
- : "cc", "memory");
-
- return (old & mask) != 0;
-}
-
-static __inline__ int test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
-{
- unsigned long old, t;
- unsigned long mask = 1UL << (nr & 0x3f);
- unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
- __asm__ __volatile__(
- EIEIO_ON_SMP
-"1: ldarx %0,0,%3 # test_and_change_bit\n\
- xor %1,%0,%2\n\
- stdcx. %1,0,%3\n\
- bne- 1b"
- ISYNC_ON_SMP
- : "=&r" (old), "=&r" (t)
- : "r" (mask), "r" (p)
- : "cc", "memory");
-
- return (old & mask) != 0;
-}
-
-static __inline__ void set_bits(unsigned long mask, unsigned long *addr)
-{
- unsigned long old;
-
- __asm__ __volatile__(
-"1: ldarx %0,0,%3 # set_bit\n\
- or %0,%0,%2\n\
- stdcx. %0,0,%3\n\
- bne- 1b"
- : "=&r" (old), "=m" (*addr)
- : "r" (mask), "r" (addr), "m" (*addr)
- : "cc");
-}
-
-/*
- * non-atomic versions
- */
-static __inline__ void __set_bit(unsigned long nr, volatile unsigned long *addr)
-{
- unsigned long mask = 1UL << (nr & 0x3f);
- unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
- *p |= mask;
-}
-
-static __inline__ void __clear_bit(unsigned long nr, volatile unsigned long *addr)
-{
- unsigned long mask = 1UL << (nr & 0x3f);
- unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
- *p &= ~mask;
-}
-
-static __inline__ void __change_bit(unsigned long nr, volatile unsigned long *addr)
-{
- unsigned long mask = 1UL << (nr & 0x3f);
- unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
- *p ^= mask;
-}
-
-static __inline__ int __test_and_set_bit(unsigned long nr, volatile unsigned long *addr)
-{
- unsigned long mask = 1UL << (nr & 0x3f);
- unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
- unsigned long old = *p;
-
- *p = old | mask;
- return (old & mask) != 0;
-}
-
-static __inline__ int __test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
-{
- unsigned long mask = 1UL << (nr & 0x3f);
- unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
- unsigned long old = *p;
-
- *p = old & ~mask;
- return (old & mask) != 0;
-}
-
-static __inline__ int __test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
-{
- unsigned long mask = 1UL << (nr & 0x3f);
- unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
- unsigned long old = *p;
-
- *p = old ^ mask;
- return (old & mask) != 0;
-}
-
-/*
- * Return the zero-based bit position (from RIGHT TO LEFT, 63 -> 0) of the
- * most significant (left-most) 1-bit in a double word.
- */
-static __inline__ int __ilog2(unsigned long x)
-{
- int lz;
-
- asm ("cntlzd %0,%1" : "=r" (lz) : "r" (x));
- return 63 - lz;
-}
-
-/*
- * Determines the bit position of the least significant (rightmost) 0 bit
- * in the specified double word. The returned bit position will be zero-based,
- * starting from the right side (63 - 0).
- */
-static __inline__ unsigned long ffz(unsigned long x)
-{
- /* no zero exists anywhere in the 8 byte area. */
- if ((x = ~x) == 0)
- return 64;
-
- /*
- * Calculate the bit position of the least signficant '1' bit in x
- * (since x has been changed this will actually be the least signficant
- * '0' bit in * the original x). Note: (x & -x) gives us a mask that
- * is the least significant * (RIGHT-most) 1-bit of the value in x.
- */
- return __ilog2(x & -x);
-}
-
-static __inline__ int __ffs(unsigned long x)
-{
- return __ilog2(x & -x);
-}
-
-/*
- * ffs: find first bit set. This is defined the same way as
- * the libc and compiler builtin ffs routines, therefore
- * differs in spirit from the above ffz (man ffs).
- */
-static __inline__ int ffs(int x)
-{
- unsigned long i = (unsigned long)x;
- return __ilog2(i & -i) + 1;
-}
-
-#define find_first_set_bit(word) (ffs(word)-1)
-
-/*
- * fls: find last (most-significant) bit set.
- * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
- */
-#define fls(x) generic_fls(x)
-
-/*
- * hweightN: returns the hamming weight (i.e. the number
- * of bits set) of a N-bit word
- */
-#define hweight64(x) generic_hweight64(x)
-#define hweight32(x) generic_hweight32(x)
-#define hweight16(x) generic_hweight16(x)
-#define hweight8(x) generic_hweight8(x)
-
-extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, unsigned long offset);
-#define find_first_zero_bit(addr, size) \
- find_next_zero_bit((addr), (size), 0)
-
-extern unsigned long find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset);
-#define find_first_bit(addr, size) \
- find_next_bit((addr), (size), 0)
-
-#endif /* _PPC64_BITOPS_H */
diff --git a/xen/include/asm-powerpc/boot.h b/xen/include/asm-powerpc/boot.h
deleted file mode 100644
index 462b891bc5..0000000000
--- a/xen/include/asm-powerpc/boot.h
+++ /dev/null
@@ -1,46 +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. 2007
- *
- * Authors: Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#ifndef _ASM_BOOT_H
-#define _ASM_BOOT_H
-
-/* a collection of interfaces used during boot. */
-
-extern void boot_of_init(ulong, ulong);
-extern void *boot_of_devtree(void);
-extern void boot_of_serial(void *);
-extern void boot_of_finish(void);
-extern int boot_of_mem_avail(int pos, ulong *startpage, ulong *endpage);
-
-extern void parse_multiboot(ulong tags_addr);
-
-extern void memory_init(void);
-
-extern char *xen_cmdline;
-extern ulong dom0_addr;
-extern ulong dom0_len;
-extern char *dom0_cmdline;
-extern ulong initrd_start;
-extern ulong initrd_len;
-
-/* From linker script. */
-extern char builtin_cmdline[];
-
-#endif
diff --git a/xen/include/asm-powerpc/bug.h b/xen/include/asm-powerpc/bug.h
deleted file mode 100644
index 65caa37171..0000000000
--- a/xen/include/asm-powerpc/bug.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef __POWERPC_BUG_H__
-#define __POWERPC_BUG_H__
-
-#define BUG() __bug(__FILE__, __LINE__)
-#define WARN() __warn(__FILE__, __LINE__)
-
-#endif /* __POWERPC_BUG_H__ */
diff --git a/xen/include/asm-powerpc/byteorder.h b/xen/include/asm-powerpc/byteorder.h
deleted file mode 100644
index 94bbea2929..0000000000
--- a/xen/include/asm-powerpc/byteorder.h
+++ /dev/null
@@ -1,80 +0,0 @@
-#ifndef _ASM_POWERPC_BYTEORDER_H
-#define _ASM_POWERPC_BYTEORDER_H
-
-/*
- * 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 <asm/types.h>
-#include <xen/compiler.h>
-
-static inline __u16 ld_le16(const volatile __u16 *addr)
-{
- __u16 val;
-
- asm volatile ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
- return val;
-}
-
-static inline void st_le16(volatile __u16 *addr, const __u16 val)
-{
- asm volatile ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
-}
-
-static inline __u32 ld_le32(const volatile __u32 *addr)
-{
- __u32 val;
-
- asm volatile ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
- return val;
-}
-
-static inline void st_le32(volatile __u32 *addr, const __u32 val)
-{
- asm volatile ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
-}
-
-static inline __attribute_const__ __u16 ___arch__swab16(__u16 value)
-{
- __u16 result;
-
- asm("rlwimi %0,%1,8,16,23"
- : "=r" (result)
- : "r" (value), "0" (value >> 8));
- return result;
-}
-
-static inline __attribute_const__ __u32 ___arch__swab32(__u32 value)
-{
- __u32 result;
-
- asm("rlwimi %0,%1,24,16,23\n\t"
- "rlwimi %0,%1,8,8,15\n\t"
- "rlwimi %0,%1,24,0,7"
- : "=r" (result)
- : "r" (value), "0" (value >> 24));
- return result;
-}
-
-#define __arch__swab16(x) ___arch__swab16(x)
-#define __arch__swab32(x) ___arch__swab32(x)
-
-/* The same, but returns converted value from the location pointer by addr. */
-#define __arch__swab16p(addr) ld_le16(addr)
-#define __arch__swab32p(addr) ld_le32(addr)
-
-/* The same, but do the conversion in situ, ie. put the value back to addr. */
-#define __arch__swab16s(addr) st_le16(addr,*addr)
-#define __arch__swab32s(addr) st_le32(addr,*addr)
-
-#define __BYTEORDER_HAS_U64__
-#ifndef __powerpc64__
-#define __SWAB_64_THRU_32__
-#endif /* __powerpc64__ */
-
-#include <xen/byteorder/big_endian.h>
-
-#endif /* _ASM_POWERPC_BYTEORDER_H */
diff --git a/xen/include/asm-powerpc/cache.h b/xen/include/asm-powerpc/cache.h
deleted file mode 100644
index 48b8851bdc..0000000000
--- a/xen/include/asm-powerpc/cache.h
+++ /dev/null
@@ -1,74 +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@us.ibm.com>
- */
-
-#ifndef __ASM_CACHE_H
-#define __ASM_CACHE_H
-
-#include <xen/config.h>
-#include <asm/processor.h>
-
-/* L1 cache line size */
-#define L1_CACHE_SHIFT (CONFIG_L1_CACHE_SHIFT)
-#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
-
-static __inline__ void dcbst(ulong line)
-{
- __asm__ __volatile__ ("dcbst 0, %0" : : "r"(line) : "memory");
-}
-
-static __inline__ void icbi(ulong line)
-{
- __asm__ __volatile__ ("icbi 0, %0" : : "r"(line) : "memory");
-}
-
-static __inline__ void synchronize_caches(ulong start, size_t len)
-{
- ulong addr;
-
- for (addr = start; addr < start + len; addr += L1_CACHE_BYTES) {
- dcbst(addr);
- }
-
- /* allow dcbsts to complete */
- sync();
-
- for (addr = start; addr < start + len; addr += L1_CACHE_BYTES) {
- icbi(addr);
- }
-
- /* discard instructions partially decoded from old icache contents */
- isync();
-}
-
-#define __read_mostly
-
-struct cpu_caches {
- u32 dsize; /* L1 d-cache size */
- u32 dline_size; /* L1 d-cache line size */
- u32 log_dline_size;
- u32 dlines_per_page;
- u32 isize; /* L1 i-cache size */
- u32 iline_size; /* L1 i-cache line size */
- u32 log_iline_size;
- u32 ilines_per_page;
-};
-extern struct cpu_caches cpu_caches;
-extern void cpu_flush_icache(void);
-#endif
diff --git a/xen/include/asm-powerpc/config.h b/xen/include/asm-powerpc/config.h
deleted file mode 100644
index 02702b1489..0000000000
--- a/xen/include/asm-powerpc/config.h
+++ /dev/null
@@ -1,85 +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@us.ibm.com>
- */
-
-#ifndef __PPC_CONFIG_H__
-#define __PPC_CONFIG_H__
-
-#define CONFIG_SYSTEMSIM 1
-#define HYPERVISOR_VIRT_START 0x0 /* XXX temp hack for common/kernel.c */
-
-
-#ifdef __ASSEMBLY__
-/* older assemblers do not like UL */
-#define U(x) (x)
-#define UL(x) (x)
-
-#else /* __ASSEMBLY__ */
-
-#define U(x) (x ## U)
-#define UL(x) (x ## UL)
-extern char __bss_start[];
-#endif
-
-/* align addr on a size boundary - adjust address up/down if needed */
-#define ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1)))
-#define ALIGN_DOWN(addr,size) ((addr)&(~((size)-1)))
-
-/* 256M - 64M of Xen space seems like a nice number */
-#define CONFIG_MIN_DOM0_PAGES (192 << (20 - PAGE_SHIFT))
-#define CONFIG_SHADOW 1
-#define CONFIG_GDB 1
-#define CONFIG_SMP 1
-#define CONFIG_PCI 1
-#define CONFIG_NUMA 1
-#define CONFIG_CMDLINE_SIZE 512
-#define NR_CPUS 16
-
-#ifndef ELFSIZE
-#define ELFSIZE 64
-#endif
-
-#define asmlinkage
-
-#define NO_UART_CONFIG_OK
-#define OPT_CONSOLE_STR "com1"
-
-#define __user
-
-#define LINEAR_PT_VIRT_START (0xdeadbeefUL)
-#define XENHEAP_DEFAULT_MB (16)
-
-#define NR_hypercalls 64
-
-#define supervisor_mode_kernel (0)
-
-#define CONFIG_DMA_BITSIZE 64
-
-#include <asm/powerpc64/config.h>
-
-/*
- * Disallow grant table growing tempralily because pfn2mfn() and
- * mfn_to_gmfn() depends on the fact that grant table is machine-address
- * contiguous. Grant table growing breaks the assumption.
- */
-#ifndef max_nr_grant_frames
-#define max_nr_grant_frames INITIAL_NR_GRANT_FRAMES
-#endif
-
-#endif
diff --git a/xen/include/asm-powerpc/current.h b/xen/include/asm-powerpc/current.h
deleted file mode 100644
index e77c886b6b..0000000000
--- a/xen/include/asm-powerpc/current.h
+++ /dev/null
@@ -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) IBM Corp. 2005, 2006
- *
- * Authors: Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#ifndef _ASM_CURRENT_H_
-#define _ASM_CURRENT_H_
-
-#include <public/xen.h>
-#include <asm/processor.h>
-#include <asm/powerpc64/procarea.h>
-
-struct vcpu;
-
-extern volatile struct processor_area * volatile global_cpu_table[];
-register volatile struct processor_area *parea asm("r13");
-static inline struct vcpu *get_current(void)
-{
- return parea->cur_vcpu;
-}
-#define current get_current()
-
-static inline void set_current(struct vcpu *v)
-{
- parea->cur_vcpu = v;
-}
-
-/* The *currently running* guest's register state has been saved at the top of
- * this processor's hypervisor stack. */
-static inline struct cpu_user_regs *guest_cpu_user_regs(void)
-{
- ulong stack_top = (ulong)parea->hyp_stack_base;
-
- return (struct cpu_user_regs *)(stack_top - STACK_VOLATILE_AREA
- - sizeof (struct cpu_user_regs));
-}
-
-/* XXX *#%(ing circular header dependencies force this to be a macro */
-/* If the vcpu is running, its state is still on the stack, and the vcpu
- * structure's copy is obsolete. If the vcpu isn't running, the vcpu structure
- * holds the only copy. This routine always does the right thing. */
-#define vcpu_regs(v) ({ \
- struct cpu_user_regs *regs; \
- if (v == current) \
- regs = guest_cpu_user_regs(); \
- else \
- regs = &v->arch.ctxt; \
- regs; \
-})
-
-
-static inline void reset_stack_and_jump(void (*f)(void))
-{
- void _reset_stack_and_jump(void (*)(void), struct cpu_user_regs *);
- struct cpu_user_regs *regs = guest_cpu_user_regs();
-
-#ifdef TRACK_RESUME
- printk("PC: 0x%lx, MSR: 0x%lx\n", regs->pc, regs->msr);
-#endif
-
- _reset_stack_and_jump(f, regs);
-}
-
-#endif
diff --git a/xen/include/asm-powerpc/debugger.h b/xen/include/asm-powerpc/debugger.h
deleted file mode 100644
index 8a979d0e11..0000000000
--- a/xen/include/asm-powerpc/debugger.h
+++ /dev/null
@@ -1,97 +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@us.ibm.com>
- * Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#ifndef _ASM_DEBUGGER_H_
-#define _ASM_DEBUGGER_H_
-
-#include <public/xen.h>
-
-extern void show_backtrace_regs(struct cpu_user_regs *);
-extern void show_backtrace(ulong sp, ulong lr, ulong pc);
-
-static inline void show_execution_state(struct cpu_user_regs *regs)
-{
- show_registers(regs);
-}
-
-extern void dump_execution_state(void);
-
-static inline void dump_all_execution_state(void)
-{
- ulong sp;
- ulong lr;
-
- dump_execution_state();
- sp = (ulong)__builtin_frame_address(0);
- lr = (ulong)__builtin_return_address(0);
-
- show_backtrace(sp, lr, lr);
-}
-
-static inline void __force_crash(void)
-{
- dump_all_execution_state();
- __builtin_trap();
-}
-
-static inline void debugger_trap_immediate(void)
-{
- dump_all_execution_state();
-#ifdef CRASH_DEBUG
- __builtin_trap();
-#endif
-}
-
-static inline void unimplemented(void)
-{
-#ifdef VERBOSE
- dump_all_execution_state();
-#endif
-}
-
-extern void __attn(void);
-#define ATTN() __attn();
-
-#define FORCE_CRASH() __force_crash()
-
-#ifdef CRASH_DEBUG
-
-#include <xen/gdbstub.h>
-
-static inline int debugger_trap_fatal(
- unsigned int vector, struct cpu_user_regs *regs)
-{
- (void)__trap_to_gdb(regs, vector);
- return vector;
-}
-
-#else /* CRASH_DEBUG */
-
-static inline int debugger_trap_fatal(
- unsigned int vector, struct cpu_user_regs *regs)
-{
- show_backtrace(regs->gprs[1], regs->lr, regs->pc);
- return vector;
-}
-
-#endif /* CRASH_DEBUG */
-
-#endif
diff --git a/xen/include/asm-powerpc/delay.h b/xen/include/asm-powerpc/delay.h
deleted file mode 100644
index ea10a12bc3..0000000000
--- a/xen/include/asm-powerpc/delay.h
+++ /dev/null
@@ -1,40 +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@us.ibm.com>
- * Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#ifndef _ASM_DELAY_H_
-#define _ASM_DELAY_H_
-
-#include <asm/time.h>
-
-extern unsigned long ticks_per_usec;
-#define __udelay udelay
-static inline void udelay(unsigned long usecs)
-{
- unsigned long ticks = usecs * ticks_per_usec;
- unsigned long s;
- unsigned long e;
-
- s = get_timebase();
- do {
- e = get_timebase();
- } while ((e-s) < ticks);
-}
-#endif
diff --git a/xen/include/asm-powerpc/desc.h b/xen/include/asm-powerpc/desc.h
deleted file mode 100644
index 600fb56268..0000000000
--- a/xen/include/asm-powerpc/desc.h
+++ /dev/null
@@ -1,25 +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@us.ibm.com>
- */
-
-#ifndef _ASM_DESC_H_
-#define _ASM_DESC_H_
-
-
-#endif
diff --git a/xen/include/asm-powerpc/div64.h b/xen/include/asm-powerpc/div64.h
deleted file mode 100644
index 12bc392b28..0000000000
--- a/xen/include/asm-powerpc/div64.h
+++ /dev/null
@@ -1,33 +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: Maria Butrico <butrico@us.ibm.com>
- */
-
-#ifndef _DIV64_H_
-#define _DIV64_H_
-
-#include <xen/types.h>
-
-#define do_div(num,base) ({ \
- uint32_t _remainder = (uint64_t)(num) % \
- (uint32_t)(base); \
- num = (uint64_t)(num) / (uint32_t)(base); \
- _remainder; \
-})
-
-#endif /* #ifndef _DIV64_H_ */
diff --git a/xen/include/asm-powerpc/domain.h b/xen/include/asm-powerpc/domain.h
deleted file mode 100644
index 31021e25bb..0000000000
--- a/xen/include/asm-powerpc/domain.h
+++ /dev/null
@@ -1,123 +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@us.ibm.com>
- * Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
- */
-
-#ifndef _ASM_DOMAIN_H_
-#define _ASM_DOMAIN_H_
-
-#include <xen/cache.h>
-#include <xen/sched.h>
-#include <xen/list.h>
-#include <xen/errno.h>
-#include <xen/mm.h>
-#include <public/arch-powerpc.h>
-#include <asm/htab.h>
-#include <asm/powerpc64/ppc970.h>
-
-
-typedef struct {
- ulong mmcr0;
- ulong mmcr1;
- ulong mmcra;
- ulong pmc[NUM_PMCS];
-} perf_sprs_t;
-
-extern atomic_t perf_count_active;
-extern perf_sprs_t perf_clear_sprs;
-
-struct arch_domain {
- struct domain_htab htab;
-
- /* The Real Mode area is fixed to the domain and is accessible while the
- * processor is in real mode */
- struct page_info *rma_page;
- uint rma_order;
-
- uint foreign_mfn_count;
- uint *foreign_mfns;
-
- u32 *p2m; /* Array of 32-bit MFNs supports 44 bits of physical memory. */
- ulong p2m_entries;
-
- uint large_page_sizes;
- uint large_page_order[4];
-} __cacheline_aligned;
-
-struct slb_entry {
- ulong slb_vsid;
- ulong slb_esid;
-};
-#define SLB_ESID_VALID (1ULL << (63 - 36))
-#define SLB_ESID_CLASS (1ULL << (63 - 56))
-#define SLB_ESID_MASK (~0ULL << (63 - 35))
-#define SLBIE_CLASS_LOG (63-36)
-#define SLBMTE_ENTRY_MASK ((0x1UL << (63 - 52 + 1)) - 1)
-
-struct xencomm;
-
-typedef struct {
- u32 u[4];
-} __attribute__((aligned(16))) vector128;
-
-struct arch_vcpu {
- cpu_user_regs_t ctxt; /* User-level CPU registers */
-
-#ifdef HAS_FLOAT
- double fprs[NUM_FPRS];
-#endif
-#ifdef HAS_VMX
- vector128 vrs[32];
- vector128 vscr;
- u32 vrsave;
-#endif
-
- /* Special-Purpose Registers */
- ulong sprg[4];
- ulong timebase;
- ulong dar;
- ulong dsisr;
-
- /* performance monitor sprs per vcpu */
- int pmu_enabled;
- int perf_sprs_stored;
- perf_sprs_t perf_sprs;
-
- /* Segment Lookaside Buffer */
- struct slb_entry slb_entries[NUM_SLB_ENTRIES];
-
- u32 dec;
- struct cpu_vcpu cpu; /* CPU-specific bits */
- struct xencomm *xencomm;
-} __cacheline_aligned;
-
-extern void full_resume(void);
-
-extern void save_sprs(struct vcpu *);
-extern void load_sprs(struct vcpu *);
-extern void save_pmc_sprs(perf_sprs_t *p_sprs);
-extern void load_pmc_sprs(perf_sprs_t *p_sprs);
-extern void save_segments(struct vcpu *);
-extern void load_segments(struct vcpu *);
-extern void save_float(struct vcpu *);
-extern void load_float(struct vcpu *);
-
-#define rma_size(rma_order) (1UL << ((rma_order) + PAGE_SHIFT))
-
-#endif
diff --git a/xen/include/asm-powerpc/elf.h b/xen/include/asm-powerpc/elf.h
deleted file mode 100644
index 3877c0f5fa..0000000000
--- a/xen/include/asm-powerpc/elf.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef _ASM_ELF_H__
-#define _ASM_ELF_H__
-
-#include <xen/lib.h> /* for printk() used in stub */
-
-typedef struct {
- unsigned long dummy;
-} ELF_Gregset;
-
-typedef struct {
- unsigned long dummy;
-} crash_xen_core_t;
-
-static inline void elf_core_save_regs(ELF_Gregset *core_regs,
- crash_xen_core_t *xen_core_regs)
-{
- printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
-}
-
-#endif /* _ASM_ELF_H__ */
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/include/asm-powerpc/event.h b/xen/include/asm-powerpc/event.h
deleted file mode 100644
index 5c6d287b3c..0000000000
--- a/xen/include/asm-powerpc/event.h
+++ /dev/null
@@ -1,99 +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@us.ibm.com>
- */
-
-#ifndef __ASM_EVENT_H__
-#define __ASM_EVENT_H__
-
-#include <asm/current.h>
-
-/* copied from x86 evtchn_notify() */
-static inline void evtchn_notify(struct vcpu *v)
-{
-#ifdef XXX_NO_SMP_YET
- int running = v->is_running;
- vcpu_unblock(v);
- if (running)
- smp_send_event_check_cpu(v->processor);
-#else
- vcpu_unblock(v);
-#endif
-}
-
-static inline int local_event_delivery_is_enabled(void)
-{
- return !!(vcpu_regs(current)->msr & MSR_EE);
-}
-
-static inline void local_event_delivery_disable(void)
-{
- vcpu_regs(current)->msr &= ~MSR_EE;
-}
-
-static inline void local_event_delivery_enable(void)
-{
- vcpu_regs(current)->msr |= MSR_EE;
-}
-
-static inline int local_events_need_delivery(void)
-{
- struct vcpu *v = current;
- /* Note: Bitwise operations result in fast code with no branches. */
- return (!!v->vcpu_info->evtchn_upcall_pending &
- local_event_delivery_is_enabled());
-}
-
-/* No arch specific virq definition now. Default to global. */
-static inline int arch_virq_is_global(int virq)
-{
- return 1;
-}
-
-static inline void vcpu_kick(struct vcpu *v)
-{
- /*
- * NB1. 'pause_flags' and 'processor' must be checked /after/ update of
- * pending flag. These values may fluctuate (after all, we hold no
- * locks) but the key insight is that each change will cause
- * evtchn_upcall_pending to be polled.
- *
- * NB2. We save the running flag across the unblock to avoid a needless
- * IPI for domains that we IPI'd to unblock.
- */
- int running = v->is_running;
- vcpu_unblock(v);
- if (running)
- smp_send_event_check_cpu(v->processor);
-}
-
-/* HACK: evtchn_upcall_pending is only a byte, but our atomic instructions
- * only store in 4/8 byte quantities. However, because evtchn_upcall_pending
- * is part of the guest ABI, we can't change its size without breaking
- * backwards compatibility. In this particular case, struct vcpu_info is big
- * enough that we can safely store a full long into it. However, note that bit
- * 0 of evtchn_upcall_pending is bit 56 when cast to a long.
- */
-static inline void vcpu_mark_events_pending(struct vcpu *v)
-{
- unsigned long *l = (unsigned long *)&v->vcpu_info->evtchn_upcall_pending;
- if (!test_and_set_bit(BITS_PER_LONG - 8, l))
- vcpu_kick(v);
-}
-
-#endif
diff --git a/xen/include/asm-powerpc/flushtlb.h b/xen/include/asm-powerpc/flushtlb.h
deleted file mode 100644
index 222dc08d91..0000000000
--- a/xen/include/asm-powerpc/flushtlb.h
+++ /dev/null
@@ -1,105 +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@us.ibm.com>
- */
-
-#ifndef _ASM_FLUSHTLB_H_
-#define _ASM_FLUSHTLB_H_
-
-#include <xen/config.h>
-#include <xen/percpu.h>
-#include <xen/types.h>
-
-/* The current time as shown by the virtual TLB clock. */
-extern u32 tlbflush_clock;
-#define tlbflush_current_time() tlbflush_clock
-
-/* Time at which each CPU's TLB was last flushed. */
-DECLARE_PER_CPU(u32, tlbflush_time);
-
-static inline int NEED_FLUSH(u32 cpu_stamp, u32 lastuse_stamp)
-{
- return 0;
-}
-
-/*
- * Filter the given set of CPUs, removing those that definitely flushed their
- * TLB since @page_timestamp.
- */
-#define tlbflush_filter(mask, page_timestamp) \
-do { \
- unsigned int cpu; \
- for_each_cpu_mask ( cpu, mask ) \
- if ( !NEED_FLUSH(per_cpu(tlbflush_time, cpu), page_timestamp) ) \
- cpu_clear(cpu, mask); \
-} while ( 0 )
-
-
-static inline void tlbiel(unsigned long eaddr)
-{
-#if 0
- asm volatile("tlbiel %0" : : "r"(eaddr) : "memory");
-#else
- asm volatile(".long 0x7c000224 | (%0 << 11)" : : "r"(eaddr) : "memory");
-#endif
-}
-
-/* Lots of paranoia in flush_tlb_*; could probably be relaxed later. */
-static inline void local_flush_tlb_one(unsigned long eaddr)
-{
- asm volatile("ptesync" : : : "memory");
- tlbiel(eaddr);
- asm volatile("eieio; tlbsync" : : : "memory");
-}
-
-static inline void local_flush_tlb(void)
-{
- ulong rb;
- int i;
-
- asm volatile("ptesync" : : : "memory");
-
- for (i = 0; i < 256; i++) {
- rb = i;
- rb <<= 12;
- tlbiel(rb);
- }
- asm volatile("eieio": : : "memory");
-}
-
-#ifndef CONFIG_SMP
-#define flush_tlb_mask(_mask) local_flush_tlb()
-#define flush_tlb_one_mask(_mask,_addr) local_flush_tlb_one(_addr)
-#else
-extern void __flush_tlb_mask(cpumask_t mask, unsigned long addr);
-
-#define FLUSH_ALL_ADDRS (~0UL)
-#define flush_tlb_mask(_mask) __flush_tlb_mask(_mask,FLUSH_ALL_ADDRS)
-#define flush_tlb_one_mask(_mask,_addr) __flush_tlb_mask(_mask,_addr)
-#endif /* CONFIG_SMP */
-
-/*
- * Filter the given set of CPUs, returning only those that may not have
- * flushed their TLBs since @page_timestamp.
- */
-static inline unsigned long tlbflush_filter_cpuset(
- unsigned long cpuset, u32 page_timestamp)
-{
- return 0;
-}
-#endif
diff --git a/xen/include/asm-powerpc/grant_table.h b/xen/include/asm-powerpc/grant_table.h
deleted file mode 100644
index 06224a1754..0000000000
--- a/xen/include/asm-powerpc/grant_table.h
+++ /dev/null
@@ -1,92 +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@watson.ibm.com>
- */
-
-#ifndef __ASM_PPC_GRANT_TABLE_H__
-#define __ASM_PPC_GRANT_TABLE_H__
-
-#include <asm/mm.h>
-
-#define INITIAL_NR_GRANT_FRAMES 4
-
-/*
- * Caller must own caller's BIGLOCK, is responsible for flushing the TLB, and
- * must hold a reference to the page.
- */
-extern long pte_enter(ulong flags, ulong ptex, ulong vsid, ulong rpn);
-extern long pte_remove(ulong flags, ulong ptex, ulong avpn,
- ulong *hi, ulong *lo);
-
-int create_grant_host_mapping(unsigned long addr, unsigned long frame,
- unsigned int flags, unsigned int cache_flags);
-int replace_grant_host_mapping(
- unsigned long addr, unsigned long frame, unsigned long new_addr,
- unsigned int flags);
-
-#define gnttab_create_shared_page(d, t, i) \
- do { \
- share_xen_page_with_guest( \
- virt_to_page((t)->shared[(i)]), \
- (d), XENSHARE_writable); \
- } while ( 0 )
-
-#define gnttab_shared_mfn(d, t, i) (virt_to_mfn((t)->shared[(i)]))
-
-#define gnttab_shared_gmfn(d, t, i) \
- (mfn_to_gmfn(d, gnttab_shared_mfn(d, t, i)))
-
-static inline void mark_dirty(struct domain *d, unsigned int mfn)
-{
- return;
-}
-#define gnttab_mark_dirty(d, f) mark_dirty((d), (f))
-#define gnttab_log_dirty(d, f) mark_dirty((d), (f))
-
-static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
-{
- unsigned long *laddr;
- unsigned long lnr;
-
- BUG_ON((ulong)addr % sizeof(ulong));
-
- lnr = (BITS_PER_LONG - (sizeof(*addr) * 8)) + nr;
- laddr = (unsigned long *)addr;
- clear_bit(lnr, laddr);
-}
-
-static inline uint cpu_foreign_map_order(void)
-{
- /* 16 GiB */
- return 34 - PAGE_SHIFT;
-}
-
-#define gnttab_host_mapping_get_page_type(op, ld, rd) \
- (!((op)->flags & GNTMAP_readonly))
-
-/*
- * without put_page()/put_page_and_type() page might be leaked.
- * with put_page()/put_page_and_type() freed page might be accessed.
- */
-#define gnttab_release_host_mappings 0
-
-static inline int replace_grant_supported(void)
-{
- return 0;
-}
-#endif /* __ASM_PPC_GRANT_TABLE_H__ */
diff --git a/xen/include/asm-powerpc/guest_access.h b/xen/include/asm-powerpc/guest_access.h
deleted file mode 100644
index 948d4507a1..0000000000
--- a/xen/include/asm-powerpc/guest_access.h
+++ /dev/null
@@ -1,26 +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@us.ibm.com>
- */
-
-#ifndef __PPC_GUEST_ACCESS_H__
-#define __PPC_GUEST_ACCESS_H__
-
-#include <xen/xencomm.h>
-
-#endif /* __PPC_GUEST_ACCESS_H__ */
diff --git a/xen/include/asm-powerpc/hardirq.h b/xen/include/asm-powerpc/hardirq.h
deleted file mode 100644
index eda64792f4..0000000000
--- a/xen/include/asm-powerpc/hardirq.h
+++ /dev/null
@@ -1,21 +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: Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#include "../asm-x86/hardirq.h"
diff --git a/xen/include/asm-powerpc/hcalls.h b/xen/include/asm-powerpc/hcalls.h
deleted file mode 100644
index a0a33f6bf4..0000000000
--- a/xen/include/asm-powerpc/hcalls.h
+++ /dev/null
@@ -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, 2006
- *
- * Authors: Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#ifndef _ASM_HCALLS_H_
-#define _ASM_HCALLS_H_
-
-#include <xen/config.h>
-#include <xen/types.h>
-
-/* table of standard PAPR hcalls */
-extern u32 *papr_hcalls;
-
-extern void papr_hcall_jump(struct cpu_user_regs *regs, u32 address);
-
-#define XEN_MARK(a) ((a) | (~0UL << 16))
-
-#endif
diff --git a/xen/include/asm-powerpc/htab.h b/xen/include/asm-powerpc/htab.h
deleted file mode 100644
index 12177206c4..0000000000
--- a/xen/include/asm-powerpc/htab.h
+++ /dev/null
@@ -1,136 +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@us.ibm.com>
- */
-
-#ifndef _ASM_HTAB_H_
-#define _ASM_HTAB_H_
-
-#include <xen/config.h>
-#include <xen/types.h>
-
-/***** general PowerPC architecture limits ******/
-
-/* 256KB, from PowerPC Architecture specification */
-#define HTAB_MIN_LOG_SIZE 18
-
-#define LOG_NUM_PTES_IN_PTEG 3
-#define NUM_PTES_IN_PTEG (1 << LOG_NUM_PTES_IN_PTEG)
-#define LOG_PTE_SIZE 4
-#define LOG_PTEG_SIZE (LOG_NUM_PTES_IN_PTEG + LOG_PTE_SIZE)
-#define LOG_HTAB_HASH (LOG_HTAB_SIZE - LOG_PTEG_SIZE)
-
-/* real page number shift to create the rpn field of the pte */
-#define RPN_SHIFT 12
-
-/* page protection bits in pp1 (name format: MSR:PR=0 | MSR:PR=1) */
-#define PP_RWxx 0x0UL
-#define PP_RWRW 0x2UL
-#define PP_RWRx 0x4UL
-#define PP_RxRx 0x6UL
-
-/***** 64-bit PowerPC architecture limits ******/
-
-#define SDR1_HTABORG_MASK 0xfffffffffff80000ULL
-#define SDR1_HTABSIZE_MASK 0x1fUL
-#define SDR1_HTABSIZE_MAX 46
-#define SDR1_HTABSIZE_BASEBITS 11
-
-/* used to turn a vsid into a number usable in the hash function */
-#define VSID_HASH_MASK 0x0000007fffffffffUL
-
-/* used to turn a vaddr into an api for a pte */
-#define VADDR_TO_API(vaddr) (((vaddr) & API_MASK) >> API_SHIFT)
-#define API_VEC 0x1fUL
-#define API_SHIFT 23
-#define API_MASK (API_VEC << API_SHIFT)
-
-/***** hypervisor internals ******/
-
-/* 64M: reasonable hypervisor limit? */
-#define HTAB_MAX_LOG_SIZE 26
-
-#define GET_HTAB(domain) ((domain)->arch.htab.sdr1 & SDR1_HTABORG_MASK)
-
-union pte {
- struct pte_words {
- ulong vsid;
- ulong rpn;
- } words;
- struct pte_bits {
- /* *INDENT-OFF* */
- /* high word */
- ulong avpn: 57; /* [0-56] abbreviated virtual page number */
- ulong lock: 1; /* [57] hypervisor lock bit */
- ulong res: 1; /* [58] reserved for hypervisor */
- ulong bolted: 1; /* [59] XXX software-reserved; temp hack */
- ulong sw: 1; /* [60] reserved for software */
- ulong l: 1; /* [61] Large Page */
- ulong h: 1; /* [62] hash function id */
- ulong v: 1; /* [63] valid */
-
- /* low word */
- ulong pp0: 1; /* [0] page protection bit 0 (current PowerPC
- * specification says it can always be 0) */
- ulong ts: 1; /* [1] tag select */
- ulong rpn: 50; /* [2-51] real page number */
- ulong res2: 2; /* [52,53] reserved */
- ulong ac: 1; /* [54] address compare */
- ulong r: 1; /* [55] referenced */
- ulong c: 1; /* [56] changed */
- ulong w: 1; /* [57] write through */
- ulong i: 1; /* [58] cache inhibited */
- ulong m: 1; /* [59] memory coherent */
- ulong g: 1; /* [60] guarded */
- ulong n: 1; /* [61] no-execute */
- ulong pp1: 2; /* [62,63] page protection bits 1:2 */
- /* *INDENT-ON* */
- } bits;
-};
-
-union ptel {
- ulong word;
- struct ptel_bits {
- /* *INDENT-OFF* */
-
- ulong pp0: 1; /* page protection bit 0 (current PPC
- * AS says it can always be 0) */
- ulong ts: 1; /* tag select */
- ulong rpn: 50; /* real page number */
- ulong res2: 2; /* reserved */
- ulong ac: 1; /* address compare */
- ulong r: 1; /* referenced */
- ulong c: 1; /* changed */
- ulong w: 1; /* write through */
- ulong i: 1; /* cache inhibited */
- ulong m: 1; /* memory coherent */
- ulong g: 1; /* guarded */
- ulong n: 1; /* no-execute */
- ulong pp1: 2; /* page protection bits 1:2 */
- /* *INDENT-ON* */
- } bits;
-};
-
-struct domain_htab {
- ulong sdr1;
- uint log_num_ptes; /* log number of PTEs in HTAB. */
- uint order; /* order for freeing. */
- union pte *map; /* access the htab like an array */
- ulong *shadow; /* idx -> logical translation array */
-};
-#endif
diff --git a/xen/include/asm-powerpc/hypercall.h b/xen/include/asm-powerpc/hypercall.h
deleted file mode 100644
index 90dbe39279..0000000000
--- a/xen/include/asm-powerpc/hypercall.h
+++ /dev/null
@@ -1,26 +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@us.ibm.com>
- */
-
-#ifndef __ASM_PPC_HYPERCALL_H__
-#define __ASM_PPC_HYPERCALL_H__
-
-#define arch_do_vcpu_op(cmd, vcpu, arg) (-ENOSYS)
-
-#endif /* __ASM_PPC_HYPERCALL_H__ */
diff --git a/xen/include/asm-powerpc/init.h b/xen/include/asm-powerpc/init.h
deleted file mode 100644
index fcaeaace0d..0000000000
--- a/xen/include/asm-powerpc/init.h
+++ /dev/null
@@ -1,40 +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@us.ibm.com>
- */
-
-#ifndef _XEN_ASM_INIT_H
-#define _XEN_ASM_INIT_H
-
-struct cpu_user_regs;
-typedef void (*hcall_handler_t)(struct cpu_user_regs *regs);
-
-typedef struct {
- unsigned long number;
- hcall_handler_t handler;
-} init_hcall_t;
-extern init_hcall_t __init_hcall_start, __init_hcall_end;
-
-#define __init_papr_hcall(nr, fn) \
- static init_hcall_t __init_hcall_##fn __init_hcall \
- = { .number = nr, .handler = fn }
-
-#define __init_hcall \
- __attribute_used__ __attribute__ ((__section__ (".init_hcall.init")))
-
-#endif /* _XEN_ASM_INIT_H */
diff --git a/xen/include/asm-powerpc/io.h b/xen/include/asm-powerpc/io.h
deleted file mode 100644
index d0fa182605..0000000000
--- a/xen/include/asm-powerpc/io.h
+++ /dev/null
@@ -1,69 +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@us.ibm.com>
- */
-
-#ifndef _ASM_IO_H_
-#define _ASM_IO_H_
-
-#include <xen/types.h>
-#include <asm/processor.h>
-
-#define IO_SPACE_LIMIT 0xffff
-
-extern unsigned int watchdog_on;
-extern ulong isa_io_base;
-
-#define inb(port) in_8((void *)((ulong)(port) + isa_io_base))
-#define outb(val, port) out_8((void *)((ulong)(port) + isa_io_base), val)
-#define inw(port) in_le16((void *)((ulong)(port) + isa_io_base))
-#define outw(val, port) out_le16((void *)((ulong)(port) + isa_io_base), val)
-#define inl(port) in_le32((void *)((ulong)(port) + isa_io_base))
-#define outl(val, port) out_le32((void *)((ulong)(port) + isa_io_base), val)
-
-#define ioremap(x,l) (void __iomem *)(x)
-#define readb(port) in_8((void *)(port))
-#define writeb(val, port) out_8((void *)(port), val)
-
-extern char *vgabase;
-#define vga_writeb(val, port) out_8((void *)((ulong)(port) + vgabase), val)
-
-extern u8 in_8(const volatile u8 *addr);
-extern void out_8(volatile u8 *addr, int val);
-extern u32 in_32(const volatile u32 *addr);
-extern void out_32(volatile u32 *addr, int val);
-extern int in_le16(const volatile unsigned short *addr);
-extern void out_le16(volatile unsigned short *addr, int val);
-extern unsigned in_le32(const volatile unsigned *addr);
-extern void out_le32(volatile unsigned *addr, int val);
-
-#define in_be8 in_8
-#define in_be16 in_16
-#define in_be32 in_32
-#define out_be8 out_8
-#define out_be16 out_16
-#define out_be32 out_32
-
-#define readw(port) in_le16((void *)(port))
-#define readl(port) in_le32((void *)(port))
-#define writew(val, port) out_le16((void *)(port), val)
-#define writel(val, port) out_le32((void *)(port), val)
-
-#define barrier() __asm__ __volatile__("": : :"memory")
-
-#endif
diff --git a/xen/include/asm-powerpc/iocap.h b/xen/include/asm-powerpc/iocap.h
deleted file mode 100644
index da9a433c47..0000000000
--- a/xen/include/asm-powerpc/iocap.h
+++ /dev/null
@@ -1,26 +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@us.ibm.com>
- */
-
-#ifndef _PPC_IOCAP_H
-#define _PPC_IOCAP_H
-
-/* All PowerPC IO is MMIO. */
-
-#endif /* _PPC_IOCAP_H */
diff --git a/xen/include/asm-powerpc/irq.h b/xen/include/asm-powerpc/irq.h
deleted file mode 100644
index 9b90ac1cb1..0000000000
--- a/xen/include/asm-powerpc/irq.h
+++ /dev/null
@@ -1,31 +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: Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#ifndef _ASM_PPC_HW_IRQ_H
-#define _ASM_PPC_HW_IRQ_H
-#include "../asm-x86/irq.h"
-
-#undef vector_to_irq
-#define vector_to_irq(vec) (vec)
-#undef irq_to_vector
-#define irq_to_vector(irq) (irq)
-
-extern int assign_irq_vector (int irq);
-#endif
diff --git a/xen/include/asm-powerpc/mach-default/irq_vectors.h b/xen/include/asm-powerpc/mach-default/irq_vectors.h
deleted file mode 100644
index 679e928d19..0000000000
--- a/xen/include/asm-powerpc/mach-default/irq_vectors.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* from xen/include/asm-x86/mach-default/irq_vectors.h */
-
-/*
- * This file should contain #defines for all of the interrupt vector
- * numbers used by this architecture.
- *
- * In addition, there are some standard defines:
- *
- * FIRST_EXTERNAL_VECTOR:
- * The first free place for external interrupts
- *
- * SYSCALL_VECTOR:
- * The IRQ vector a syscall makes the user to kernel transition
- * under.
- *
- * TIMER_IRQ:
- * The IRQ number the timer interrupt comes in at.
- *
- * NR_IRQS:
- * The total number of interrupt vectors (including all the
- * architecture specific interrupts) needed.
- *
- */
-#ifndef _ASM_IRQ_VECTORS_H
-#define _ASM_IRQ_VECTORS_H
-
-/*
- * IDT vectors usable for external interrupt sources start
- * at 0x0:
- */
-#define FIRST_EXTERNAL_VECTOR 0x0
-#define FIRST_DEVICE_VECTOR 0
-#define NR_IRQS 256
-#define NR_VECTORS NR_IRQS
-#define NR_IRQ_VECTORS NR_IRQS
-#define HYPERCALL_VECTOR -1
-#define FAST_TRAP -1 /* 0x80 */
-#define FIRST_SYSTEM_VECTOR -1
-
-#define CALL_FUNCTION_VECTOR 0x0
-#define EVENT_CHECK_VECTOR 0x1
-
-#if 0
-
-#define THERMAL_APIC_VECTOR 0xf0
-/*
- * Local APIC timer IRQ vector is on a different priority level,
- * to work around the 'lost local interrupt if more than 2 IRQ
- * sources per level' errata.
- */
-#define LOCAL_TIMER_VECTOR 0xef
-
-/*
- * First APIC vector available to drivers: (vectors 0x30-0xee)
- * we start at 0x31 to spread out vectors evenly between priority
- * levels. (0x80 is the syscall vector)
- */
-#define FIRST_DEVICE_VECTOR 0x31
-#define FIRST_SYSTEM_VECTOR 0xef
-
-#define TIMER_IRQ 0
-
-/*
- * 16 8259A IRQ's, 208 potential APIC interrupt sources.
- * Right now the APIC is mostly only used for SMP.
- * 256 vectors is an architectural limit. (we can have
- * more than 256 devices theoretically, but they will
- * have to use shared interrupts)
- * Since vectors 0x00-0x1f are used/reserved for the CPU,
- * the usable vector space is 0x20-0xff (224 vectors)
- */
-
-/*
- * The maximum number of vectors supported by i386 processors
- * is limited to 256. For processors other than i386, NR_VECTORS
- * should be changed accordingly.
- */
-#define NR_VECTORS 256
-
-#include "irq_vectors_limits.h"
-
-#define FPU_IRQ 13
-
-#define FIRST_VM86_IRQ 3
-#define LAST_VM86_IRQ 15
-#define invalid_vm86_irq(irq) ((irq) < 3 || (irq) > 15)
-
-#endif // 0
-#endif /* _ASM_IRQ_VECTORS_H */
diff --git a/xen/include/asm-powerpc/memory.h b/xen/include/asm-powerpc/memory.h
deleted file mode 100644
index 369a627201..0000000000
--- a/xen/include/asm-powerpc/memory.h
+++ /dev/null
@@ -1,39 +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@watson.ibm.com>
- */
-
-#ifndef _ASM_MEMORY_H_
-#define _ASM_MEMORY_H_
-
-#include <xen/config.h>
-
-/*
- * Arguably the bitops and *xchg operations don't imply any memory barrier
- * or SMP ordering, but in fact a lot of drivers expect them to imply
- * both, since they do on x86 cpus.
- */
-#ifdef CONFIG_SMP
-#define EIEIO_ON_SMP "eieio\n"
-#define ISYNC_ON_SMP "\n\tisync"
-#else
-#define EIEIO_ON_SMP
-#define ISYNC_ON_SMP
-#endif
-
-#endif
diff --git a/xen/include/asm-powerpc/mm.h b/xen/include/asm-powerpc/mm.h
deleted file mode 100644
index eb776e744e..0000000000
--- a/xen/include/asm-powerpc/mm.h
+++ /dev/null
@@ -1,286 +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@us.ibm.com>
- * Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#ifndef _ASM_MM_H_
-#define _ASM_MM_H_
-
-#include <public/xen.h>
-#include <xen/list.h>
-#include <xen/types.h>
-#include <xen/mm.h>
-#include <asm/system.h>
-#include <asm/flushtlb.h>
-#include <asm/page.h>
-#include <asm/debugger.h>
-
-#define memguard_guard_range(_p,_l) ((void)0)
-#define memguard_unguard_range(_p,_l) ((void)0)
-
-extern unsigned long xenheap_phys_end;
-
-/*
- * Per-page-frame information.
- *
- * Every architecture must ensure the following:
- * 1. 'struct page_info' contains a 'struct list_head list'.
- * 2. Provide a PFN_ORDER() macro for accessing the order of a free page.
- */
-#define PFN_ORDER(_pfn) ((_pfn)->u.free.order)
-
-/* XXX copy-and-paste job; re-examine me */
-struct page_info
-{
- /* Each frame can be threaded onto a doubly-linked list. */
- struct list_head list;
-
- /* Timestamp from 'TLB clock', used to reduce need for safety flushes. */
- u32 tlbflush_timestamp;
-
- /* Reference count and various PGC_xxx flags and fields. */
- unsigned long count_info;
-
- /* Context-dependent fields follow... */
- union {
-
- /* Page is in use: ((count_info & PGC_count_mask) != 0). */
- struct {
- /* Owner of this page (NULL if page is anonymous). */
- u32 _domain;
- /* Type reference count and various PGT_xxx flags and fields. */
- unsigned long type_info;
- } inuse;
-
- /* Page is on a free list: ((count_info & PGC_count_mask) == 0). */
- struct {
- /* Mask of possibly-tainted TLBs. */
- cpumask_t cpumask;
- /* Order-size of the free chunk this page is the head of. */
- u8 order;
- } free;
-
- } u;
-
-};
-
- /* The following page types are MUTUALLY EXCLUSIVE. */
-#define PGT_none (0UL<<29) /* no special uses of this page */
-#define PGT_RMA (1UL<<29) /* This page is an RMA page? */
-#define PGT_writable_page (7UL<<29) /* has writable mappings of this page? */
-#define PGT_type_mask (7UL<<29) /* Bits 29-31. */
-
- /* Owning guest has pinned this page to its current type? */
-#define _PGT_pinned 28
-#define PGT_pinned (1UL<<_PGT_pinned)
- /* Has this page been validated for use as its current type? */
-#define _PGT_validated 27
-#define PGT_validated (1UL<<_PGT_validated)
-
- /* 16-bit count of uses of this frame as its current type. */
-#define PGT_count_mask ((1UL<<16)-1)
-
- /* Cleared when the owning guest 'frees' this page. */
-#define _PGC_allocated 31
-#define PGC_allocated (1UL<<_PGC_allocated)
- /* Set on a *guest* page to mark it out-of-sync with its shadow */
-#define _PGC_out_of_sync 30
-#define PGC_out_of_sync (1UL<<_PGC_out_of_sync)
- /* Set when is using a page as a page table */
-#define _PGC_page_table 29
-#define PGC_page_table (1UL<<_PGC_page_table)
-/* Set when using page for RMA */
-#define _PGC_page_RMA 28
-#define PGC_page_RMA (1UL<<_PGC_page_RMA)
- /* 29-bit count of references to this frame. */
-#define PGC_count_mask ((1UL<<28)-1)
-
-#define is_xen_heap_mfn(mfn) ((mfn) < paddr_to_pfn(xenheap_phys_end))
-#define is_xen_heap_page(page) (page_to_maddr(page) < xenheap_phys_end)
-
-static inline struct domain *unpickle_domptr(u32 _domain)
-{ return ((_domain == 0) || (_domain & 1)) ? NULL : __va(_domain); }
-
-static inline u32 pickle_domptr(struct domain *domain)
-{ return (domain == NULL) ? 0 : (u32)__pa(domain); }
-
-#define PRtype_info "016lx"/* should only be used for printk's */
-
-#define page_get_owner(_p) (unpickle_domptr((_p)->u.inuse._domain))
-#define page_set_owner(_p,_d) ((_p)->u.inuse._domain = pickle_domptr(_d))
-
-#define XENSHARE_writable 0
-#define XENSHARE_readonly 1
-extern void share_xen_page_with_guest(
- struct page_info *page, struct domain *d, int readonly);
-extern void share_xen_page_with_privileged_guests(
- struct page_info *page, int readonly);
-
-extern struct page_info *frame_table;
-extern unsigned long max_page;
-extern unsigned long total_pages;
-void init_frametable(void);
-void init_machine_to_phys_table(void);
-void free_rma_check(struct page_info *page);
-
-static inline void put_page(struct page_info *page)
-{
- u32 nx, x, y = page->count_info;
-
- do {
- x = y;
- nx = x - 1;
- }
- while ( unlikely((y = cmpxchg(&page->count_info, x, nx)) != x) );
-
- if ( unlikely((nx & PGC_count_mask) == 0) ) {
- /* RMA pages can only be released while the domain is dying */
- free_rma_check(page);
- free_domheap_page(page);
- }
-}
-
-static inline int get_page(struct page_info *page,
- struct domain *domain)
-{
- u32 x, nx, y = page->count_info;
- u32 d, nd = page->u.inuse._domain;
- u32 _domain = pickle_domptr(domain);
-
- do {
- x = y;
- nx = x + 1;
- d = nd;
- if ( unlikely((x & PGC_count_mask) == 0) || /* Not allocated? */
- unlikely((nx & PGC_count_mask) == 0) || /* Count overflow? */
- unlikely(d != _domain) ) /* Wrong owner? */
- {
- return 0;
- }
- y = cmpxchg(&page->count_info, x, nx);
- }
- while ( unlikely(y != x) );
-
- return 1;
-}
-
-extern void put_page_type(struct page_info *page);
-extern int get_page_type(struct page_info *page, unsigned long type);
-
-static inline void put_page_and_type(struct page_info *page)
-{
- put_page_type(page);
- put_page(page);
-}
-
-static inline int get_page_and_type(struct page_info *page,
- struct domain *domain,
- unsigned long type)
-{
- int rc = get_page(page, domain);
-
- if ( likely(rc) && unlikely(!get_page_type(page, type)) )
- {
- put_page(page);
- rc = 0;
- }
-
- return rc;
-}
-
-extern void synchronise_pagetables(unsigned long cpu_mask);
-
-/* XXX don't know what this is for */
-typedef struct {
- void (*enable)(struct domain *);
- void (*disable)(struct domain *);
-} vm_assist_info_t;
-extern vm_assist_info_t vm_assist_info[];
-
-extern unsigned long *machine_phys_mapping;
-#define machine_to_phys_mapping (machine_phys_mapping)
-#define INVALID_M2P_ENTRY (~0UL)
-
-#define set_gpfn_from_mfn(mfn, pfn) (machine_to_phys_mapping[(mfn)] = (pfn))
-#define get_gpfn_from_mfn(mfn) (machine_to_phys_mapping[(mfn)])
-
-extern unsigned long mfn_to_gmfn(struct domain *d, unsigned long mfn);
-
-extern unsigned long paddr_to_maddr(unsigned long paddr);
-
-/* INVALID_MFN can be any value that fails mfn_valid(). */
-#define INVALID_MFN (~0U)
-
-#define PFN_TYPE_NONE 0
-#define PFN_TYPE_LOGICAL 2
-#define PFN_TYPE_IO 3
-#define PFN_TYPE_FOREIGN 4
-#define PFN_TYPE_GNTTAB 5
-
-extern ulong pfn2mfn(struct domain *d, ulong pfn, int *type);
-static inline unsigned long gmfn_to_mfn(struct domain *d, unsigned long gmfn)
-{
- int mtype;
- ulong mfn;
-
- mfn = pfn2mfn(d, gmfn, &mtype);
- if (mfn != INVALID_MFN) {
- switch (mtype) {
- case PFN_TYPE_LOGICAL:
- break;
- default:
- WARN();
- mfn = INVALID_MFN;
- break;
- }
- }
- return mfn;
-}
-
-extern int update_grant_va_mapping(unsigned long va,
- unsigned long val,
- struct domain *,
- struct vcpu *);
-
-/* Arch-specific portion of memory_op hypercall. */
-long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg);
-
-extern int allocate_rma(struct domain *d, unsigned int order_pages);
-extern uint allocate_extents(struct domain *d, uint nrpages, uint rma_nrpages);
-
-extern int steal_page(struct domain *d, struct page_info *page,
- unsigned int memflags);
-
-/* XXX these just exist until we can stop #including x86 code */
-#define access_ok(addr,size) 1
-#define array_access_ok(addr,count,size) 1
-
-#define domain_clamp_alloc_bitsize(d, b) (b)
-
-#define domain_get_maximum_gpfn(d) (-ENOSYS)
-
-extern int guest_physmap_max_mem_pages(struct domain *d, unsigned long new_max);
-
-extern void guest_physmap_add_page(
- struct domain *d, unsigned long gpfn, unsigned long mfn);
-
-extern void guest_physmap_remove_page(
- struct domain *d, unsigned long gpfn, unsigned long mfn);
-
-#endif
diff --git a/xen/include/asm-powerpc/mpic.h b/xen/include/asm-powerpc/mpic.h
deleted file mode 100644
index 45cf5f692b..0000000000
--- a/xen/include/asm-powerpc/mpic.h
+++ /dev/null
@@ -1,294 +0,0 @@
-/* from linux/include/asm-ppc/mpic.h */
-
-#ifndef _ASM_POWERPC_MPIC_H
-#define _ASM_POWERPC_MPIC_H
-//#ifdef __KERNEL__
-
-//#include <linux/irq.h>
-#include <xen/irq.h>
-
-/*
- * Global registers
- */
-
-#define MPIC_GREG_BASE 0x01000
-
-#define MPIC_GREG_FEATURE_0 0x00000
-#define MPIC_GREG_FEATURE_LAST_SRC_MASK 0x07ff0000
-#define MPIC_GREG_FEATURE_LAST_SRC_SHIFT 16
-#define MPIC_GREG_FEATURE_LAST_CPU_MASK 0x00001f00
-#define MPIC_GREG_FEATURE_LAST_CPU_SHIFT 8
-#define MPIC_GREG_FEATURE_VERSION_MASK 0xff
-#define MPIC_GREG_FEATURE_1 0x00010
-#define MPIC_GREG_GLOBAL_CONF_0 0x00020
-#define MPIC_GREG_GCONF_RESET 0x80000000
-#define MPIC_GREG_GCONF_8259_PTHROU_DIS 0x20000000
-#define MPIC_GREG_GCONF_BASE_MASK 0x000fffff
-#define MPIC_GREG_GLOBAL_CONF_1 0x00030
-#define MPIC_GREG_VENDOR_0 0x00040
-#define MPIC_GREG_VENDOR_1 0x00050
-#define MPIC_GREG_VENDOR_2 0x00060
-#define MPIC_GREG_VENDOR_3 0x00070
-#define MPIC_GREG_VENDOR_ID 0x00080
-#define MPIC_GREG_VENDOR_ID_STEPPING_MASK 0x00ff0000
-#define MPIC_GREG_VENDOR_ID_STEPPING_SHIFT 16
-#define MPIC_GREG_VENDOR_ID_DEVICE_ID_MASK 0x0000ff00
-#define MPIC_GREG_VENDOR_ID_DEVICE_ID_SHIFT 8
-#define MPIC_GREG_VENDOR_ID_VENDOR_ID_MASK 0x000000ff
-#define MPIC_GREG_PROCESSOR_INIT 0x00090
-#define MPIC_GREG_IPI_VECTOR_PRI_0 0x000a0
-#define MPIC_GREG_IPI_VECTOR_PRI_1 0x000b0
-#define MPIC_GREG_IPI_VECTOR_PRI_2 0x000c0
-#define MPIC_GREG_IPI_VECTOR_PRI_3 0x000d0
-#define MPIC_GREG_SPURIOUS 0x000e0
-#define MPIC_GREG_TIMER_FREQ 0x000f0
-
-/*
- *
- * Timer registers
- */
-#define MPIC_TIMER_BASE 0x01100
-#define MPIC_TIMER_STRIDE 0x40
-
-#define MPIC_TIMER_CURRENT_CNT 0x00000
-#define MPIC_TIMER_BASE_CNT 0x00010
-#define MPIC_TIMER_VECTOR_PRI 0x00020
-#define MPIC_TIMER_DESTINATION 0x00030
-
-/*
- * Per-Processor registers
- */
-
-#define MPIC_CPU_THISBASE 0x00000
-#define MPIC_CPU_BASE 0x20000
-#define MPIC_CPU_STRIDE 0x01000
-
-#define MPIC_CPU_IPI_DISPATCH_0 0x00040
-#define MPIC_CPU_IPI_DISPATCH_1 0x00050
-#define MPIC_CPU_IPI_DISPATCH_2 0x00060
-#define MPIC_CPU_IPI_DISPATCH_3 0x00070
-#define MPIC_CPU_CURRENT_TASK_PRI 0x00080
-#define MPIC_CPU_TASKPRI_MASK 0x0000000f
-#define MPIC_CPU_WHOAMI 0x00090
-#define MPIC_CPU_WHOAMI_MASK 0x0000001f
-#define MPIC_CPU_INTACK 0x000a0
-#define MPIC_CPU_EOI 0x000b0
-
-/*
- * Per-source registers
- */
-
-#define MPIC_IRQ_BASE 0x10000
-#define MPIC_IRQ_STRIDE 0x00020
-#define MPIC_IRQ_VECTOR_PRI 0x00000
-#define MPIC_VECPRI_MASK 0x80000000
-#define MPIC_VECPRI_ACTIVITY 0x40000000 /* Read Only */
-#define MPIC_VECPRI_PRIORITY_MASK 0x000f0000
-#define MPIC_VECPRI_PRIORITY_SHIFT 16
-#define MPIC_VECPRI_VECTOR_MASK 0x000007ff
-#define MPIC_VECPRI_POLARITY_POSITIVE 0x00800000
-#define MPIC_VECPRI_POLARITY_NEGATIVE 0x00000000
-#define MPIC_VECPRI_POLARITY_MASK 0x00800000
-#define MPIC_VECPRI_SENSE_LEVEL 0x00400000
-#define MPIC_VECPRI_SENSE_EDGE 0x00000000
-#define MPIC_VECPRI_SENSE_MASK 0x00400000
-#define MPIC_IRQ_DESTINATION 0x00010
-
-#define MPIC_MAX_IRQ_SOURCES 2048
-#define MPIC_MAX_CPUS 32
-#define MPIC_MAX_ISU 32
-
-/*
- * Special vector numbers (internal use only)
- */
-#define MPIC_VEC_SPURRIOUS 255
-#define MPIC_VEC_IPI_3 254
-#define MPIC_VEC_IPI_2 253
-#define MPIC_VEC_IPI_1 252
-#define MPIC_VEC_IPI_0 251
-
-/* unused */
-#define MPIC_VEC_TIMER_3 250
-#define MPIC_VEC_TIMER_2 249
-#define MPIC_VEC_TIMER_1 248
-#define MPIC_VEC_TIMER_0 247
-
-/* Type definition of the cascade handler */
-typedef int (*mpic_cascade_t)(struct cpu_user_regs /* pt_regs */ *regs, void *data);
-
-#ifdef CONFIG_MPIC_BROKEN_U3
-/* Fixup table entry */
-struct mpic_irq_fixup
-{
- u8 __iomem *base;
- u8 __iomem *applebase;
- u32 data;
- unsigned int index;
-};
-#endif /* CONFIG_MPIC_BROKEN_U3 */
-
-
-/* The instance data of a given MPIC */
-struct mpic
-{
- /* The "linux" controller struct */
- hw_irq_controller hc_irq;
-#ifdef CONFIG_SMP
- hw_irq_controller hc_ipi;
-#endif
- const char *name;
- /* Flags */
- unsigned int flags;
- /* How many irq sources in a given ISU */
- unsigned int isu_size;
- unsigned int isu_shift;
- unsigned int isu_mask;
- /* Offset of irq vector numbers */
- unsigned int irq_offset;
- unsigned int irq_count;
- /* Offset of ipi vector numbers */
- unsigned int ipi_offset;
- /* Number of sources */
- unsigned int num_sources;
- /* Number of CPUs */
- unsigned int num_cpus;
- /* cascade handler */
- mpic_cascade_t cascade;
- void *cascade_data;
- unsigned int cascade_vec;
- /* senses array */
- unsigned char *senses;
- unsigned int senses_count;
-
-#ifdef CONFIG_MPIC_BROKEN_U3
- /* The fixup table */
- struct mpic_irq_fixup *fixups;
- spinlock_t fixup_lock;
-#endif
-
- /* The various ioremap'ed bases */
- volatile u32 __iomem *gregs;
- volatile u32 __iomem *tmregs;
- volatile u32 __iomem *cpuregs[MPIC_MAX_CPUS];
- volatile u32 __iomem *isus[MPIC_MAX_ISU];
-
- /* link */
- struct mpic *next;
-};
-
-/* This is the primary controller, only that one has IPIs and
- * has afinity control. A non-primary MPIC always uses CPU0
- * registers only
- */
-#define MPIC_PRIMARY 0x00000001
-/* Set this for a big-endian MPIC */
-#define MPIC_BIG_ENDIAN 0x00000002
-/* Broken U3 MPIC */
-#define MPIC_BROKEN_U3 0x00000004
-/* Broken IPI registers (autodetected) */
-#define MPIC_BROKEN_IPI 0x00000008
-/* MPIC wants a reset */
-#define MPIC_WANTS_RESET 0x00000010
-
-/* Allocate the controller structure and setup the linux irq descs
- * for the range if interrupts passed in. No HW initialization is
- * actually performed.
- *
- * @phys_addr: physial base address of the MPIC
- * @flags: flags, see constants above
- * @isu_size: number of interrupts in an ISU. Use 0 to use a
- * standard ISU-less setup (aka powermac)
- * @irq_offset: first irq number to assign to this mpic
- * @irq_count: number of irqs to use with this mpic IRQ sources. Pass 0
- * to match the number of sources
- * @ipi_offset: first irq number to assign to this mpic IPI sources,
- * used only on primary mpic
- * @senses: array of sense values
- * @senses_num: number of entries in the array
- *
- * Note about the sense array. If none is passed, all interrupts are
- * setup to be level negative unless MPIC_BROKEN_U3 is set in which
- * case they are edge positive (and the array is ignored anyway).
- * The values in the array start at the first source of the MPIC,
- * that is senses[0] correspond to linux irq "irq_offset".
- */
-extern struct mpic *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_num,
- const char *name);
-
-/* Assign ISUs, to call before mpic_init()
- *
- * @mpic: controller structure as returned by mpic_alloc()
- * @isu_num: ISU number
- * @phys_addr: physical address of the ISU
- */
-extern void mpic_assign_isu(struct mpic *mpic, unsigned int isu_num,
- unsigned long phys_addr);
-
-/* Initialize the controller. After this has been called, none of the above
- * should be called again for this mpic
- */
-extern void mpic_init(struct mpic *mpic);
-
-/* Setup a cascade. Currently, only one cascade is supported this
- * way, though you can always do a normal request_irq() and add
- * other cascades this way. You should call this _after_ having
- * added all the ISUs
- *
- * @irq_no: "linux" irq number of the cascade (that is offset'ed vector)
- * @handler: cascade handler function
- */
-extern void mpic_setup_cascade(unsigned int irq_no, mpic_cascade_t hanlder,
- void *data);
-
-/*
- * All of the following functions must only be used after the
- * ISUs have been assigned and the controller fully initialized
- * with mpic_init()
- */
-
-
-/* Change/Read the priority of an interrupt. Default is 8 for irqs and
- * 10 for IPIs. You can call this on both IPIs and IRQ numbers, but the
- * IPI number is then the offset'ed (linux irq number mapped to the IPI)
- */
-extern void mpic_irq_set_priority(unsigned int irq, unsigned int pri);
-extern unsigned int mpic_irq_get_priority(unsigned int irq);
-
-/* Setup a non-boot CPU */
-extern void mpic_setup_this_cpu(void);
-
-/* Clean up for kexec (or cpu offline or ...) */
-extern void mpic_teardown_this_cpu(int secondary);
-
-/* Get the current cpu priority for this cpu (0..15) */
-extern int mpic_cpu_get_priority(void);
-
-/* Set the current cpu priority for this cpu */
-extern void mpic_cpu_set_priority(int prio);
-
-/* Request IPIs on primary mpic */
-extern void mpic_request_ipis(void);
-
-/* Send an IPI (non offseted number 0..3) */
-extern void mpic_send_ipi(unsigned int ipi_no, unsigned int cpu_mask);
-
-/* Send a message (IPI) to a given target (cpu number or MSG_*) */
-void smp_mpic_message_pass(int target, int msg);
-
-/* Fetch interrupt from a given mpic */
-extern int mpic_get_one_irq(struct mpic *mpic, struct cpu_user_regs /* pt_regs */ *regs);
-/* This one gets to the primary mpic */
-extern int mpic_get_irq(struct cpu_user_regs /* pt_regs */ *regs);
-
-/* global mpic for pSeries */
-extern struct mpic *pSeries_mpic;
-
-//#endif /* __KERNEL__ */
-#endif /* _ASM_POWERPC_MPIC_H */
diff --git a/xen/include/asm-powerpc/msr.h b/xen/include/asm-powerpc/msr.h
deleted file mode 100644
index 207e2dc70e..0000000000
--- a/xen/include/asm-powerpc/msr.h
+++ /dev/null
@@ -1,66 +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@watson.ibm.com>
- */
-
-#ifndef _POWERPC_MSR_H
-#define _POWERPC_MSR_H
-
-#ifdef __ASSEMBLY__
-#define ULL(x) x
-#else
-#define ULL(x) x ## ULL
-#endif
-
-/* Flags in MSR: */
-#define MSR_SF ULL(0x8000000000000000)
-#define MSR_TA ULL(0x4000000000000000)
-#define MSR_ISF ULL(0x2000000000000000)
-#define MSR_HV ULL(0x1000000000000000)
-#define MSR_VMX ULL(0x0000000002000000)
-#define MSR_MER ULL(0x0000000000200000)
-#define MSR_POW ULL(0x0000000000040000)
-#define MSR_ILE ULL(0x0000000000010000)
-#define MSR_EE ULL(0x0000000000008000)
-#define MSR_PR ULL(0x0000000000004000)
-#define MSR_FP ULL(0x0000000000002000)
-#define MSR_ME ULL(0x0000000000001000)
-#define MSR_FE0 ULL(0x0000000000000800)
-#define MSR_SE ULL(0x0000000000000400)
-#define MSR_BE ULL(0x0000000000000200)
-#define MSR_FE1 ULL(0x0000000000000100)
-#define MSR_IP ULL(0x0000000000000040)
-#define MSR_IR ULL(0x0000000000000020)
-#define MSR_DR ULL(0x0000000000000010)
-#define MSR_PMM ULL(0x0000000000000004)
-#define MSR_RI ULL(0x0000000000000002)
-#define MSR_LE ULL(0x0000000000000001)
-
-/* MSR bits set on the systemsim simulator */
-#define MSR_SIM ULL(0x0000000020000000)
-#define MSR_SYSTEMSIM ULL(0x0000000010000000)
-
-/* On a trap, srr1's copy of msr defines some bits as follows: */
-#define MSR_TRAP_FE ULL(0x0000000000100000) /* Floating Point Exception */
-#define MSR_TRAP_IOP ULL(0x0000000000080000) /* Illegal Instruction */
-#define MSR_TRAP_PRIV ULL(0x0000000000040000) /* Privileged Instruction */
-#define MSR_TRAP ULL(0x0000000000020000) /* Trap Instruction */
-#define MSR_TRAP_NEXT ULL(0x0000000000010000) /* PC is next instruction */
-#define MSR_TRAP_BITS (MSR_TRAP_FE|MSR_TRAP_IOP|MSR_TRAP_PRIV|MSR_TRAP)
-
-#endif /* _POWERPC_MSR_H */
diff --git a/xen/include/asm-powerpc/multicall.h b/xen/include/asm-powerpc/multicall.h
deleted file mode 100644
index 5a383056be..0000000000
--- a/xen/include/asm-powerpc/multicall.h
+++ /dev/null
@@ -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@watson.ibm.com>
- */
-
-#ifndef __ASM_PPC_MULTICALL_H__
-#define __ASM_PPC_MULTICALL_H__
-
-/* defined in arch/ppc/hcalls.c */
-extern void do_multicall_call(multicall_entry_t *call);
-
-#endif
diff --git a/xen/include/asm-powerpc/nmi.h b/xen/include/asm-powerpc/nmi.h
deleted file mode 100644
index edbc554e80..0000000000
--- a/xen/include/asm-powerpc/nmi.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef ASM_NMI_H
-#define ASM_NMI_H
-
-#include <public/nmi.h>
-
-#define register_guest_nmi_callback(a) (-ENOSYS)
-#define unregister_guest_nmi_callback() (-ENOSYS)
-
-#endif /* ASM_NMI_H */
diff --git a/xen/include/asm-powerpc/numa.h b/xen/include/asm-powerpc/numa.h
deleted file mode 100644
index a3a770bdad..0000000000
--- a/xen/include/asm-powerpc/numa.h
+++ /dev/null
@@ -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. 2007
- *
- * Authors: Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#ifndef __ASM_NUMA_H__
-#define __ASM_NUMA_H__
-
-#include <xen/init.h>
-#include "../asm-x86/numa.h"
-extern void numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn);
-
-#endif
diff --git a/xen/include/asm-powerpc/page.h b/xen/include/asm-powerpc/page.h
deleted file mode 100644
index f650849858..0000000000
--- a/xen/include/asm-powerpc/page.h
+++ /dev/null
@@ -1,134 +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@us.ibm.com>
- * Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#ifndef _ASM_PAGE_H
-#define _ASM_PAGE_H
-
-#define PAGE_SHIFT 12
-#define PAGE_SIZE (1<<PAGE_SHIFT)
-#define PAGE_MASK (~(PAGE_SIZE-1))
-
-#ifndef __ASSEMBLY__
-
-#include <xen/config.h>
-#include <asm/cache.h>
-
-#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
-#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
-
-typedef struct { unsigned long l1_lo; } l1_pgentry_t;
-#define linear_l1_table \
- ((l1_pgentry_t *)(LINEAR_PT_VIRT_START))
-
-#define l1_linear_offset(_a) ((_a) >> PAGE_SHIFT)
-
-/*
- * NB. We don't currently track I/O holes in the physical RAM space.
- */
-#define mfn_valid(mfn) ((mfn) < max_page)
-
-#define virt_to_maddr(va) ((unsigned long)(va))
-#define maddr_to_virt(ma) ((void *)((unsigned long)(ma)))
-/* Shorthand versions of the above functions. */
-#define __pa(x) (virt_to_maddr(x))
-#define __va(x) (maddr_to_virt(x))
-
-/* Convert between Xen-heap virtual addresses and machine frame numbers. */
-#define virt_to_mfn(va) (virt_to_maddr(va) >> PAGE_SHIFT)
-#define mfn_to_virt(mfn) (maddr_to_virt(mfn << PAGE_SHIFT))
-
-/* Convert between machine frame numbers and page-info structures. */
-#define mfn_to_page(mfn) (frame_table + (mfn))
-#define page_to_mfn(pg) ((unsigned long)((pg) - frame_table))
-
-/* Convert between machine addresses and page-info structures. */
-#define maddr_to_page(ma) (frame_table + ((ma) >> PAGE_SHIFT))
-#define page_to_maddr(pg) ((paddr_t)((pg) - frame_table) << PAGE_SHIFT)
-
-/* Convert between Xen-heap virtual addresses and page-info structures. */
-#define virt_to_page(va) (frame_table + (__pa(va) >> PAGE_SHIFT))
-#define page_to_virt(pg) (maddr_to_virt(page_to_maddr(pg)))
-
-/* Convert between frame number and address formats. */
-#define pfn_to_paddr(pfn) ((paddr_t)(pfn) << PAGE_SHIFT)
-#define paddr_to_pfn(pa) ((unsigned long)((pa) >> PAGE_SHIFT))
-
-static __inline__ void clear_page(void *addr)
-{
- unsigned long lines, line_size;
-
- line_size = cpu_caches.dline_size;
- lines = cpu_caches.dlines_per_page;
-
- __asm__ __volatile__(
- "mtctr %1 # clear_page\n\
-1: dcbz 0,%0\n\
- add %0,%0,%3\n\
- bdnz+ 1b"
- : "=r" (addr)
- : "r" (lines), "0" (addr), "r" (line_size)
- : "ctr", "memory");
-}
-
-extern void copy_page(void *dp, void *sp);
-
-#define linear_pg_table linear_l1_table
-
-static inline int get_order(unsigned long size)
-{
- int order;
-
- size = (size-1) >> (PAGE_SHIFT-1);
- order = -1;
- do {
- size >>= 1;
- order++;
- } while (size);
- return order;
-}
-
-/* XXX combine with get_order() above */
-#define get_order_from_bytes get_order
-static inline int get_order_from_pages(unsigned long nr_pages)
-{
- int order;
- nr_pages--;
- for ( order = 0; nr_pages; order++ )
- nr_pages >>= 1;
- return order;
-}
-
-#define __flush_tlb_one(__addr) \
- __asm__ __volatile__("tlbie %0": :"r" (__addr): "memory")
-
-#define _PAGE_PRESENT 0x001UL
-#define _PAGE_RW 0x002UL
-#define _PAGE_USER 0x004UL
-#define _PAGE_PWT 0x008UL
-#define _PAGE_PCD 0x010UL
-#define _PAGE_ACCESSED 0x020UL
-#define _PAGE_DIRTY 0x040UL
-#define _PAGE_PAT 0x080UL
-#define _PAGE_PSE 0x080UL
-#define _PAGE_GLOBAL 0x100UL
-
-#endif /* ! __ASSEMBLY__ */
-#endif
diff --git a/xen/include/asm-powerpc/papr.h b/xen/include/asm-powerpc/papr.h
deleted file mode 100644
index a04477ed1e..0000000000
--- a/xen/include/asm-powerpc/papr.h
+++ /dev/null
@@ -1,219 +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@watson.ibm.com>
- */
-
-#ifndef _PAPR_H
-#define _PAPR_H
-
-/*
- * Class is one of the following:
- *
- * Crit: Continuous forward progress must be made, encountering any
- * busy resource must cause the function to be backed out and return
- * with a "hardware busy" return code.
- *
- * Norm: Similar to Crit, however, wait loops for slow hardware
- * access are allowed.
- *
- */
-/* NAME Token Class Mandatory Set */
-#define H_UNUSED 0x0000 /* Crit Yes pft */
-#define H_REMOVE 0x0004 /* Crit Yes pft */
-#define H_ENTER 0x0008 /* Crit Yes pft */
-#define H_READ 0x000c /* Crit Yes pft */
-#define H_CLEAR_MOD 0x0010 /* Crit Yes pft */
-#define H_CLEAR_REF 0x0014 /* Crit Yes pft */
-#define H_PROTECT 0x0018 /* Crit Yes pft */
-#define H_GET_TCE 0x001c /* Crit Yes tce */
-#define H_PUT_TCE 0x0020 /* Crit Yes tce */
-#define H_SET_SPRG0 0x0024 /* Crit Yes sprg0 */
-#define H_SET_DABR 0x0028 /* Crit Yes-dabr exists dabr */
-#define H_PAGE_INIT 0x002c /* Crit Yes copy */
-#define H_SET_ASR 0x0030 /* Crit Yes-on Istar asr */
-#define H_ASR_ON 0x0034 /* Crit Yes-on Istar asr */
-#define H_ASR_OFF 0x0038 /* Crit Yes-on Istar asr */
-#define H_LOGICAL_CI_LOAD 0x003c /* Norm Yes debug */
-#define H_LOGICAL_CI_STORE 0x0040 /* Norm Yes debug */
-#define H_LOGICAL_CACHE_LOAD 0x0044 /* Crit Yes debug */
-#define H_LOGICAL_CACHE_STORE 0x0048 /* Crit Yes debug */
-#define H_LOGICAL_ICBI 0x004c /* Norm Yes debug */
-#define H_LOGICAL_DCBF 0x0050 /* Norm Yes debug */
-#define H_GET_TERM_CHAR 0x0054 /* Crit Yes term */
-#define H_PUT_TERM_CHAR 0x0058 /* Crit Yes term */
-#define H_REAL_TO_LOGICAL 0x005c /* Norm Yes perf */
-#define H_HYPERVISOR_DATA 0x0060 /* Norm See below dump */
- /* is mandatory if enabled by HSC
- * and is disabled by default */
-#define H_EOI 0x0064 /* Crit Yes int */
-#define H_CPPR 0x0068 /* Crit Yes int */
-#define H_IPI 0x006c /* Crit Yes int */
-#define H_IPOLL 0x0070 /* Crit Yes int */
-#define H_XIRR 0x0074 /* Crit Yes int */
-#define H_MIGRATE_PCI_TCE 0x0078 /* Norm Yes-if LRDR migrate */
-#define H_PERFMON 0x007c /* Norm Yes-if PMU perfmon */
-#define H_CEDE 0x00e0 /* Crit Yes splpar */
-#define H_CONFER 0x00e4
-#define H_PROD 0x00e8
-#define H_GET_PPP 0x00ec
-#define H_SET_PPP 0x00f0
-#define H_PURR 0x00f4
-#define H_PIC 0x00f8
-#define H_REG_CRQ 0x00fc
-#define H_FREE_CRQ 0x0100
-#define H_VIO_SIGNAL 0x0104
-#define H_SEND_CRQ 0x0108
-#define H_PUTRTCE 0x010c
-#define H_COPY_RDMA 0x0110
-#define H_REGISTER_LOGICAL_LAN 0x0114
-#define H_FREE_LOGICAL_LAN 0x0118
-#define H_ADD_LOGICAL_LAN_BUFFER 0x011c
-#define H_SEND_LOGICAL_LAN 0x0120
-#define H_BULK_REMOVE 0x0124
-#define H_WRITE_RDMA 0x0128
-#define H_READ_RDMA 0x012c
-#define H_MULTICAST_CTRL 0x0130
-#define H_SET_XDABR 0x0134
-#define H_STUFF_TCE 0x0138
-#define H_PUT_TCE_INDIRECT 0x013c
-#define H_PUT_RTCE_INDERECT 0x0140
-#define H_MASS_MAP_TCE 0x0144
-#define H_ALRDMA 0x0148
-#define H_CHANGE_LOGICAL_LAN_MAC 0x014c
-#define H_VTERM_PARTNER_INFO 0x0150
-#define H_REGISTER_VTERM 0x0154
-#define H_FREE_VTERM 0x0158
-#define H_HCA_RESV_BEGIN 0x015c
-#define H_HCA_RESV_END 0x01c0
-#define H_GRANT_LOGICAL 0x01c4
-#define H_RESCIND_LOGICAL 0x01c8
-#define H_ACCEPT_LOGICAL 0x01cc
-#define H_RETURN_LOGICAL 0x01d0
-#define H_FREE_LOGICAL_LAN_BUFFER 0x01d4
-
-#define RPA_HCALL_END 0x01d4 /* set to last entry */
-
-/*
- * Hidden
- */
-#define H_PCI_CONFIG_READ 0x610c /* PHYP # 0x500c */
-#define H_PCI_CONFIG_WRITE 0x6110 /* PHYP # 0x5010 */
-#define H_THREAD_CONTROL 0x6144 /* PHYP # 0x5044 H_CPU_CONTROL */
-#define H_GET_XIVE 0x614c /* PHYP # 0x504c */
-#define H_SET_XIVE 0x6150 /* PHYP # 0x5050 */
-#define H_INTERRUPT 0x6154 /* PHYP # 0x5054 */
-
-#define HYPE_HCALL_END H_INTERRUPT /* XXX */
-
-/*
- * Hypervisor Call Return Codes
- */
-#define H_PARTIAL_STORE 16
-#define H_PAGE_REGISTERED 15
-#define H_IN_PROGRESS 14
-#define H_Sensor_CH 13 /* Sensor value >= Critical high */
-#define H_Sensor_WH 12 /* Sensor value >= Warning high */
-#define H_Sensor_Norm 11 /* Sensor value normal */
-#define H_Sensor_WL 10 /* Sensor value <= Warning low */
-#define H_Sensor_CL 9 /* Sensor value <= Critical low */
-#define H_Partial 5
-#define H_Constrained 4
-#define H_Closed 2 /* virtual terminal session is closed */
-#define H_Busy 1 /* Hardware Busy -- Retry Later */
-#define H_Success 0
-#define H_Hardware -1 /* Error */
-#define H_Function -2 /* Not Supported */
-#define H_Privilege -3 /* Caller not in privileged mode */
-#define H_Parameter -4 /* Outside Valid Range for Partition
- * or conflicting */
-#define H_Bad_Mode -5 /* Illegal MSR value */
-#define H_PTEG_FULL -6 /* The requested pteg was full */
-#define H_NOT_FOUND -7 /* The requested pte was not found */
-#define H_RESERVED_DABR -8 /* The requested address is reserved
- * by the Hypervisor on this
- * processor */
-#define H_UNAVAIL -9 /* Requested resource unavailable */
-#define H_INVAL -10 /* Requested parameter is invalid */
-#define H_Permission -11
-#define H_Dropped -12
-#define H_S_Parm -13
-#define H_D_Parm -14
-#define H_R_Parm -15
-#define H_Resource -16
-#define H_ADAPTER_PARM -17
-
-#define H_Rescinded -18 /* FIXME: check RPA value */
-
-/*
- * compatibility With Linux Labels, perhpas we should ifdef this linux
- * and/or kernel.
- */
-#define H_Not_Found H_NOT_FOUND
-#define H_ANDCOND H_andcond
-#define H_LARGE_PAGE H_Large_Page
-#define H_ICACHE_INVALIDATE H_I_Cache_Inv
-#define H_ICACHE_SYNCHRONIZE H_I_Cache_Sync
-#define H_ZERO_PAGE H_Zero_Page
-#define H_COPY_PAGE H_Copy_Page
-#define H_EXACT H_Exact
-#define H_PTEG_Full H_PTEG_FULL
-#define H_PP1 H_pp1
-#define H_PP2 H_pp2
-
-#ifndef __ASSEMBLY__
-
-#include <xen/types.h>
-/*
- * The Hcall() Flags Field Definition
- */
-#define H_NUMA_CEC (~(1UL << (63 - 15 + 1) - 1)) /* bits 0-15 */
-
-#define H_Blank_1 (1UL<<(63-17))
-
-#define H_Exact (1UL<<(63-24))
-#define H_R_XLATE (1UL<<(63-25))
-#define H_READ_4 (1UL<<(63-26))
-
-#define H_AVPN (1UL<<(63-32))
-#define H_andcond (1UL<<(63-33))
-
-#define H_I_Cache_Inv (1UL<<(63-40))
-#define H_I_Cache_Sync (1UL<<(63-41))
-#define H_Blank_2 (1UL<<(63-42))
-
-#define H_Zero_Page (1UL<<(63-48))
-#define H_Copy_Page (1UL<<(63-49))
-#define H_Blank_3 (1UL<<(63-50))
-
-#define H_N (1UL<<(63-61))
-#define H_pp1 (1UL<<(63-62))
-#define H_pp2 (1UL<<(63-63))
-
-#define H_VM_MAP_ICACHE_INVALIDATE (1UL<<(63-40))
-#define H_VM_MAP_ICACHE_SYNCRONIZE (1UL<<(63-41))
-#define H_VM_MAP_INVALIDATE_TRANSLATION (1UL<<(63-42))
-#define H_VM_MAP_INSERT_TRANSLATION (1UL<<(63-43))
-#define H_VM_MAP_LARGE_PAGE (1UL<<(63-44))
-#define H_VM_MAP_ZERO_PAGE (1UL<<(63-48))
-
-enum {
- INVALID_LOGICAL_ADDRESS = (~((ulong)0)),
-};
-
-#endif /* ! __ASSEMBLY__ */
-#endif /* ! _HYPE_CALLS_H */
diff --git a/xen/include/asm-powerpc/pci.h b/xen/include/asm-powerpc/pci.h
deleted file mode 100644
index 24e806e9e8..0000000000
--- a/xen/include/asm-powerpc/pci.h
+++ /dev/null
@@ -1,35 +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@us.ibm.com>
- */
-
-#ifndef _ASM_PCI_H_
-#define _ASM_PCI_H_
-
-#include <xen/pci.h>
-
-#define PCIBIOS_MIN_IO 0x1000
-#define PCIBIOS_MIN_MEM 0x10000000
-
-extern void pcibios_set_master(struct pci_dev *dev);
-extern unsigned int pcibios_assign_all_busses(void);
-extern int pcibios_scan_all_fns(struct pci_bus *bus, int devfn);
-extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value);
-extern int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value);
-
-#endif
diff --git a/xen/include/asm-powerpc/percpu.h b/xen/include/asm-powerpc/percpu.h
deleted file mode 100644
index e52041b458..0000000000
--- a/xen/include/asm-powerpc/percpu.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* from xen/include/asm-x86/percpu.h */
-
-#ifndef __PPC_PERCPU_H__
-#define __PPC_PERCPU_H__
-
-#define PERCPU_SHIFT 12
-#define PERCPU_SIZE (1UL << PERCPU_SHIFT)
-
-/* We care out NR_CPUS bytes below the reset vector (0x100) so we can
- * track per-cpu state that we wish we had a register for. Currently
- * it is only used to track Cache Inhibited Mode when a Machine Check
- * occurs. */
-/* NOTE: This array is indexed by PIR NOT CPUID */
-#define MCK_GOOD_HID4 (0x100 - 8)
-#define MCK_CPU_STAT_BASE (MCK_GOOD_HID4 - NR_CPUS) /* accomodate a hid4 */
-/* Currently, the only state we track, so lets make it easy */
-#define MCK_CPU_STAT_CI -1
-
-#ifndef __ASSEMBLY__
-#define mck_cpu_stats ((char *)MCK_CPU_STAT_BASE)
-#define mck_good_hid4 ((ulong *)MCK_GOOD_HID4)
-
-/* Separate out the type, so (int[3], foo) works. */
-#define DEFINE_PER_CPU(type, name) \
- __attribute__((__section__(".data.percpu"))) \
- __typeof__(type) per_cpu__##name
-
-/* var is in discarded region: offset to particular copy we want */
-#define per_cpu(var, cpu) \
- (*RELOC_HIDE(&per_cpu__##var, ((unsigned int)(cpu))<<PERCPU_SHIFT))
-#define __get_cpu_var(var) \
- (per_cpu(var, smp_processor_id()))
-
-#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
-#endif /* __ASSEMBLY__ */
-#endif /* __PPC_PERCPU_H__ */
diff --git a/xen/include/asm-powerpc/perfc.h b/xen/include/asm-powerpc/perfc.h
deleted file mode 100644
index 37a0ac3bc5..0000000000
--- a/xen/include/asm-powerpc/perfc.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef __ASM_PERFC_H__
-#define __ASM_PERFC_H__
-
-static inline void arch_perfc_printall (void)
-{
-}
-
-static inline void arch_perfc_reset (void)
-{
-}
-
-static inline void arch_perfc_gather (void)
-{
-}
-
-#endif
diff --git a/xen/include/asm-powerpc/platform.h b/xen/include/asm-powerpc/platform.h
deleted file mode 100644
index 74e810af7a..0000000000
--- a/xen/include/asm-powerpc/platform.h
+++ /dev/null
@@ -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 IBM Corp. 2007
- *
- * Authors: Ryan Harper <ryanh@us.ibm.com>
- */
-
-#ifndef _ASM_PLATFORM_H_
-#define _ASM_PLATFORM_H_
-
-extern unsigned long platform_iohole_base(void);
-extern unsigned long platform_iohole_size(void);
-extern int platform_io_mfn(unsigned long mfn);
-
-#endif
diff --git a/xen/include/asm-powerpc/powerpc64/config.h b/xen/include/asm-powerpc/powerpc64/config.h
deleted file mode 100644
index 86183d1441..0000000000
--- a/xen/include/asm-powerpc/powerpc64/config.h
+++ /dev/null
@@ -1,39 +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@us.ibm.com>
- */
-
-#ifndef __PPC_64_CONFIG_H__
-#define __PPC_64_CONFIG_H__
-
-#define CONFIG_L1_CACHE_SHIFT 7
-
-/* 288 bytes below the stack pointer must be preserved by interrupt handlers */
-#define STACK_VOLATILE_AREA 288
-/* size of minimum stack frame; C code can write into the caller's stack */
-#define STACK_FRAME_OVERHEAD 112
-
-#define STACK_ORDER 2
-#define STACK_SIZE (PAGE_SIZE << STACK_ORDER)
-
-#define NUM_SLB_ENTRIES 64
-#define NUM_FPRS 32
-#define HAS_FLOAT 1
-#define HAS_VMX 1
-
-#endif
diff --git a/xen/include/asm-powerpc/powerpc64/ppc970-hid.h b/xen/include/asm-powerpc/powerpc64/ppc970-hid.h
deleted file mode 100644
index 70050039ab..0000000000
--- a/xen/include/asm-powerpc/powerpc64/ppc970-hid.h
+++ /dev/null
@@ -1,144 +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@watson.ibm.com>
- */
-
-/*
- * Details of the 970-specific HID registers.
- */
-
-#ifndef _ASM_HID_H_
-#define _ASM_HID_H_
-
-#include <xen/types.h>
-
-union hid0 {
- struct hid0_bits {
- ulong one_ppc: 1; /* One PowerPC AS insn per dispatch group */
- ulong do_single: 1; /* Single group completion */
- ulong isync_sc: 1; /* Disable isync scoreboard optimization */
- ulong ser_gp: 1; /* Serial Group Dispatch */
- ulong _reserved_04_08: 5;
- ulong nap: 1; /* Nap */
- ulong _reserved_10: 1;
- ulong dpm: 1; /* Dynamic Power Management */
- ulong _reserved_12: 1;
- ulong tg: 1; /* Perfmon threshold granualrity control */
- ulong hang_dis: 1; /* Disable cpu hang detection mechanism */
- ulong nhr: 1; /* Not Hard Reset */
- ulong inorder: 1; /* Serial Group Issue */
- ulong _reserved17: 1;
- ulong tb_ctrl: 1; /* Enable time base couting while stopped */
- ulong ext_tb_enb: 1; /* timebase is linked to external clock */
- ulong _unused_20_21: 2;
- ulong ciabr_en: 1; /* CIABR enable */
- ulong hdice_en: 1; /* HDEC enable */
- ulong en_therm: 1; /* Enable ext thermal ints */
- ulong _unused_25_30: 6;
- ulong en_attn: 1; /* Enable attn instruction */
- ulong en_mck: 1; /* En external machine check interrupts */
- ulong _unused_33_63: 31;
- } bits;
- ulong word;
-};
-
-union hid1 {
- struct hid1_bits {
- ulong bht_pm: 3; /* branch history table prediction mode */
- ulong en_ls: 1; /* enable link stack */
- ulong en_cc: 1; /* enable count cache */
- ulong en_ic: 1; /* enable inst cache */
- ulong _reserved_6: 1;
- ulong pf_mode: 2; /* prefetch mode */
- ulong en_icbi: 1; /* enable forced icbi match mode */
- ulong en_if_cach: 1; /* i-fetch cacheability control */
- ulong en_ic_rec: 1; /* i-cache parity error recovery */
- ulong en_id_rec: 1; /* i-dir parity error recovery */
- ulong en_er_rec: 1; /* i-ERAT parity error recovery */
- ulong ic_pe: 1; /* Force instruction cache parity error */
- ulong icd0_pe: 1; /* Force insn cache dir 0 parity error */
- ulong _reserved_16: 1;
- ulong ier_pe: 1; /* force i-ERAT parity error (inject) */
- ulong en_sp_itw: 1; /* En speculative tablewalks */
- ulong _reserved_19_63: 45;
- } bits;
- ulong word;
-};
-
-union hid4 {
- struct hid4_bits {
- ulong lpes_0: 1; /* LPAR Environment Selector bit 0 */
- ulong rmlr_1_2: 2; /* RMLR 1:2 */
- ulong lpid_2_5: 4; /* LPAR ID bits 2:5 */
- ulong rmor_0_15: 16; /* real mode offset region */
- ulong rm_ci: 1; /* real mode cache-inhibit */
- ulong force_ai: 1; /* Force alignment interrupt */
- ulong dis_pref: 1; /* disable prefetching */
- ulong res_pref: 1; /* reset data prefetching mechanism */
- ulong en_sp_dtw: 1; /* enable speculative load tablewalk */
- ulong l1dc_flsh: 1; /* L1 cache flash invalidate */
- ulong dis_derpc: 2; /* Disable d-ERAT parity checking */
- ulong dis_derpg: 1; /* Disable d-ERAT parity generation */
- ulong dis_derat: 2; /* Disable d-ERAT */
- ulong dis_dctpc: 2; /* Dis data cache tag paritiy checking */
- ulong dis_dctpg: 1; /* Dis data cache tag paritiy generation */
- ulong dis_dcset: 2; /* Disable data cache set */
- ulong dis_dcpc: 2; /* Disable data cache paritiy checking */
- ulong dis_dcpg: 1; /* Disable data cache paritiy generation */
- ulong dis_dcrtpc: 2; /* Disable data cache real add tag parity */
- ulong dis_tlbpc: 4; /* Disable TLB paritiy checking */
- ulong dis_tlbpg: 1; /* Disable TLB paritiy generation */
- ulong dis_tlbset: 4; /* Disable TLB set */
- ulong dis_slbpc: 1; /* Disable SLB paritiy checking */
- ulong dis_slbpg: 1; /* Disable SLB paritiy generation */
- ulong mck_inj: 1; /* Machine check inject enable */
- ulong dis_stfwd: 1; /* Disbale store forwarding */
- ulong lpes_1: 1; /* LPAR Environment Selector bit 1 */
- ulong rmlr_0: 1; /* RMLR 0 */
- ulong _reserved: 1;
- ulong dis_splarx: 1; /* Disable spec. lwarx/ldarx */
- ulong lg_pg_dis: 1; /* Disable large page support */
- ulong lpid_0_1: 2; /* LPAR ID bits 0:1 */
- } bits;
- ulong word;
-};
-
-union hid5 {
- struct hid5_bits {
- ulong _reserved_0_31: 32;
- ulong hrmor_0_15: 16;
- ulong _reserved_48_49: 2;
- ulong DC_mck: 1; /* Machine check enabled for dcache errors */
- ulong dis_pwrsave: 1; /* Dis pwrsave on on L1 and d-ERAT */
- ulong force_G: 1; /* Force gaurded load */
- ulong DC_repl: 1; /* D-Cache replacement algo */
- ulong hwr_stms: 1; /* Number of available HW prefetch streams */
- ulong dst_noop: 1; /* D-stream Touch no-op */
- ulong DCBZ_size: 1; /* make dcbz size 32 bytes */
- ulong DCBZ32_ill: 1; /* make dzbz 32byte illeagal */
- ulong tlb_map: 1; /* TLB mapping */
- ulong lmq_port: 1; /* Demand miss (LMQ to STS) */
- ulong lmq_size_0: 1; /* number of outstanding req. to STS */
- ulong _reserved_61: 1;
- ulong tch_nop: 1; /* make dcbtand dcbtst ack like no-ops */
- ulong lmq_size_1: 1; /* second bit to lmq_size_0 */
- } bits;
- ulong word;
-};
-
-#endif
diff --git a/xen/include/asm-powerpc/powerpc64/ppc970.h b/xen/include/asm-powerpc/powerpc64/ppc970.h
deleted file mode 100644
index 69c5063289..0000000000
--- a/xen/include/asm-powerpc/powerpc64/ppc970.h
+++ /dev/null
@@ -1,31 +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@us.ibm.com>
- */
-
-#ifndef _ASM_PPC970_H_
-#define _ASM_PPC970_H_
-
-#include <xen/types.h>
-#include <asm/powerpc64/ppc970-hid.h>
-
-struct cpu_vcpu {
- union hid4 hid4;
-};
-
-#endif
diff --git a/xen/include/asm-powerpc/powerpc64/procarea.h b/xen/include/asm-powerpc/powerpc64/procarea.h
deleted file mode 100644
index def6fe71e5..0000000000
--- a/xen/include/asm-powerpc/powerpc64/procarea.h
+++ /dev/null
@@ -1,38 +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@us.ibm.com>
- */
-
-#ifndef _ASM_PROCAREA_H_
-#define _ASM_PROCAREA_H_
-
-#include <xen/types.h>
-
-struct vcpu;
-struct gdb_state;
-
-struct processor_area
-{
- unsigned int whoami;
- unsigned int hard_id;
- struct vcpu *cur_vcpu;
- void *hyp_stack_base;
- ulong saved_regs[2];
-};
-
-#endif
diff --git a/xen/include/asm-powerpc/powerpc64/processor.h b/xen/include/asm-powerpc/powerpc64/processor.h
deleted file mode 100644
index b4135a19bc..0000000000
--- a/xen/include/asm-powerpc/powerpc64/processor.h
+++ /dev/null
@@ -1,228 +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@us.ibm.com>
- */
-
-#ifndef _ASM_64_PROCESSOR_H_
-#define _ASM_64_PROCESSOR_H_
-
-#ifdef __ASSEMBLY__
-
-#define LOADADDR(rn,name) \
- lis rn,name##@highest; \
- ori rn,rn,name##@higher; \
- rldicr rn,rn,32,31; \
- oris rn,rn,name##@h; \
- ori rn,rn,name##@l
-
-#define SET_REG_TO_CONST(reg, value) \
- lis reg,(((value)>>48)&0xFFFF); \
- ori reg,reg,(((value)>>32)&0xFFFF); \
- rldicr reg,reg,32,31; \
- oris reg,reg,(((value)>>16)&0xFFFF); \
- ori reg,reg,((value)&0xFFFF);
-
-#define SET_REG_TO_LABEL(reg, label) \
- lis reg,(label)@highest; \
- ori reg,reg,(label)@higher; \
- rldicr reg,reg,32,31; \
- oris reg,reg,(label)@h; \
- ori reg,reg,(label)@l;
-
-#define XGLUE(a,b) a##b
-#define GLUE(a,b) XGLUE(a,b)
-
-#define _GLOBAL(name) \
- .section ".text"; \
- .align 2 ; \
- .globl name; \
- .globl GLUE(.,name); \
- .section ".opd","aw"; \
-name: \
- .quad GLUE(.,name); \
- .quad .TOC.@tocbase; \
- .quad 0; \
- .previous; \
- .type GLUE(.,name),@function; \
-GLUE(.,name):
-
-#define _STATIC(name) \
- .section ".text"; \
- .align 2 ; \
- .section ".opd","aw"; \
-name: \
- .quad GLUE(.,name); \
- .quad .TOC.@tocbase; \
- .quad 0; \
- .previous; \
- .type GLUE(.,name),@function; \
-GLUE(.,name):
-
-#define _ENTRY(name) GLUE(.,name)
-#else /* __ASSEMBLY__ */
-
-#include <xen/types.h>
-#include <asm/powerpc64/procarea.h>
-
-static inline void mtmsrd(ulong msr)
-{
- __asm__ __volatile__ ("mtmsrd %0" : : "r" (msr));
-}
-
-static inline unsigned long mftb(void)
-{
- unsigned long tb;
- __asm__ __volatile__ ("mftb %0" : "=r" (tb));
- return tb;
-}
-
-static inline void mttbl(unsigned low)
-{
- __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_TBWL), "r" (low));
-}
-
-static inline void mttbu(unsigned upper)
-{
- __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_TBWU), "r" (upper));
-}
-
-static inline void mthdec(unsigned ticks)
-{
- __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_HDEC), "r" (ticks));
-}
-
-static inline unsigned int mfhdec(void)
-{
- unsigned int val;
- __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_HDEC));
- return val;
-}
-
-static inline void mthsprg0(ulong val)
-{
- __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_HSPRG0), "r"(val));
-}
-static inline ulong mfhsprg0(void)
-{
- ulong val;
- __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_HSPRG0));
- return val;
-}
-
-static inline void slbia(void)
-{
- __asm__ __volatile__ ("isync; slbia; isync":::"memory");
-}
-
-static inline void slbie(ulong entry)
-{
- __asm__ __volatile__ (
- "isync\n"
- "slbie %0\n"
- "isync\n"
- : : "r" (entry) : "memory");
-}
-
-static inline ulong mfhid0(void)
-{
- ulong val;
- __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_HID0));
- return val;
-}
-static inline void mthid0(ulong val)
-{
- __asm__ __volatile__ (
- "sync\n"
- "mtspr %0, %1\n"
- "mfspr %1, %0\n"
- "mfspr %1, %0\n"
- "mfspr %1, %0\n"
- "mfspr %1, %0\n"
- "mfspr %1, %0\n"
- "isync\n"
- : : "i"(SPRN_HID0), "r"(val));
-}
-
-static inline ulong mfhid1(void)
-{
- ulong val;
- __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_HID1));
- return val;
-}
-static inline void mthid1(ulong val)
-{
- __asm__ __volatile__ (
- "sync\n"
- "mtspr %0, %1\n"
- "mtspr %0, %1\n"
- "isync\n"
- : : "i"(SPRN_HID1), "r"(val));
-}
-
-static inline ulong mfhid4(void)
-{
- ulong hid4;
- __asm__ __volatile__ ("mfspr %0, %1" : "=r"(hid4) : "i"(SPRN_HID4));
- return hid4;
-}
-
-static inline void mthid4(ulong hid4)
-{
- __asm__ __volatile__ (
- "sync\n"
- "mtspr %0, %1\n"
- "isync\n"
- : : "i"(SPRN_HID4), "r"(hid4));
-}
-
-static inline ulong mfhid5(void)
-{
- ulong val;
- __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_HID5));
- return val;
-}
-
-static inline void mthid5(ulong val)
-{
- __asm__ __volatile__ (
- "sync\n"
- "mtspr %0, %1\n"
- "isync\n"
- : : "i"(SPRN_HID5), "r"(val));
-}
-
-static inline void mthrmor(ulong val)
-{
- __asm__ __volatile__ (
- "sync\n"
- "mtspr %0, %1\n"
- "isync\n"
- : : "i"(SPRN_HRMOR), "r"(val));
-}
-
-static inline void mthior(ulong val)
-{
- __asm__ __volatile__ (
- "sync\n"
- "mtspr %0, %1\n"
- "isync\n"
- : : "i"(SPRN_HIOR), "r"(val));
-}
-
-#endif /* __ASSEMBLY__ */
-#endif
diff --git a/xen/include/asm-powerpc/powerpc64/string.h b/xen/include/asm-powerpc/powerpc64/string.h
deleted file mode 100644
index 3c3876b2fd..0000000000
--- a/xen/include/asm-powerpc/powerpc64/string.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* from linux/include/asm-powerpc/string.h */
-
-#ifndef _PPC64_STRING_H_
-#define _PPC64_STRING_H_
-
-#include <xen/types.h>
-
-/*
- * 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.
- */
-
-#define __HAVE_ARCH_STRCPY
-#define __HAVE_ARCH_STRNCPY
-#define __HAVE_ARCH_STRLEN
-#define __HAVE_ARCH_STRCMP
-#define __HAVE_ARCH_STRCAT
-#define __HAVE_ARCH_MEMSET
-#define __HAVE_ARCH_MEMCPY
-#define __HAVE_ARCH_MEMMOVE
-#define __HAVE_ARCH_MEMCMP
-#define __HAVE_ARCH_MEMCHR
-
-extern int strcasecmp(const char *, const char *);
-extern int strncasecmp(const char *, const char *, int);
-extern char * strcpy(char *,const char *);
-extern char * strncpy(char *,const char *, __kernel_size_t);
-extern __kernel_size_t strlen(const char *);
-extern int strcmp(const char *,const char *);
-extern char * strcat(char *, const char *);
-extern void * memset(void *,int,__kernel_size_t);
-extern void * memcpy(void *,const void *,__kernel_size_t);
-extern void * memmove(void *,const void *,__kernel_size_t);
-extern int memcmp(const void *,const void *,__kernel_size_t);
-extern void * memchr(const void *,int,__kernel_size_t);
-
-extern void *systemsim_memset(void *, int, ulong);
-extern void *systemsim_memcpy(void *, const void *, ulong);
-
-#endif
diff --git a/xen/include/asm-powerpc/processor.h b/xen/include/asm-powerpc/processor.h
deleted file mode 100644
index 152ba504ac..0000000000
--- a/xen/include/asm-powerpc/processor.h
+++ /dev/null
@@ -1,429 +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@us.ibm.com>
- * Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
- */
-
-#ifndef _ASM_PROCESSOR_H_
-#define _ASM_PROCESSOR_H_
-
-#include <xen/config.h>
-#include <asm/reg_defs.h>
-#include <asm/msr.h>
-
-#define IOBMP_BYTES 8192
-#define IOBMP_INVALID_OFFSET 0x8000
-
-/* most assembler do not know this instruction */
-#define HRFID .long 0x4c000224
-
-/* Processor Version Register (PVR) field extraction */
-
-#define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */
-#define PVR_REV(pvr) (((pvr) >> 0) & 0xFFFF) /* Revison field */
-
-#define __is_processor(pv) (PVR_VER(mfspr(SPRN_PVR)) == (pv))
-
-/*
- * IBM has further subdivided the standard PowerPC 16-bit version and
- * revision subfields of the PVR for the PowerPC 403s into the following:
- */
-
-#define PVR_FAM(pvr) (((pvr) >> 20) & 0xFFF) /* Family field */
-#define PVR_MEM(pvr) (((pvr) >> 16) & 0xF) /* Member field */
-#define PVR_CORE(pvr) (((pvr) >> 12) & 0xF) /* Core field */
-#define PVR_CFG(pvr) (((pvr) >> 8) & 0xF) /* Configuration field */
-#define PVR_MAJ(pvr) (((pvr) >> 4) & 0xF) /* Major revision field */
-#define PVR_MIN(pvr) (((pvr) >> 0) & 0xF) /* Minor revision field */
-
-/* Processor Version Numbers */
-
-#define PVR_403GA 0x00200000
-#define PVR_403GB 0x00200100
-#define PVR_403GC 0x00200200
-#define PVR_403GCX 0x00201400
-#define PVR_405GP 0x40110000
-#define PVR_STB03XXX 0x40310000
-#define PVR_NP405H 0x41410000
-#define PVR_NP405L 0x41610000
-#define PVR_601 0x00010000
-#define PVR_602 0x00050000
-#define PVR_603 0x00030000
-#define PVR_603e 0x00060000
-#define PVR_603ev 0x00070000
-#define PVR_603r 0x00071000
-#define PVR_604 0x00040000
-#define PVR_604e 0x00090000
-#define PVR_604r 0x000A0000
-#define PVR_620 0x00140000
-#define PVR_740 0x00080000
-#define PVR_750 PVR_740
-#define PVR_740P 0x10080000
-#define PVR_750P PVR_740P
-#define PVR_7400 0x000C0000
-#define PVR_7410 0x800C0000
-#define PVR_7450 0x80000000
-#define PVR_8540 0x80200000
-#define PVR_8560 0x80200000
-/*
- * For the 8xx processors, all of them report the same PVR family for
- * the PowerPC core. The various versions of these processors must be
- * differentiated by the version number in the Communication Processor
- * Module (CPM).
- */
-#define PVR_821 0x00500000
-#define PVR_823 PVR_821
-#define PVR_850 PVR_821
-#define PVR_860 PVR_821
-#define PVR_8240 0x00810100
-#define PVR_8245 0x80811014
-#define PVR_8260 PVR_8240
-
-/* 64-bit processors */
-/* XXX the prefix should be PVR_, we'll do a global sweep to fix it one day */
-#define PV_NORTHSTAR 0x0033
-#define PV_PULSAR 0x0034
-#define PV_POWER4 0x0035
-#define PV_ICESTAR 0x0036
-#define PV_SSTAR 0x0037
-#define PV_POWER4p 0x0038
-#define PV_970 0x0039
-#define PV_POWER5 0x003A
-#define PV_POWER5p 0x003B
-#define PV_970FX 0x003C
-#define PV_630 0x0040
-#define PV_630p 0x0041
-#define PV_970MP 0x0044
-#define PV_BE 0x0070
-
-#ifndef __ASSEMBLY__
-#include <xen/types.h>
-
-struct domain;
-struct vcpu;
-struct cpu_user_regs;
-extern int cpu_machinecheck(struct cpu_user_regs *);
-extern void show_registers(struct cpu_user_regs *);
-extern unsigned int cpu_extent_order(void);
-extern unsigned int cpu_default_rma_order_pages(void);
-extern int cpu_rma_valid(unsigned int order);
-extern uint cpu_large_page_orders(uint *sizes, uint max);
-extern void cpu_initialize(int cpuid);
-extern void cpu_init_vcpu(struct vcpu *);
-extern int cpu_threads(int cpuid);
-extern void save_cpu_sprs(struct vcpu *);
-extern void load_cpu_sprs(struct vcpu *);
-extern void flush_segments(void);
-extern void dump_segments(int valid);
-
-#define ARCH_HAS_PREFETCH
-static inline void prefetch(const void *x) {;}
-
-static __inline__ void sync(void)
-{
- __asm__ __volatile__ ("sync");
-}
-
-static __inline__ void isync(void)
-{
- __asm__ __volatile__ ("isync");
-}
-
-static inline ulong mfmsr(void) {
- ulong msr;
- __asm__ __volatile__ ("mfmsr %0" : "=&r"(msr));
- return msr;
-}
-
-static inline void nop(void) {
- __asm__ __volatile__ ("nop");
-}
-/* will need to address thread priorities when we go SMT */
-#define cpu_relax() barrier()
-
-static inline unsigned int mfpir(void)
-{
- unsigned int pir;
- __asm__ __volatile__ ("mfspr %0, %1" : "=r" (pir): "i"(SPRN_PIR));
- return pir;
-}
-
-static inline unsigned int mftbu(void)
-{
- unsigned int tbu;
- __asm__ __volatile__ ("mftbu %0" : "=r" (tbu));
- return tbu;
-}
-
-static inline unsigned int mftbl(void)
-{
- unsigned int tbl;
- __asm__ __volatile__ ("mftbl %0" : "=r" (tbl));
- return tbl;
-}
-
-static inline unsigned int mfdec(void)
-{
- unsigned int tmp;
- __asm__ __volatile__ ("mfdec %0" : "=r"(tmp));
- return tmp;
-}
-static inline void mtdec(unsigned int ticks)
-{
- __asm__ __volatile__ ("mtdec %0" : : "r" (ticks));
-}
-
-static inline u32 mfpvr(void) {
- u32 pvr;
- asm volatile("mfpvr %0" : "=&r" (pvr));
- return pvr;
-}
-
-static inline ulong mfr1(void)
-{
- ulong r1;
- asm volatile("mr %0, 1" : "=&r" (r1));
- return r1;
-}
-
-static inline void mtmmcr0(ulong val)
-{
- asm volatile ("mtspr %0, %1" : : "i"(SPRN_MMCR0), "r"(val));
-}
-static inline ulong mfmmcr0(void)
-{
- ulong rval;
- asm volatile ("mfspr %0, %1" : "=r"(rval) : "i"(SPRN_MMCR0));
- return rval;
-}
-
-static inline void mtmmcr1(ulong val)
-{
- asm volatile ("mtspr %0, %1" : : "i"(SPRN_MMCR1), "r"(val));
-}
-static inline ulong mfmmcr1(void)
-{
- ulong rval;
- asm volatile ("mfspr %0, %1" : "=r"(rval) : "i"(SPRN_MMCR1));
- return rval;
-}
-
-static inline void mtmmcra(ulong val)
-{
- asm volatile ("mtspr %0, %1" : : "i"(SPRN_MMCRA), "r"(val));
-}
-static inline ulong mfmmcra(void)
-{
- ulong rval;
- asm volatile ("mfspr %0, %1" : "=r"(rval) : "i"(SPRN_MMCRA));
- return rval;
-}
-
-static inline void mtpmc1(ulong val)
-{
- asm volatile ("mtspr %0, %1" : : "i"(SPRN_PMC1), "r"(val));
-}
-static inline ulong mfpmc1(void)
-{
- ulong rval;
- asm volatile ("mfspr %0, %1" : "=r"(rval) : "i"(SPRN_PMC1));
- return rval;
-}
-
-static inline void mtpmc2(ulong val)
-{
- asm volatile ("mtspr %0, %1" : : "i"(SPRN_PMC2), "r"(val));
-}
-static inline ulong mfpmc2(void)
-{
- ulong rval;
- asm volatile ("mfspr %0, %1" : "=r"(rval) : "i"(SPRN_PMC2));
- return rval;
-}
-
-static inline void mtpmc3(ulong val)
-{
- asm volatile ("mtspr %0, %1" : : "i"(SPRN_PMC3), "r"(val));
-}
-static inline ulong mfpmc3(void)
-{
- ulong rval;
- asm volatile ("mfspr %0, %1" : "=r"(rval) : "i"(SPRN_PMC3));
- return rval;
-}
-
-static inline void mtpmc4(ulong val)
-{
- asm volatile ("mtspr %0, %1" : : "i"(SPRN_PMC4), "r"(val));
-}
-static inline ulong mfpmc4(void)
-{
- ulong rval;
- asm volatile ("mfspr %0, %1" : "=r"(rval) : "i"(SPRN_PMC4));
- return rval;
-}
-
-static inline void mtpmc5(ulong val)
-{
- asm volatile ("mtspr %0, %1" : : "i"(SPRN_PMC5), "r"(val));
-}
-static inline ulong mfpmc5(void)
-{
- ulong rval;
- asm volatile ("mfspr %0, %1" : "=r"(rval) : "i"(SPRN_PMC5));
- return rval;
-}
-
-static inline void mtpmc6(ulong val)
-{
- asm volatile ("mtspr %0, %1" : : "i"(SPRN_PMC6), "r"(val));
-}
-static inline ulong mfpmc6(void)
-{
- ulong rval;
- asm volatile ("mfspr %0, %1" : "=r"(rval) : "i"(SPRN_PMC6));
- return rval;
-}
-
-static inline void mtpmc7(ulong val)
-{
- asm volatile ("mtspr %0, %1" : : "i"(SPRN_PMC7), "r"(val));
-}
-static inline ulong mfpmc7(void)
-{
- ulong rval;
- asm volatile ("mfspr %0, %1" : "=r"(rval) : "i"(SPRN_PMC7));
- return rval;
-}
-
-static inline void mtpmc8(ulong val)
-{
- asm volatile ("mtspr %0, %1" : : "i"(SPRN_PMC8), "r"(val));
-}
-static inline ulong mfpmc8(void)
-{
- ulong rval;
- asm volatile ("mfspr %0, %1" : "=r"(rval) : "i"(SPRN_PMC8));
- return rval;
-}
-
-static inline ulong mfsdar(void)
-{
- ulong rval;
- asm volatile ("mfspr %0, %1" : "=r"(rval) : "i"(SPRN_SDAR));
- return rval;
-}
-
-static inline ulong mfsiar(void)
-{
- ulong rval;
- asm volatile ("mfspr %0, %1" : "=r"(rval) : "i"(SPRN_SIAR));
- return rval;
-}
-
-static inline void mtsprg0(ulong val)
-{
- __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_SPRG0), "r"(val));
-}
-static inline ulong mfsprg0(void)
-{
- ulong val;
- __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_SPRG0));
- return val;
-}
-
-static inline void mtsprg1(ulong val)
-{
- __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_SPRG1), "r"(val));
-}
-static inline ulong mfsprg1(void)
-{
- ulong val;
- __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_SPRG1));
- return val;
-}
-
-static inline void mtsprg2(ulong val)
-{
- __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_SPRG2), "r"(val));
-}
-static inline ulong mfsprg2(void)
-{
- ulong val;
- __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_SPRG2));
- return val;
-}
-
-static inline void mtsprg3(ulong val)
-{
- __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_SPRG3), "r"(val));
-}
-static inline ulong mfsprg3(void)
-{
- ulong val;
- __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_SPRG3));
- return val;
-}
-
-static inline void mtsdr1(ulong val)
-{
- __asm__ __volatile__ ("mtsdr1 %0" : : "r"(val));
-}
-static inline ulong mfsdr1(void)
-{
- ulong val;
- __asm__ __volatile__ ("mfsdr1 %0" : "=r"(val));
- return val;
-}
-
-static inline void mtdar(ulong val)
-{
- __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_DAR), "r"(val));
-}
-static inline ulong mfdar(void)
-{
- ulong val;
- __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_DAR));
- return val;
-}
-
-static inline void mtdsisr(ulong val)
-{
- __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_DSISR), "r"(val));
-}
-static inline unsigned mfdsisr(void)
-{
- unsigned val;
- __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_DSISR));
- return val;
-}
-
-#ifdef CONFIG_SYSTEMSIM
-static inline int on_systemsim(void)
-{
- return !!(mfmsr() & MSR_SYSTEMSIM);
-}
-#else /* CONFIG_SYSTEMSIM */
-static inline int on_systemsim(void) { return 0; }
-#endif
-
-#endif /* __ASSEMBLY__ */
-
-#include <asm/powerpc64/processor.h>
-
-#endif
diff --git a/xen/include/asm-powerpc/reg_defs.h b/xen/include/asm-powerpc/reg_defs.h
deleted file mode 100644
index f72e1591c4..0000000000
--- a/xen/include/asm-powerpc/reg_defs.h
+++ /dev/null
@@ -1,210 +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@watson.ibm.com>
- * Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
- */
-
-#ifndef _ASM_REG_DEFS_H_
-#define _ASM_REG_DEFS_H_
-
-#ifdef __ASSEMBLY__
-/* Condition Register Bit Fields */
-
-#define cr0 0
-#define cr1 1
-#define cr2 2
-#define cr3 3
-#define cr4 4
-#define cr5 5
-#define cr6 6
-#define cr7 7
-
-
-/* General Purpose Registers (GPRs) */
-
-#define r0 0
-#define r1 1
-#define r2 2
-#define r3 3
-#define r4 4
-#define r5 5
-#define r6 6
-#define r7 7
-#define r8 8
-#define r9 9
-#define r10 10
-#define r11 11
-#define r12 12
-#define r13 13
-#define r14 14
-#define r15 15
-#define r16 16
-#define r17 17
-#define r18 18
-#define r19 19
-#define r20 20
-#define r21 21
-#define r22 22
-#define r23 23
-#define r24 24
-#define r25 25
-#define r26 26
-#define r27 27
-#define r28 28
-#define r29 29
-#define r30 30
-#define r31 31
-
-/* Floating Point Registers (FPRs) */
-#define fr0 0
-#define fr1 1
-#define fr2 2
-#define fr3 3
-#define fr4 4
-#define fr5 5
-#define fr6 6
-#define fr7 7
-#define fr8 8
-#define fr9 9
-#define fr10 10
-#define fr11 11
-#define fr12 12
-#define fr13 13
-#define fr14 14
-#define fr15 15
-#define fr16 16
-#define fr17 17
-#define fr18 18
-#define fr19 19
-#define fr20 20
-#define fr21 21
-#define fr22 22
-#define fr23 23
-#define fr24 24
-#define fr25 25
-#define fr26 26
-#define fr27 27
-#define fr28 28
-#define fr29 29
-#define fr30 30
-#define fr31 31
-
-/* Vector Registers (FPRs) */
-#define vr0 0
-#define vr1 1
-#define vr2 2
-#define vr3 3
-#define vr4 4
-#define vr5 5
-#define vr6 6
-#define vr7 7
-#define vr8 8
-#define vr9 9
-#define vr10 10
-#define vr11 11
-#define vr12 12
-#define vr13 13
-#define vr14 14
-#define vr15 15
-#define vr16 16
-#define vr17 17
-#define vr18 18
-#define vr19 19
-#define vr20 20
-#define vr21 21
-#define vr22 22
-#define vr23 23
-#define vr24 24
-#define vr25 25
-#define vr26 26
-#define vr27 27
-#define vr28 28
-#define vr29 29
-#define vr30 30
-#define vr31 31
-
-#endif
-
-/* Special Purpose Registers */
-#define SPRN_VRSAVE 256
-#define SPRN_DSISR 18
-#define SPRN_DAR 19
-#define SPRN_DEC 22
-#define SPRN_SRR0 26
-#define SPRN_SRR1 27
-#define SPRN_TBRL 268
-#define SPRN_TBRU 269
-#define SPRN_SPRG0 272
-#define SPRN_SPRG1 273
-#define SPRN_SPRG2 274
-#define SPRN_SPRG3 275
-#define SPRN_TBWL 284
-#define SPRN_TBWU 285
-
-#define SPRN_HSPRG0 304
-#define SPRN_HSPRG1 305
-#define SPRN_HDEC 310
-#define SPRN_HIOR 311
-#define SPRN_RMOR 312
-#define SPRN_HRMOR 313
-#define SPRN_HSRR0 314
-#define SPRN_HSRR1 315
-#define SPRN_LPCR 318
-#define SPRN_LPIDR 319
-
-/* Performance monitor spr encodings */
-#define SPRN_MMCRA 786
-#define MMCRA_SAMPHV UL(0x10000000) /* state of MSR HV when SIAR set */
-#define MMCRA_SAMPPR UL(0x08000000) /* state of MSR PR when SIAR set */
-#define MMCRA_SAMPLE_ENABLE UL(0x00000001) /* enable sampling */
-#define NUM_PMCS 8
-#define SPRN_PMC1 787
-#define SPRN_PMC2 788
-#define SPRN_PMC3 789
-#define SPRN_PMC4 790
-#define SPRN_PMC5 791
-#define SPRN_PMC6 792
-#define SPRN_PMC7 793
-#define SPRN_PMC8 794
-#define SPRN_MMCR0 795
-#define MMCR0_FC UL(0x80000000) /* freeze counters */
-#define MMCR0_FCS UL(0x40000000) /* freeze in supervisor state */
-#define MMCR0_FCP UL(0x20000000) /* freeze in problem state */
-#define MMCR0_FCM1 UL(0x10000000) /* freeze counters while MSR mark = 1 */
-#define MMCR0_FCM0 UL(0x08000000) /* freeze counters while MSR mark = 0 */
-#define MMCR0_PMAE UL(0x04000000) /* performance monitor alert enabled */
-#define MMCR0_PMAO UL(0x00000080) /* performance monitor alert occurred */
-#define MMCR0_FCH UL(0x00000001) /* freeze conditions in hypervisor */
-#define SPRN_SIAR 796
-#define SPRN_SDAR 797
-#define SPRN_MMCR1 798
-
-/* As defined for PU G4 */
-#define SPRN_HID0 1008
-#define SPRN_HID1 1009
-#define SPRN_HID4 1012
-
-#define SPRN_DABR 1013
-#define SPRN_HID5 1014
-#define SPRN_DABRX 1015
-#define SPRN_HID6 1017
-#define SPRN_HID7 1018
-#define SPRN_HID8 1019
-#define SPRN_PIR 1023
-
-#endif /* _ASM_REG_DEFS_H_ */
diff --git a/xen/include/asm-powerpc/regs.h b/xen/include/asm-powerpc/regs.h
deleted file mode 100644
index 16f0ba9cd0..0000000000
--- a/xen/include/asm-powerpc/regs.h
+++ /dev/null
@@ -1,25 +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@us.ibm.com>
- */
-
-#ifndef _ASM_REGS_H_
-#define _ASM_REGS_H_
-
-#include <asm/processor.h>
-#endif
diff --git a/xen/include/asm-powerpc/shadow.h b/xen/include/asm-powerpc/shadow.h
deleted file mode 100644
index 28b141585e..0000000000
--- a/xen/include/asm-powerpc/shadow.h
+++ /dev/null
@@ -1,52 +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@us.ibm.com>
- * Ryan Harper <ryanh@us.ibm.com>
- */
-
-#ifndef _ASM_SHADOW_H_
-#define _ASM_SHADOW_H_
-
-#include <xen/sched.h>
-
-#define shadow_mode_translate(_d) (1)
-#define shadow_mode_refcounts(_d) (1)
-
-#define __mfn_to_gpfn(_d, mfn) \
- ( (shadow_mode_translate(_d)) \
- ? machine_to_phys_mapping[(mfn)] \
- : (mfn) )
-
-extern void shadow_drop_references(
- struct domain *d, struct page_info *page);
-
-extern int shadow_domctl(struct domain *d,
- xen_domctl_shadow_op_t *sc,
- XEN_GUEST_HANDLE(xen_domctl_t) u_domctl);
-extern unsigned int shadow_teardown(struct domain *d);
-extern unsigned int shadow_set_allocation(
- struct domain *d, unsigned int megabytes, int *preempted);
-
-/* Return the size of the shadow2 pool, rounded up to the nearest MB */
-static inline unsigned int shadow_get_allocation(struct domain *d)
-{
- return (1ULL << (d->arch.htab.order + PAGE_SHIFT)) >> 20;
-}
-
-#endif
-
diff --git a/xen/include/asm-powerpc/shared.h b/xen/include/asm-powerpc/shared.h
deleted file mode 100644
index 4f1ebb2a5d..0000000000
--- a/xen/include/asm-powerpc/shared.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __XEN_ASM_SHARED_H__
-#define __XEN_ASM_SHARED_H__
-
-#endif /* __XEN_ASM_SHARED_H__ */
diff --git a/xen/include/asm-powerpc/smp.h b/xen/include/asm-powerpc/smp.h
deleted file mode 100644
index 648501fbd1..0000000000
--- a/xen/include/asm-powerpc/smp.h
+++ /dev/null
@@ -1,60 +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@us.ibm.com>
- */
-
-#ifndef _ASM_SMP_H
-#define _ASM_SMP_H
-
-#include <xen/types.h>
-#include <xen/cpumask.h>
-#include <xen/init.h>
-#include <asm/current.h>
-
-/* crap to make x86 "common code" happy */
-#define BAD_APICID 0xFFu
-extern u8 x86_cpu_to_apicid[];
-
-
-extern int smp_num_siblings;
-
-/* revisit when we support SMP */
-#define raw_smp_processor_id() (parea->whoami)
-#define get_hard_smp_processor_id(i) (global_cpu_table[i]->hard_id)
-#define hard_smp_processor_id() (parea->hard_id)
-extern cpumask_t cpu_sibling_map[];
-extern cpumask_t cpu_core_map[];
-extern void __devinit smp_generic_take_timebase(void);
-extern void __devinit smp_generic_give_timebase(void);
-
-#define SA_INTERRUPT 0x20000000u
-typedef int irqreturn_t;
-extern int request_irq(unsigned int irq,
- irqreturn_t (*handler)(int, void *, struct cpu_user_regs *),
- unsigned long irqflags, const char * devname, void *dev_id);
-void smp_message_recv(int msg, struct cpu_user_regs *regs);
-void smp_call_function_interrupt(struct cpu_user_regs *regs);
-void smp_event_check_interrupt(void);
-void send_IPI_mask(cpumask_t mask, int vector);
-
-#undef DEBUG_IPI
-#ifdef DEBUG_IPI
-void ipi_torture_test(void);
-#endif
-
-#endif
diff --git a/xen/include/asm-powerpc/softirq.h b/xen/include/asm-powerpc/softirq.h
deleted file mode 100644
index 3444d300c0..0000000000
--- a/xen/include/asm-powerpc/softirq.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __ASM_SOFTIRQ_H__
-#define __ASM_SOFTIRQ_H__
-
-#define NR_ARCH_SOFTIRQS 0
-
-#endif /* __ASM_SOFTIRQ_H__ */
diff --git a/xen/include/asm-powerpc/spinlock.h b/xen/include/asm-powerpc/spinlock.h
deleted file mode 100644
index a6dc16c82e..0000000000
--- a/xen/include/asm-powerpc/spinlock.h
+++ /dev/null
@@ -1,218 +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@us.ibm.com>
- */
-
-#ifndef _ASM_SPINLOCK_H
-#define _ASM_SPINLOCK_H
-
-#include <xen/types.h>
-#include <xen/smp.h>
-#include <asm/atomic.h>
-
-static inline void
-sync_after_acquire(void)
-{
- __asm__ __volatile__ ("isync" : : : "memory");
-}
-
-static inline void
-sync_before_release(void)
-{
- __asm__ __volatile__ ("sync" : : : "memory");
-}
-
-/*
- * CAS : Compare and Store 32bits.. works for everyone
- *
- * NOTE: The ptr parameters to these routines are cast to character pointers
- * in order to prevent any strict-aliasing optimizations the compiler
- * might otherwise attempt.
- */
-static inline u32
-cas_u32(volatile u32 *ptr, u32 oval, u32 nval)
-{
- u32 tmp;
-
- sync_before_release();
- __asm__ ("\n"
- "# cas_u32 \n"
- "1: lwarx %1,0,%4 # tmp = (*ptr) [linked] \n"
- " cmplw %1,%2 # if (tmp != oval) \n"
- " bne- 2f # goto failure \n"
- " stwcx. %3,0,%4 # (*ptr) = nval [conditional] \n"
- " bne- 1b # if (store failed) retry \n"
- " li %1,1 # tmp = SUCCESS \n"
- " b $+8 # goto end \n"
- "2: li %1,0 # tmp = FAILURE \n"
- "# end cas_u32 \n"
- : "=m" (*(volatile char *)ptr), "=&r" (tmp)
- : "r" (oval), "r" (nval), "r" (ptr), "m" (*(volatile char*)ptr)
- : "cc"
- );
- sync_after_acquire();
-
- return tmp;
-}
-
-typedef struct {
- volatile u32 lock;
- s16 recurse_cpu;
- u16 recurse_cnt;
-} spinlock_t;
-
-#define __UNLOCKED (0U)
-#define __LOCKED (~__UNLOCKED)
-#define SPIN_LOCK_UNLOCKED /*(spinlock_t)*/ { __UNLOCKED, -1, 0 }
-static inline void spin_lock_init(spinlock_t *lock)
-{
- *lock = (spinlock_t) SPIN_LOCK_UNLOCKED;
-}
-
-static inline int spin_is_locked(spinlock_t *lock)
-{
- return lock->lock != __UNLOCKED;
-}
-
-static inline void _raw_spin_lock(spinlock_t *lock)
-{
- while (!cas_u32(&lock->lock, __UNLOCKED, __LOCKED)) {
- continue;
- }
- sync_after_acquire();
-}
-
-static inline void _raw_spin_unlock(spinlock_t *lock)
-{
- sync_before_release();
- *lock = (spinlock_t) SPIN_LOCK_UNLOCKED;
-}
-
-static inline int _raw_spin_trylock(spinlock_t *lock)
-{
- int ret = 0;
-
- if (cas_u32(&lock->lock, __UNLOCKED, __LOCKED)) {
- ret = 1;
- }
- sync_after_acquire();
- return ret;
-}
-
-typedef struct {
- volatile unsigned int lock;
-} rwlock_t;
-
-#define RW_LOCK_UNLOCKED /*(rwlock_t)*/ { __UNLOCKED }
-static inline void rwlock_init(rwlock_t *lock)
-{
- *lock = (rwlock_t) RW_LOCK_UNLOCKED;
-}
-
-static inline void _raw_read_lock(rwlock_t *lock)
-{
- u32 val;
-
- /* Lock is acquired if we can increment lower 31 bits, while
- * uppermost bit is 0. */
- do {
- val = lock->lock & ((1UL << 31) - 1);
- } while (!cas_u32(&lock->lock, val, val + 1));
- sync_after_acquire();
-}
-
-static inline void _raw_write_lock(rwlock_t *lock)
-{
- /* Lock is acquired if we can set 32nd bit, while all other
- * bits are 0 */
- while (!cas_u32(&lock->lock, 0, 1 << 31)) {
- continue;
- }
- sync_after_acquire();
-}
-
-static inline void _raw_write_unlock(rwlock_t *lock)
-{
- sync_before_release();
- *lock = (rwlock_t) RW_LOCK_UNLOCKED;
-}
-
-static inline void _raw_read_unlock(rwlock_t *lock)
-{
- u32 val;
-
- /* We want to decrement the low-order 31-bits atomically */
- sync_before_release();
- do {
- val = lock->lock;
- } while (!cas_u32(&lock->lock, val, val - 1));
-
- /* necessary? */
- sync_after_acquire();
-}
-
-/*
- * spin_[un]lock_recursive(): Use these forms when the lock can (safely!) be
- * reentered recursively on the same CPU. All critical regions that may form
- * part of a recursively-nested set must be protected by these forms. If there
- * are any critical regions that cannot form part of such a set, they can use
- * standard spin_[un]lock().
- */
-
-#if 0
-static inline void _raw_spin_unlock_recursive(spinlock_t *lock)
-{
- int cpu = smp_processor_id();
- if (likely(lock->recurse_cpu != cpu)) {
- spin_lock(lock);
- lock->recurse_cpu = cpu;
- }
- lock->recurse_cnt++;
-}
-
-static inline void _raw_spin_unlock_recursive(spinlock_t *lock)
-{
- if (likely(--lock->recurse_cnt == 0)) {
- lock->recurse_cpu = -1;
- spin_unlock(lock);
- }
-}
-#else
-
-#define _raw_spin_lock_recursive(_lock) \
- do { \
- int cpu = smp_processor_id(); \
- if ( likely((_lock)->recurse_cpu != cpu) ) \
- { \
- spin_lock(_lock); \
- (_lock)->recurse_cpu = cpu; \
- } \
- (_lock)->recurse_cnt++; \
- } while ( 0 )
-
-#define _raw_spin_unlock_recursive(_lock) \
- do { \
- if ( likely(--(_lock)->recurse_cnt == 0) ) \
- { \
- (_lock)->recurse_cpu = -1; \
- spin_unlock(_lock); \
- } \
- } while ( 0 )
-#endif
-
-#endif
diff --git a/xen/include/asm-powerpc/string.h b/xen/include/asm-powerpc/string.h
deleted file mode 100644
index b70d53f38e..0000000000
--- a/xen/include/asm-powerpc/string.h
+++ /dev/null
@@ -1,26 +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@us.ibm.com>
- */
-
-#ifndef _PPC_STRING_H_
-#define _PPC_STRING_H_
-
-#include <asm/powerpc64/string.h>
-
-#endif /* _PPC_STRING_H_ */
diff --git a/xen/include/asm-powerpc/system.h b/xen/include/asm-powerpc/system.h
deleted file mode 100644
index c0f21c64d0..0000000000
--- a/xen/include/asm-powerpc/system.h
+++ /dev/null
@@ -1,247 +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@watson.ibm.com>
- */
-
-#ifndef _ASM_SYSTEM_H_
-#define _ASM_SYSTEM_H_
-
-#include <xen/config.h>
-#include <xen/lib.h>
-#include <asm/memory.h>
-#include <asm/time.h>
-#include <asm/processor.h>
-#include <asm/msr.h>
-
-#define xchg(ptr,x) \
-({ \
- __typeof__(*(ptr)) _x_ = (x); \
- (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \
-})
-
-static __inline__ unsigned long
-__xchg_u32(volatile int *m, unsigned long val)
-{
- unsigned long dummy;
-
- __asm__ __volatile__(
- EIEIO_ON_SMP
-"1: lwarx %0,0,%3 # __xchg_u32\n\
- stwcx. %2,0,%3\n\
-2: bne- 1b"
- ISYNC_ON_SMP
- : "=&r" (dummy), "=m" (*m)
- : "r" (val), "r" (m)
- : "cc", "memory");
-
- return (dummy);
-}
-
-static __inline__ unsigned long
-__xchg_u64(volatile long *m, unsigned long val)
-{
- unsigned long dummy;
-
- __asm__ __volatile__(
- EIEIO_ON_SMP
-"1: ldarx %0,0,%3 # __xchg_u64\n\
- stdcx. %2,0,%3\n\
-2: bne- 1b"
- ISYNC_ON_SMP
- : "=&r" (dummy), "=m" (*m)
- : "r" (val), "r" (m)
- : "cc", "memory");
-
- return (dummy);
-}
-
-/*
- * This function doesn't exist, so you'll get a linker error
- * if something tries to do an invalid xchg().
- */
-extern void __xchg_called_with_bad_pointer(void);
-
-static __inline__ unsigned long
-__xchg(volatile void *ptr, unsigned long x, int size)
-{
- switch (size) {
- case 4:
- return __xchg_u32(ptr, x);
- case 8:
- return __xchg_u64(ptr, x);
- }
- __xchg_called_with_bad_pointer();
- return x;
-}
-
-
-static __inline__ unsigned long
-__cmpxchg_u32(volatile int *p, int old, int new)
-{
- unsigned int prev;
-
- __asm__ __volatile__ (
- EIEIO_ON_SMP
-"1: lwarx %0,0,%2 # __cmpxchg_u32\n\
- cmpw 0,%0,%3\n\
- bne- 2f\n\
- stwcx. %4,0,%2\n\
- bne- 1b"
- ISYNC_ON_SMP
- "\n\
-2:"
- : "=&r" (prev), "=m" (*p)
- : "r" (p), "r" (old), "r" (new), "m" (*p)
- : "cc", "memory");
-
- return prev;
-}
-
-static __inline__ unsigned long
-__cmpxchg_u64(volatile long *p, unsigned long old, unsigned long new)
-{
- unsigned long prev;
-
- __asm__ __volatile__ (
- EIEIO_ON_SMP
-"1: ldarx %0,0,%2 # __cmpxchg_u64\n\
- cmpd 0,%0,%3\n\
- bne- 2f\n\
- stdcx. %4,0,%2\n\
- bne- 1b"
- ISYNC_ON_SMP
- "\n\
-2:"
- : "=&r" (prev), "=m" (*p)
- : "r" (p), "r" (old), "r" (new), "m" (*p)
- : "cc", "memory");
-
- return prev;
-}
-
-/* This function doesn't exist, so you'll get a linker error
- if something tries to do an invalid cmpxchg(). */
-extern void __cmpxchg_called_with_bad_pointer(void);
-
-static always_inline unsigned long
-__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
-{
- switch (size) {
- case 2:
- BUG(); return 0; /* XXX implement __cmpxchg_u16 ? */
- case 4:
- return __cmpxchg_u32(ptr, old, new);
- case 8:
- return __cmpxchg_u64(ptr, old, new);
- }
- __cmpxchg_called_with_bad_pointer();
- return old;
-}
-
-#define cmpxchg_user(ptr,o,n) cmpxchg(ptr,o,n)
-
-#define cmpxchg(ptr,o,n) \
- ({ \
- __typeof__(*(ptr)) _o_ = (o); \
- __typeof__(*(ptr)) _n_ = (n); \
- (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
- (unsigned long)_n_, sizeof(*(ptr))); \
- })
-
-
-/*
- * Memory barrier.
- * The sync instruction guarantees that all memory accesses initiated
- * by this processor have been performed (with respect to all other
- * mechanisms that access memory). The eieio instruction is a barrier
- * providing an ordering (separately) for (a) cacheable stores and (b)
- * loads and stores to non-cacheable memory (e.g. I/O devices).
- *
- * mb() prevents loads and stores being reordered across this point.
- * rmb() prevents loads being reordered across this point.
- * wmb() prevents stores being reordered across this point.
- * read_barrier_depends() prevents data-dependent loads being reordered
- * across this point (nop on PPC).
- *
- * We have to use the sync instructions for mb(), since lwsync doesn't
- * order loads with respect to previous stores. Lwsync is fine for
- * rmb(), though.
- * For wmb(), we use sync since wmb is used in drivers to order
- * stores to system memory with respect to writes to the device.
- * However, smp_wmb() can be a lighter-weight eieio barrier on
- * SMP since it is only used to order updates to system memory.
- */
-#define mb() __asm__ __volatile__ ("sync" : : : "memory")
-#define rmb() __asm__ __volatile__ ("lwsync" : : : "memory")
-#define wmb() __asm__ __volatile__ ("sync" : : : "memory")
-#define read_barrier_depends() do { } while(0)
-
-#define set_mb(var, value) do { var = value; smp_mb(); } while (0)
-#define set_wmb(var, value) do { var = value; smp_wmb(); } while (0)
-
-#ifdef CONFIG_SMP
-#define smp_mb() mb()
-#define smp_rmb() rmb()
-#define smp_wmb() __asm__ __volatile__ ("eieio" : : : "memory")
-#define smp_read_barrier_depends() read_barrier_depends()
-#else
-#define smp_mb() __asm__ __volatile__("": : :"memory")
-#define smp_rmb() __asm__ __volatile__("": : :"memory")
-#define smp_wmb() __asm__ __volatile__("": : :"memory")
-#define smp_read_barrier_depends() do { } while(0)
-#endif /* CONFIG_SMP */
-
-#define local_save_flags(flags) ((flags) = mfmsr())
-#define local_irq_restore(flags) do { \
- __asm__ __volatile__("": : :"memory"); \
- mtmsrd((flags)); \
-} while(0)
-
-static inline void local_irq_disable(void)
-{
- unsigned long msr;
- msr = mfmsr();
- mtmsrd(msr & ~MSR_EE);
- __asm__ __volatile__("" : : : "memory");
-}
-
-static inline void local_irq_enable(void)
-{
- unsigned long msr;
- __asm__ __volatile__("" : : : "memory");
- msr = mfmsr();
- mtmsrd(msr | MSR_EE);
-}
-
-static inline void __do_save_and_cli(unsigned long *flags)
-{
- unsigned long msr;
- msr = mfmsr();
- *flags = msr;
- mtmsrd(msr & ~MSR_EE);
- __asm__ __volatile__("" : : : "memory");
-}
-
-#define local_irq_save(flags) __do_save_and_cli(&flags)
-
-static inline int local_irq_is_enabled(void)
-{
- return !!(mfmsr() & MSR_EE);
-}
-
-#endif
diff --git a/xen/include/asm-powerpc/time.h b/xen/include/asm-powerpc/time.h
deleted file mode 100644
index 8d8be263ef..0000000000
--- a/xen/include/asm-powerpc/time.h
+++ /dev/null
@@ -1,86 +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@us.ibm.com>
- * Jimi Xenidis <jimix@watson.ibm.com>
- */
-
-#ifndef _ASM_TIME_H_
-#define _ASM_TIME_H_
-
-#include <xen/types.h>
-#include <xen/time.h>
-#include <xen/percpu.h>
-#include <asm/processor.h>
-
-extern s64 timebase_freq;
-#define CLOCK_TICK_RATE timebase_freq
-
-#define watchdog_disable() ((void)0)
-#define watchdog_enable() ((void)0)
-
-static inline u64 get_timebase(void)
-{
- u64 s;
-
-#ifdef __PPC64__
- s = mftb();
-#else
- do {
- unsigned up;
- unsigned lo;
- unsigned up2;
-
- up = mftbu();
- lo = mftbl();
- up2 = mftbu();
- } while (up1 != up2);
- s = ((ulong)up << 32) | lo;
-#endif
- return s;
-}
-
-static inline void set_timebase(unsigned upper, unsigned lower)
-{
- mttbl(0);
- mttbu(upper);
- mttbl(lower);
-}
-
-typedef u64 cycles_t;
-static inline cycles_t get_cycles(void)
-{
- cycles_t c;
- c = get_timebase();
- return c;
-}
-
-#define __nano(s) ((s) * 1000000000ULL)
-
-static inline u64 ns_to_tb(u64 ns)
-{
- return (ns * timebase_freq) / __nano(1);
-}
-
-static inline u64 tb_to_ns(u64 tb)
-{
- return tb * (__nano(1) / timebase_freq);
-}
-
-#define wallclock_time() ((struct tm) { 0 })
-
-#endif
diff --git a/xen/include/asm-powerpc/trace.h b/xen/include/asm-powerpc/trace.h
deleted file mode 100644
index edef1bb099..0000000000
--- a/xen/include/asm-powerpc/trace.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __ASM_TRACE_H__
-#define __ASM_TRACE_H__
-
-#endif /* __ASM_TRACE_H__ */
diff --git a/xen/include/asm-powerpc/types.h b/xen/include/asm-powerpc/types.h
deleted file mode 100644
index 6af61881b5..0000000000
--- a/xen/include/asm-powerpc/types.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* from xen/include/asm-x86/types.h */
-
-#ifndef _PPC_TYPES_H
-#define _PPC_TYPES_H
-
-#include <xen/config.h>
-
-#if defined(__ppc__)
-#define BYTES_PER_LONG 4
-#define BITS_PER_LONG 32
-#elif defined(__PPC64__)
-#define BYTES_PER_LONG 8
-#define BITS_PER_LONG 64
-#endif
-
-#ifndef __ASSEMBLY__
-typedef unsigned short umode_t;
-
-/*
- * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
- * header files exported to user space
- */
-
-typedef __signed__ char __s8;
-typedef unsigned char __u8;
-
-typedef __signed__ short __s16;
-typedef unsigned short __u16;
-
-typedef __signed__ int __s32;
-typedef unsigned int __u32;
-
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-#if defined(__ppc__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
-
-#elif defined(__PPC64__)
-typedef __signed__ long __s64;
-typedef unsigned long __u64;
-#endif
-#endif
-
-typedef signed char s8;
-typedef unsigned char u8;
-
-typedef signed short s16;
-typedef unsigned short u16;
-
-typedef signed int s32;
-typedef unsigned int u32;
-
-#if defined(__ppc__)
-typedef signed long long s64;
-typedef unsigned long long u64;
-typedef unsigned int size_t;
-#elif defined(__PPC64__)
-typedef signed long s64;
-typedef unsigned long u64;
-typedef unsigned long size_t;
-#endif
-
-typedef unsigned long paddr_t;
-#define INVALID_PADDR (~0UL)
-#define PRIpaddr "08lx"
-
-/* DMA addresses come in generic and 64-bit flavours. */
-
-typedef unsigned long dma_addr_t;
-typedef u64 dma64_addr_t;
-
-typedef unsigned short xmem_bufctl_t;
-
-typedef int bool_t;
-#define test_and_set_bool(b) xchg(&(b), 1)
-#define test_and_clear_bool(b) xchg(&(b), 0)
-
-#endif /* __ASSEMBLY__ */
-#endif
diff --git a/xen/include/asm-powerpc/xenoprof.h b/xen/include/asm-powerpc/xenoprof.h
deleted file mode 100644
index 195796e5d1..0000000000
--- a/xen/include/asm-powerpc/xenoprof.h
+++ /dev/null
@@ -1,100 +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@us.ibm.com>
- */
-
-#ifndef __ASM_PPC_XENOPROF_H__
-#define __ASM_PPC_XENOPROF_H__
-
-#include <xen/config.h>
-#include <xen/types.h>
-#include <xen/sched.h>
-#include <public/xen.h>
-
-/* All the classic PPC parts use these */
-static inline unsigned int ctr_read(unsigned int i)
-{
- switch(i) {
- case 0:
- return mfpmc1();
- case 1:
- return mfpmc2();
- case 2:
- return mfpmc3();
- case 3:
- return mfpmc4();
- case 4:
- return mfpmc5();
- case 5:
- return mfpmc6();
- case 6:
- return mfpmc7();
- case 7:
- return mfpmc8();
- default:
- return 0;
- }
-}
-
-static inline void ctr_write(unsigned int i, unsigned int val)
-{
- switch(i) {
- case 0:
- mtpmc1(val);
- break;
- case 1:
- mtpmc2(val);
- break;
- case 2:
- mtpmc3(val);
- break;
- case 3:
- mtpmc4(val);
- break;
- case 4:
- mtpmc5(val);
- break;
- case 5:
- mtpmc6(val);
- break;
- case 6:
- mtpmc7(val);
- break;
- case 7:
- mtpmc8(val);
- break;
- default:
- break;
- }
-}
-
-static inline void print_perf_status(void)
-{
- ulong mmcr0 = mfmmcr0();
- ulong mmcr1 = mfmmcr1();
- ulong mmcra = mfmmcra();
- ulong sdar = mfsdar();
- ulong siar = mfsiar();
- printk("MMCR0 0x%0lX\n",mmcr0);
- printk("MMCR1 0x%0lX\n",mmcr1);
- printk("MMCRA 0x%0lX\n",mmcra);
- printk("SIAR 0x%0lX\n",siar);
- printk("SDAR 0x%0lX\n",sdar);
-}
-
-#endif
diff --git a/xen/include/asm-x86/desc.h b/xen/include/asm-x86/desc.h
index 05c0e5a425..4d6693f40e 100644
--- a/xen/include/asm-x86/desc.h
+++ b/xen/include/asm-x86/desc.h
@@ -121,7 +121,7 @@
#define _SEGMENT_S ( 1<<12) /* System descriptor (yes iff S==0) */
#define _SEGMENT_DPL ( 3<<13) /* Descriptor Privilege Level */
#define _SEGMENT_P ( 1<<15) /* Segment Present */
-#ifdef __x86_64
+#ifdef __x86_64__
#define _SEGMENT_L ( 1<<21) /* 64-bit segment */
#else
#define _SEGMENT_L 0
diff --git a/xen/include/public/arch-powerpc.h b/xen/include/public/arch-powerpc.h
deleted file mode 100644
index d92532f3ce..0000000000
--- a/xen/include/public/arch-powerpc.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Copyright (C) IBM Corp. 2005, 2006
- *
- * Authors: Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#include "xen.h"
-
-#ifndef __XEN_PUBLIC_ARCH_PPC_64_H__
-#define __XEN_PUBLIC_ARCH_PPC_64_H__
-
-#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
- typedef struct { \
- int __pad[(sizeof (long long) - sizeof (void *)) / sizeof (int)]; \
- type *p; \
- } __attribute__((__aligned__(8))) __guest_handle_ ## name
-
-#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
- ___DEFINE_XEN_GUEST_HANDLE(name, type); \
- ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type)
-#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
-#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name
-#define set_xen_guest_handle(hnd, val) \
- do { \
- if (sizeof ((hnd).__pad)) \
- (hnd).__pad[0] = 0; \
- (hnd).p = val; \
- } while (0)
-
-#ifdef __XEN_TOOLS__
-#define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
-#endif
-
-#ifndef __ASSEMBLY__
-typedef unsigned long long xen_pfn_t;
-#define PRI_xen_pfn "llx"
-#endif
-
-/*
- * Pointers and other address fields inside interface structures are padded to
- * 64 bits. This means that field alignments aren't different between 32- and
- * 64-bit architectures.
- */
-/* NB. Multi-level macro ensures __LINE__ is expanded before concatenation. */
-#define __MEMORY_PADDING(_X)
-#define _MEMORY_PADDING(_X) __MEMORY_PADDING(_X)
-#define MEMORY_PADDING _MEMORY_PADDING(__LINE__)
-
-/* And the trap vector is... */
-#define TRAP_INSTR "li 0,-1; sc" /* XXX just "sc"? */
-
-#ifndef __ASSEMBLY__
-
-#define XENCOMM_INLINE_FLAG (1UL << 63)
-
-typedef uint64_t xen_ulong_t;
-
-/* User-accessible registers: nost of these need to be saved/restored
- * for every nested Xen invocation. */
-struct cpu_user_regs
-{
- uint64_t gprs[32];
- uint64_t lr;
- uint64_t ctr;
- uint64_t srr0;
- uint64_t srr1;
- uint64_t pc;
- uint64_t msr;
- uint64_t fpscr; /* XXX Is this necessary */
- uint64_t xer;
- uint64_t hid4; /* debug only */
- uint64_t dar; /* debug only */
- uint32_t dsisr; /* debug only */
- uint32_t cr;
- uint32_t __pad; /* good spot for another 32bit reg */
- uint32_t entry_vector;
-};
-typedef struct cpu_user_regs cpu_user_regs_t;
-
-typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */ /* XXX timebase */
-
-/* ONLY used to communicate with dom0! See also struct exec_domain. */
-struct vcpu_guest_context {
- cpu_user_regs_t user_regs; /* User-level CPU registers */
- uint64_t sdr1; /* Pagetable base */
- /* XXX etc */
-};
-typedef struct vcpu_guest_context vcpu_guest_context_t;
-DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
-
-struct arch_shared_info {
- uint64_t boot_timebase;
-};
-
-struct arch_vcpu_info {
-};
-
-/* Support for multi-processor guests. */
-#define MAX_VIRT_CPUS 32
-#endif
-
-#endif
diff --git a/xen/include/public/io/protocols.h b/xen/include/public/io/protocols.h
index fd52934e27..77bd1bdd28 100644
--- a/xen/include/public/io/protocols.h
+++ b/xen/include/public/io/protocols.h
@@ -26,7 +26,6 @@
#define XEN_IO_PROTO_ABI_X86_32 "x86_32-abi"
#define XEN_IO_PROTO_ABI_X86_64 "x86_64-abi"
#define XEN_IO_PROTO_ABI_IA64 "ia64-abi"
-#define XEN_IO_PROTO_ABI_POWERPC64 "powerpc64-abi"
#if defined(__i386__)
# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32
@@ -34,8 +33,6 @@
# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_64
#elif defined(__ia64__)
# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64
-#elif defined(__powerpc64__)
-# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_POWERPC64
#else
# error arch fixup needed here
#endif
diff --git a/xen/include/public/libelf.h b/xen/include/public/libelf.h
index 8d79e4c90b..d2383301fa 100644
--- a/xen/include/public/libelf.h
+++ b/xen/include/public/libelf.h
@@ -23,10 +23,8 @@
#ifndef __XC_LIBELF__
#define __XC_LIBELF__ 1
-#if defined(__i386__) || defined(__x86_64) || defined(__ia64__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__)
#define XEN_ELF_LITTLE_ENDIAN
-#elif defined(__powerpc__)
-#define XEN_ELF_BIG_ENDIAN
#else
#error define architectural endianness
#endif
diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h
index cce6086062..f310fe8d12 100644
--- a/xen/include/public/xen.h
+++ b/xen/include/public/xen.h
@@ -33,8 +33,6 @@
#include "arch-x86/xen.h"
#elif defined(__ia64__)
#include "arch-ia64.h"
-#elif defined(__powerpc__)
-#include "arch-powerpc.h"
#else
#error "Unsupported architecture"
#endif