diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-05-08 13:40:40 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-05-08 13:40:40 +0100 |
commit | 1aa3c54a31a5aec90f3705a37258988a69279308 (patch) | |
tree | a7aa90331785f89e6938e0348ec05d7e32d83bba /tools | |
parent | 1b1305666b610a4808b06d8635451ea74996ceed (diff) | |
download | xen-1aa3c54a31a5aec90f3705a37258988a69279308.tar.gz xen-1aa3c54a31a5aec90f3705a37258988a69279308.tar.bz2 xen-1aa3c54a31a5aec90f3705a37258988a69279308.zip |
Remove defunct powerpc port.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'tools')
24 files changed, 2 insertions, 2437 deletions
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}'` |