WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [XEND][POWERPC] Remove FlatDeviceTree.py,

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEND][POWERPC] Remove FlatDeviceTree.py, eliminate devtree from prose builder.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 14 Feb 2007 15:00:43 -0800
Delivery-date: Wed, 14 Feb 2007 15:01:23 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Date 1169385339 18000
# Node ID 09b3fd488726e6200590181b9f66a8a417cf5535
# Parent  7bf0783353429e7db0fbc123fd899156f19e28e3
[XEND][POWERPC] Remove FlatDeviceTree.py, eliminate devtree from prose builder.

Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>
Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
 tools/python/xen/xend/FlatDeviceTree.py |  359 --------------------------------
 tools/libxc/powerpc64/utils.c           |   25 --
 tools/libxc/powerpc64/utils.h           |    3 
 tools/libxc/powerpc64/xc_prose_build.c  |  124 -----------
 tools/libxc/xenguest.h                  |   14 -
 tools/python/xen/lowlevel/xc/xc.c       |   12 -
 tools/python/xen/xend/image.py          |   54 ----
 7 files changed, 22 insertions(+), 569 deletions(-)

diff -r 7bf078335342 -r 09b3fd488726 tools/libxc/powerpc64/utils.c
--- a/tools/libxc/powerpc64/utils.c     Sun Jan 21 08:14:27 2007 -0500
+++ b/tools/libxc/powerpc64/utils.c     Sun Jan 21 08:15:39 2007 -0500
@@ -13,7 +13,7 @@
  * 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
+ * Copyright IBM Corporation 2006, 2007
  *
  * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
  *          Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
@@ -36,29 +36,6 @@
 #include "flatdevtree_env.h"
 #include "flatdevtree.h"
 #include "utils.h"
-
-unsigned long get_rma_pages(void *devtree)
-{
-    void *rma;
-    uint64_t rma_reg[2];
-    int rc;
-
-    rma = ft_find_node(devtree, "/memory@0");
-    if (rma == NULL) {
-        DPRINTF("couldn't find /memory@0\n");
-        return 0;
-    }
-    rc = ft_get_prop(devtree, rma, "reg", rma_reg, sizeof(rma_reg));
-    if (rc < 0) {
-        DPRINTF("couldn't get /memory@0/reg\n");
-        return 0;
-    }
-    if (rma_reg[0] != 0) {
-        DPRINTF("RMA did not start at 0\n");
-        return 0;
-    }
-    return rma_reg[1] >> PAGE_SHIFT;
-}
 
 int get_rma_page_array(int xc_handle, int domid, xen_pfn_t **page_array,
                       unsigned long nr_pages)
diff -r 7bf078335342 -r 09b3fd488726 tools/libxc/powerpc64/utils.h
--- a/tools/libxc/powerpc64/utils.h     Sun Jan 21 08:14:27 2007 -0500
+++ b/tools/libxc/powerpc64/utils.h     Sun Jan 21 08:15:39 2007 -0500
@@ -13,13 +13,12 @@
  * 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
+ * Copyright IBM Corporation 2006, 2007
  *
  * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
  *          Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
  */
 
-extern unsigned long get_rma_pages(void *devtree);
 extern int get_rma_page_array(int xc_handle, int domid, xen_pfn_t **page_array,
                              unsigned long nr_pages);
 extern int install_image(int xc_handle, int domid, xen_pfn_t *page_array,
diff -r 7bf078335342 -r 09b3fd488726 tools/libxc/powerpc64/xc_prose_build.c
--- a/tools/libxc/powerpc64/xc_prose_build.c    Sun Jan 21 08:14:27 2007 -0500
+++ b/tools/libxc/powerpc64/xc_prose_build.c    Sun Jan 21 08:15:39 2007 -0500
@@ -13,7 +13,7 @@
  * 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
+ * Copyright IBM Corporation 2006, 2007
  *
  * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
  *          Jonathan Appavoo <jappavoo@xxxxxxxxxx>
@@ -34,18 +34,14 @@
 #include <xg_private.h>
 #include <xenctrl.h>
 
-#include "flatdevtree_env.h"
-#include "flatdevtree.h"
 #include "utils.h"
 
 #define INITRD_ADDR (24UL << 20)
-#define DEVTREE_ADDR (16UL << 20)
 
 static int init_boot_vcpu(
     int xc_handle,
     int domid,
     struct domain_setup_info *dsi,
-    unsigned long devtree_addr,
     unsigned long kern_addr)
 {
     vcpu_guest_context_t ctxt;
@@ -55,7 +51,7 @@ static int init_boot_vcpu(
     ctxt.user_regs.pc = dsi->v_kernentry;
     ctxt.user_regs.msr = 0;
     ctxt.user_regs.gprs[1] = 0; /* Linux uses its own stack */
-    ctxt.user_regs.gprs[3] = devtree_addr;
+    ctxt.user_regs.gprs[3] = 0;
     ctxt.user_regs.gprs[4] = kern_addr;
     ctxt.user_regs.gprs[5] = 0; /* reserved for specifying OF handler */
     /* There is a buggy kernel that does not zero the "local_paca", so
@@ -79,85 +75,6 @@ static int init_boot_vcpu(
     return rc;
 }
 
-static int load_devtree(
-    int xc_handle,
-    int domid,
-    xen_pfn_t *page_array,
-    void *devtree,
-    unsigned long devtree_addr,
-    uint64_t initrd_base,
-    unsigned long initrd_len,
-    start_info_t *start_info __attribute__((unused)),
-    unsigned long start_info_addr)
-{
-    uint32_t si[4] = {0, start_info_addr, 0, 0x1000};
-    struct boot_param_header *header;
-    void *chosen;
-    void *xen;
-    uint64_t initrd_end = initrd_base + initrd_len;
-    unsigned int devtree_size;
-    int rc = 0;
-
-    DPRINTF("adding initrd props\n");
-
-    chosen = ft_find_node(devtree, "/chosen");
-    if (chosen == NULL) {
-        DPRINTF("couldn't find /chosen\n");
-        return -1;
-    }
-
-    xen = ft_find_node(devtree, "/xen");
-    if (xen == NULL) {
-        DPRINTF("couldn't find /xen\n");
-        return -1;
-    }
-
-    /* initrd-start */
-    rc = ft_set_prop(&devtree, chosen, "linux,initrd-start",
-            &initrd_base, sizeof(initrd_base));
-    if (rc < 0) {
-        DPRINTF("couldn't set /chosen/linux,initrd-start\n");
-        return rc;
-    }
-
-    /* initrd-end */
-    rc = ft_set_prop(&devtree, chosen, "linux,initrd-end",
-            &initrd_end, sizeof(initrd_end));
-    if (rc < 0) {
-        DPRINTF("couldn't set /chosen/linux,initrd-end\n");
-        return rc;
-    }
-
-    rc = ft_set_rsvmap(devtree, 1, initrd_base, initrd_len);
-    if (rc < 0) {
-        DPRINTF("couldn't set initrd reservation\n");
-        return ~0UL;
-    }
-
-    /* start-info (XXX being removed soon) */
-    rc = ft_set_prop(&devtree, xen, "start-info", si, sizeof(si));
-    if (rc < 0) {
-        DPRINTF("couldn't set /xen/start-info\n");
-        return rc;
-    }
-
-    header = devtree;
-    devtree_size = header->totalsize;
-    {
-        static const char dtb[] = "/tmp/xc_domU.dtb";
-        int dfd = creat(dtb, 0666);
-        if (dfd != -1) {
-            write(dfd, devtree, devtree_size);
-            close(dfd);
-        } else
-            DPRINTF("could not open(\"%s\")\n", dtb);
-    }
-
-    DPRINTF("copying device tree to 0x%lx[0x%x]\n", DEVTREE_ADDR, 
devtree_size);
-    return install_image(xc_handle, domid, page_array, devtree, DEVTREE_ADDR,
-                       devtree_size);
-}
-
 static int load_initrd(
     int xc_handle,
     int domid,
@@ -188,13 +105,12 @@ out:
 }
 
 static unsigned long create_start_info(
-       void *devtree, start_info_t *start_info,
+       start_info_t *start_info,
         unsigned int console_evtchn, unsigned int store_evtchn,
        unsigned long nr_pages, unsigned long rma_pages, const char *cmdline)
 {
     unsigned long start_info_addr;
     uint64_t rma_top;
-    int rc;
 
     memset(start_info, 0, sizeof(*start_info));
     snprintf(start_info->magic, sizeof(start_info->magic),
@@ -213,12 +129,6 @@ static unsigned long create_start_info(
     /* just in case we truncated cmdline with strncpy add 0 at the end */
     start_info->cmd_line[MAX_GUEST_CMDLINE-1]=0;
     start_info_addr = rma_top - 4*PAGE_SIZE;
-
-    rc = ft_set_rsvmap(devtree, 0, start_info_addr, 4*PAGE_SIZE);
-    if (rc < 0) {
-        DPRINTF("couldn't set start_info reservation\n");
-        return ~0UL;
-    }
 
     return start_info_addr;
 }
@@ -239,14 +149,12 @@ int xc_prose_build(int xc_handle,
                    unsigned int store_evtchn,
                    unsigned long *store_mfn,
                    unsigned int console_evtchn,
-                   unsigned long *console_mfn,
-                   void *devtree)
+                   unsigned long *console_mfn)
 {
     start_info_t start_info;
     struct domain_setup_info dsi;
     xen_pfn_t *page_array = NULL;
     unsigned long nr_pages;
-    unsigned long devtree_addr = 0;
     unsigned long kern_addr;
     unsigned long initrd_base = 0;
     unsigned long initrd_len = 0;
@@ -261,11 +169,7 @@ int xc_prose_build(int xc_handle,
     nr_pages = mem_mb << (20 - PAGE_SHIFT);
     DPRINTF("nr_pages 0x%lx\n", nr_pages);
 
-    rma_pages = get_rma_pages(devtree);
-    if (rma_pages == 0) {
-           rc = -1;
-           goto out;
-    }
+    rma_pages = (1 << 26) >> PAGE_SHIFT; /* 64 MB */
 
     if (get_rma_page_array(xc_handle, domid, &page_array, rma_pages)) {
         rc = -1;
@@ -289,9 +193,9 @@ int xc_prose_build(int xc_handle,
     }
 
     /* start_info stuff: about to be removed  */
-    start_info_addr = create_start_info(devtree, &start_info, console_evtchn,
+    start_info_addr = create_start_info(&start_info, console_evtchn,
                                         store_evtchn, nr_pages,
-                                       rma_pages, cmdline);
+                                        rma_pages, cmdline);
     *console_mfn = page_array[start_info.console.domU.mfn];
     *store_mfn = page_array[start_info.store_mfn];
     if (install_image(xc_handle, domid, page_array, &start_info,
@@ -300,19 +204,7 @@ int xc_prose_build(int xc_handle,
         goto out;
     }
 
-    if (devtree) {
-        DPRINTF("loading flattened device tree\n");
-        devtree_addr = DEVTREE_ADDR;
-        if (load_devtree(xc_handle, domid, page_array, devtree, devtree_addr,
-                         initrd_base, initrd_len, &start_info,
-                         start_info_addr)) {
-            DPRINTF("couldn't load flattened device tree.\n");
-            rc = -1;
-            goto out;
-        }
-    }
-
-    if (init_boot_vcpu(xc_handle, domid, &dsi, devtree_addr, kern_addr)) {
+    if (init_boot_vcpu(xc_handle, domid, &dsi, kern_addr)) {
         rc = -1;
         goto out;
     }
diff -r 7bf078335342 -r 09b3fd488726 tools/libxc/xenguest.h
--- a/tools/libxc/xenguest.h    Sun Jan 21 08:14:27 2007 -0500
+++ b/tools/libxc/xenguest.h    Sun Jan 21 08:15:39 2007 -0500
@@ -122,18 +122,4 @@ int xc_get_hvm_param(
 int xc_get_hvm_param(
     int handle, domid_t dom, int param, unsigned long *value);
 
-/* PowerPC specific. */
-int xc_prose_build(int xc_handle,
-                   uint32_t domid,
-                   unsigned int mem_mb,
-                   const char *image_name,
-                   const char *ramdisk_name,
-                   const char *cmdline,
-                   const char *features,
-                   unsigned long flags,
-                   unsigned int store_evtchn,
-                   unsigned long *store_mfn,
-                   unsigned int console_evtchn,
-                   unsigned long *console_mfn);
-
 #endif /* XENGUEST_H */
diff -r 7bf078335342 -r 09b3fd488726 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Sun Jan 21 08:14:27 2007 -0500
+++ b/tools/python/xen/lowlevel/xc/xc.c Sun Jan 21 08:15:39 2007 -0500
@@ -947,28 +947,26 @@ static PyObject *pyxc_prose_build(XcObje
     unsigned int mem_mb;
     unsigned long store_mfn = 0;
     unsigned long console_mfn = 0;
-    void *arch_args = NULL;
     int unused;
 
     static char *kwd_list[] = { "dom", "store_evtchn",
                                 "console_evtchn", "image", "memsize",
                                 /* optional */
                                 "ramdisk", "cmdline", "flags",
-                                "features", "arch_args", NULL };
-
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiis|ssiss#", kwd_list,
+                                "features", NULL };
+
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiis|ssis#", kwd_list,
                                       &dom, &store_evtchn, &mem_mb,
                                       &console_evtchn, &image,
                                       /* optional */
                                       &ramdisk, &cmdline, &flags,
-                                      &features, &arch_args, &unused) )
+                                      &features, &unused) )
         return NULL;
 
     if ( xc_prose_build(self->xc_handle, dom, mem_mb, image,
                         ramdisk, cmdline, features, flags,
                         store_evtchn, &store_mfn,
-                        console_evtchn, &console_mfn,
-                        arch_args) != 0 ) {
+                        console_evtchn, &console_mfn) != 0 ) {
         if (!errno)
              errno = EINVAL;
         return pyxc_error_to_exception();
diff -r 7bf078335342 -r 09b3fd488726 tools/python/xen/xend/FlatDeviceTree.py
--- a/tools/python/xen/xend/FlatDeviceTree.py   Sun Jan 21 08:14:27 2007 -0500
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,359 +0,0 @@
-#!/usr/bin/env python
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of version 2.1 of the GNU Lesser General Public
-# License as published by the Free Software Foundation.
-#
-# This library 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
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#
-# Copyright (C) IBM Corp. 2006
-#
-# Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
-
-import os
-import sys
-import struct
-import stat
-import re
-import glob
-import math
-
-_host_devtree_root = '/proc/device-tree'
-
-_OF_DT_HEADER = int("d00dfeed", 16) # avoid signed/unsigned FutureWarning
-_OF_DT_BEGIN_NODE = 0x1
-_OF_DT_END_NODE = 0x2
-_OF_DT_PROP = 0x3
-_OF_DT_END = 0x9
-
-def _bincat(seq, separator=''):
-    '''Concatenate the contents of seq into a bytestream.'''
-    strs = []
-    for item in seq:
-        if isinstance(item, int):
-            strs.append(struct.pack(">I", item))
-        elif isinstance(item, long):
-            strs.append(struct.pack(">Q", item))
-        else:
-            try:
-                strs.append(item.to_bin())
-            except AttributeError, e:
-                strs.append(item)
-    return separator.join(strs)
-
-def _alignup(val, alignment):
-    return (val + alignment - 1) & ~(alignment - 1)
-
-def _pad(buf, alignment):
-    '''Pad bytestream with NULLs to specified alignment.'''
-    padlen = _alignup(len(buf), alignment)
-    return buf + '\0' * (padlen - len(buf))
-    # not present in Python 2.3:
-    #return buf.ljust(_padlen, '\0')
-
-def _indent(item):
-    indented = []
-    for line in str(item).splitlines(True):
-        indented.append('    ' + line)
-    return ''.join(indented)
-
-class _Property:
-    _nonprint = re.compile('[\000-\037\200-\377]')
-    def __init__(self, node, name, value):
-        self.node = node
-        self.value = value
-        self.name = name
-        self.node.tree.stradd(name)
-
-    def __str__(self):
-        result = self.name
-        if self.value:
-            searchtext = self.value
-            # it's ok for a string to end in NULL
-            if searchtext.find('\000') == len(searchtext)-1:
-                searchtext = searchtext[:-1]
-            m = self._nonprint.search(searchtext)
-            if m:
-                bytes = struct.unpack("B" * len(self.value), self.value)
-                hexbytes = [ '%02x' % b for b in bytes ]
-                words = []
-                for i in range(0, len(self.value), 4):
-                    words.append(''.join(hexbytes[i:i+4]))
-                v = '<' + ' '.join(words) + '>'
-            else:
-                v = '"%s"' % self.value
-            result += ': ' + v
-        return result
-
-    def to_bin(self):
-        offset = self.node.tree.stroffset(self.name)
-        return struct.pack('>III', _OF_DT_PROP, len(self.value), offset) \
-            + _pad(self.value, 4)
-
-class _Node:
-    def __init__(self, tree, name):
-        self.tree = tree
-        self.name = name
-        self.props = {}
-        self.children = {}
-        self.phandle = 0
-
-    def __str__(self):
-        propstrs = [ _indent(prop) for prop in self.props.values() ]
-        childstrs = [ _indent(child) for child in self.children.values() ]
-        return '%s:\n%s\n%s' % (self.name, '\n'.join(propstrs),
-            '\n'.join(childstrs))
-
-    def to_bin(self):
-        name = _pad(self.name + '\0', 4)
-        return struct.pack('>I', _OF_DT_BEGIN_NODE) + \
-                name + \
-                _bincat(self.props.values()) + \
-                _bincat(self.children.values()) + \
-                struct.pack('>I', _OF_DT_END_NODE)
-
-    def addprop(self, propname, *cells):
-        '''setprop with duplicate error-checking.'''
-        if propname in self.props:
-            raise AttributeError('%s/%s already exists' % (self.name, 
propname))
-        self.setprop(propname, *cells)
-
-    def setprop(self, propname, *cells):
-        self.props[propname] = _Property(self, propname, _bincat(cells))
-
-    def addnode(self, nodename):
-        '''newnode with duplicate error-checking.'''
-        if nodename in self.children:
-            raise AttributeError('%s/%s already exists' % (self.name, 
nodename))
-        return self.newnode(nodename)
-
-    def newnode(self, nodename):
-        node = _Node(self.tree, nodename)
-        self.children[nodename] = node
-        return node
-
-    def getprop(self, propname):
-        return self.props[propname]
-
-    def getchild(self, nodename):
-        return self.children[nodename]
-
-    def get_phandle(self):
-        if self.phandle:
-            return self.phandle
-        self.phandle = self.tree.alloc_phandle()
-        self.addprop('linux,phandle', self.phandle)
-        return self.phandle
-
-class _Header:
-    def __init__(self):
-        self.magic = 0
-        self.totalsize = 0
-        self.off_dt_struct = 0
-        self.off_dt_strings = 0
-        self.off_mem_rsvmap = 0
-        self.version = 0
-        self.last_comp_version = 0
-        self.boot_cpuid_phys = 0
-        self.size_dt_strings = 0
-    def to_bin(self):
-        return struct.pack('>9I',
-            self.magic,
-            self.totalsize,
-            self.off_dt_struct,
-            self.off_dt_strings,
-            self.off_mem_rsvmap,
-            self.version,
-            self.last_comp_version,
-            self.boot_cpuid_phys,
-            self.size_dt_strings)
-
-class _StringBlock:
-    def __init__(self):
-        self.table = []
-    def to_bin(self):
-        return _bincat(self.table, '\0') + '\0'
-    def add(self, str):
-        self.table.append(str)
-    def getoffset(self, str):
-        return self.to_bin().index(str + '\0')
-
-class Tree(_Node):
-    def __init__(self):
-        self.last_phandle = 0
-        self.strings = _StringBlock()
-        self.reserved = [(0, 0)]
-        _Node.__init__(self, self, '\0')
-
-    def alloc_phandle(self):
-        self.last_phandle += 1
-        return self.last_phandle
-
-    def stradd(self, str):
-        return self.strings.add(str)
-
-    def stroffset(self, str):
-        return self.strings.getoffset(str)
-
-    def reserve(self, start, len):
-        self.reserved.insert(0, (start, len))
-
-    def to_bin(self):
-        # layout:
-        #   header
-        #   reservation map
-        #   string block
-        #   data block
-
-        datablock = _Node.to_bin(self)
-
-        r = [ struct.pack('>QQ', rsrv[0], rsrv[1]) for rsrv in self.reserved ]
-        reserved = _bincat(r)
-
-        strblock = _pad(self.strings.to_bin(), 4)
-        strblocklen = len(strblock)
-
-        header = _Header()
-        header.magic = _OF_DT_HEADER
-        header.off_mem_rsvmap = _alignup(len(header.to_bin()), 8)
-        header.off_dt_strings = header.off_mem_rsvmap + len(reserved)
-        header.off_dt_struct = header.off_dt_strings + strblocklen
-        header.version = 0x10
-        header.last_comp_version = 0x10
-        header.boot_cpuid_phys = 0
-        header.size_dt_strings = strblocklen
-
-        payload = reserved + \
-                strblock + \
-                datablock + \
-                struct.pack('>I', _OF_DT_END)
-        header.totalsize = len(payload) + _alignup(len(header.to_bin()), 8)
-        return _pad(header.to_bin(), 8) + payload
-
-def _readfile(fullpath):
-    '''Return full contents of a file.'''
-    f = file(fullpath, 'r')
-    data = f.read()
-    f.close()
-    return data
-
-def _find_first_cpu(dirpath):
-    '''Find the first node of type 'cpu' in a directory tree.'''
-    cpulist = glob.glob(os.path.join(dirpath, 'cpus', '*'))
-    for node in cpulist:
-        try:
-            data = _readfile(os.path.join(node, 'device_type'))
-        except IOError:
-            continue
-        if 'cpu' in data:
-            return node
-    raise IOError("couldn't find any CPU nodes under " + dirpath)
-
-def _copynode(node, dirpath, propfilter):
-    '''Copy all properties and children nodes from a directory tree.'''
-    dirents = os.listdir(dirpath)
-    for dirent in dirents:
-        fullpath = os.path.join(dirpath, dirent)
-        st = os.lstat(fullpath)
-        if stat.S_ISDIR(st.st_mode):
-            child = node.addnode(dirent)
-            _copynode(child, fullpath, propfilter)
-        elif stat.S_ISREG(st.st_mode) and propfilter(fullpath):
-            node.addprop(dirent, _readfile(fullpath))
-
-def build(imghandler):
-    '''Construct a device tree by combining the domain's configuration and
-    the host's device tree.'''
-    root = Tree()
-
-    # 1st reseravtion entry used for start_info, console, store, shared_info
-    root.reserve(0x3ffc000, 0x4000)
-
-    # 2nd reservation enrty used for initrd, later on when we load the
-    # initrd we may fill this in with zeroes which signifies the end
-    # of the reservation map.  So as to avoid adding a zero map now we
-    # put some bogus yet sensible numbers here.
-    root.reserve(0x1000000, 0x1000)
-
-    root.addprop('device_type', 'chrp-but-not-really\0')
-    root.addprop('#size-cells', 2)
-    root.addprop('#address-cells', 2)
-    root.addprop('model', 'Momentum,Maple-D\0')
-    root.addprop('compatible', 'Momentum,Maple\0')
-
-    xen = root.addnode('xen')
-    xen.addprop('start-info', long(0x3ffc000), long(0x1000))
-    xen.addprop('version', 'Xen-3.0-unstable\0')
-    xen.addprop('reg', long(imghandler.vm.domid), long(0))
-    xen.addprop('domain-name', imghandler.vm.getName() + '\0')
-    xencons = xen.addnode('console')
-    xencons.addprop('interrupts', 1, 0)
-
-    # add memory nodes
-    totalmem = imghandler.vm.getMemoryTarget() * 1024
-    rma_log = 26 ### imghandler.vm.info.get('powerpc_rma_log')
-    rma_bytes = 1 << rma_log
-
-    # RMA node
-    rma = root.addnode('memory@0')
-    rma.addprop('reg', long(0), long(rma_bytes))
-    rma.addprop('device_type', 'memory\0')
-
-    # all the rest in a single node
-    remaining = totalmem - rma_bytes
-    if remaining > 0:
-        mem = root.addnode('memory@1')
-        mem.addprop('reg', long(rma_bytes), long(remaining))
-        mem.addprop('device_type', 'memory\0')
-
-    # add CPU nodes
-    cpus = root.addnode('cpus')
-    cpus.addprop('smp-enabled')
-    cpus.addprop('#size-cells', 0)
-    cpus.addprop('#address-cells', 1)
-
-    # Copy all properties the system firmware gave us, except for 'linux,'
-    # properties, from the first CPU node in the device tree. Do this once for
-    # every vcpu. Hopefully all cpus are identical...
-    cpu0 = None
-    cpu0path = _find_first_cpu(_host_devtree_root)
-    def _nolinuxprops(fullpath):
-        return not os.path.basename(fullpath).startswith('linux,')
-    for i in range(imghandler.vm.getVCpuCount()):
-        # create new node and copy all properties
-        cpu = cpus.addnode('PowerPC,970@%d' % i)
-        _copynode(cpu, cpu0path, _nolinuxprops)
-
-        # overwrite what we need to
-        shadow_mb = imghandler.vm.info.get('shadow_memory', 1)
-        shadow_mb_log = int(math.log(shadow_mb, 2))
-        pft_size = shadow_mb_log + 20
-        cpu.setprop('ibm,pft-size', 0, pft_size)
-
-        # set default CPU
-        if cpu0 == None:
-            cpu0 = cpu
-
-    chosen = root.addnode('chosen')
-    chosen.addprop('cpu', cpu0.get_phandle())
-    chosen.addprop('memory', rma.get_phandle())
-    chosen.addprop('linux,stdout-path', '/xen/console\0')
-    chosen.addprop('interrupt-controller', xen.get_phandle())
-    chosen.addprop('bootargs', imghandler.cmdline + '\0')
-    # xc_linux_load.c will overwrite these 64-bit properties later
-    chosen.addprop('linux,initrd-start', long(0))
-    chosen.addprop('linux,initrd-end', long(0))
-
-    if 1:
-        f = file('/tmp/domU.dtb', 'w')
-        f.write(root.to_bin())
-        f.close()
-
-    return root
diff -r 7bf078335342 -r 09b3fd488726 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Sun Jan 21 08:14:27 2007 -0500
+++ b/tools/python/xen/xend/image.py    Sun Jan 21 08:15:39 2007 -0500
@@ -29,7 +29,6 @@ from xen.xend.server.netif import random
 from xen.xend.server.netif import randomMAC
 from xen.xend.xenstore.xswatch import xswatch
 from xen.xend import arch
-from xen.xend import FlatDeviceTree
 
 xc = xen.lowlevel.xc.xc()
 
@@ -215,51 +214,15 @@ class LinuxImageHandler(ImageHandler):
                               ramdisk        = self.ramdisk,
                               features       = self.vm.getFeatures())
 
-class PPC_LinuxImageHandler(LinuxImageHandler):
-
-    ostype = "linux"
+
+
+class PPC_ProseImageHandler(LinuxImageHandler):
+
+    ostype = "prose"
 
     def configure(self, vmConfig, imageConfig, deviceConfig):
         LinuxImageHandler.configure(self, vmConfig, imageConfig, deviceConfig)
         self.imageConfig = imageConfig
-
-    def buildDomain(self):
-        store_evtchn = self.vm.getStorePort()
-        console_evtchn = self.vm.getConsolePort()
-
-        mem_mb = self.getRequiredInitialReservation() / 1024
-
-        log.debug("domid          = %d", self.vm.getDomid())
-        log.debug("memsize        = %d", mem_mb)
-        log.debug("image          = %s", self.kernel)
-        log.debug("store_evtchn   = %d", store_evtchn)
-        log.debug("console_evtchn = %d", console_evtchn)
-        log.debug("cmdline        = %s", self.cmdline)
-        log.debug("ramdisk        = %s", self.ramdisk)
-        log.debug("vcpus          = %d", self.vm.getVCpuCount())
-        log.debug("features       = %s", self.vm.getFeatures())
-
-        return xc.linux_build(domid          = self.vm.getDomid(),
-                              memsize        = mem_mb,
-                              image          = self.kernel,
-                              store_evtchn   = store_evtchn,
-                              console_evtchn = console_evtchn,
-                              cmdline        = self.cmdline,
-                              ramdisk        = self.ramdisk,
-                              features       = self.vm.getFeatures())
-
-    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 PPC_ProseImageHandler(PPC_LinuxImageHandler):
-
-    ostype = "prose"
 
     def buildDomain(self):
         store_evtchn = self.vm.getStorePort()
@@ -277,8 +240,6 @@ class PPC_ProseImageHandler(PPC_LinuxIma
         log.debug("vcpus          = %d", self.vm.getVCpuCount())
         log.debug("features       = %s", self.vm.getFeatures())
 
-        devtree = FlatDeviceTree.build(self)
-
         return xc.arch_prose_build(dom            = self.vm.getDomid(),
                                    memsize        = mem_mb,
                                    image          = self.kernel,
@@ -286,8 +247,7 @@ class PPC_ProseImageHandler(PPC_LinuxIma
                                    console_evtchn = console_evtchn,
                                    cmdline        = self.cmdline,
                                    ramdisk        = self.ramdisk,
-                                   features       = self.vm.getFeatures(),
-                                   arch_args      = devtree.to_bin())
+                                   features       = self.vm.getFeatures())
 
     def getRequiredShadowMemory(self, shadow_mem_kb, maxmem_kb):
         """@param shadow_mem_kb The configured shadow memory, in KiB.
@@ -628,7 +588,7 @@ class X86_Linux_ImageHandler(LinuxImageH
 
 _handlers = {
     "powerpc": {
-        "linux": PPC_LinuxImageHandler,
+        "linux": LinuxImageHandler,
         "prose": PPC_ProseImageHandler,
     },
     "ia64": {

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XEND][POWERPC] Remove FlatDeviceTree.py, eliminate devtree from prose builder., Xen patchbot-unstable <=