ia64/xen-unstable

diff tools/libxc/powerpc64/xc_prose_build.c @ 13939:09b3fd488726

[XEND][POWERPC] Remove FlatDeviceTree.py, eliminate devtree from prose builder.

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Sun Jan 21 08:15:39 2007 -0500 (2007-01-21)
parents a510c94ceaa3
children
line diff
     1.1 --- a/tools/libxc/powerpc64/xc_prose_build.c	Sun Jan 21 08:14:27 2007 -0500
     1.2 +++ b/tools/libxc/powerpc64/xc_prose_build.c	Sun Jan 21 08:15:39 2007 -0500
     1.3 @@ -13,7 +13,7 @@
     1.4   * along with this program; if not, write to the Free Software
     1.5   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
     1.6   *
     1.7 - * Copyright (C) IBM Corporation 2006
     1.8 + * Copyright IBM Corporation 2006, 2007
     1.9   *
    1.10   * Authors: Hollis Blanchard <hollisb@us.ibm.com>
    1.11   *          Jonathan Appavoo <jappavoo@us.ibm.com>
    1.12 @@ -34,18 +34,14 @@
    1.13  #include <xg_private.h>
    1.14  #include <xenctrl.h>
    1.15  
    1.16 -#include "flatdevtree_env.h"
    1.17 -#include "flatdevtree.h"
    1.18  #include "utils.h"
    1.19  
    1.20  #define INITRD_ADDR (24UL << 20)
    1.21 -#define DEVTREE_ADDR (16UL << 20)
    1.22  
    1.23  static int init_boot_vcpu(
    1.24      int xc_handle,
    1.25      int domid,
    1.26      struct domain_setup_info *dsi,
    1.27 -    unsigned long devtree_addr,
    1.28      unsigned long kern_addr)
    1.29  {
    1.30      vcpu_guest_context_t ctxt;
    1.31 @@ -55,7 +51,7 @@ static int init_boot_vcpu(
    1.32      ctxt.user_regs.pc = dsi->v_kernentry;
    1.33      ctxt.user_regs.msr = 0;
    1.34      ctxt.user_regs.gprs[1] = 0; /* Linux uses its own stack */
    1.35 -    ctxt.user_regs.gprs[3] = devtree_addr;
    1.36 +    ctxt.user_regs.gprs[3] = 0;
    1.37      ctxt.user_regs.gprs[4] = kern_addr;
    1.38      ctxt.user_regs.gprs[5] = 0; /* reserved for specifying OF handler */
    1.39      /* There is a buggy kernel that does not zero the "local_paca", so
    1.40 @@ -79,85 +75,6 @@ static int init_boot_vcpu(
    1.41      return rc;
    1.42  }
    1.43  
    1.44 -static int load_devtree(
    1.45 -    int xc_handle,
    1.46 -    int domid,
    1.47 -    xen_pfn_t *page_array,
    1.48 -    void *devtree,
    1.49 -    unsigned long devtree_addr,
    1.50 -    uint64_t initrd_base,
    1.51 -    unsigned long initrd_len,
    1.52 -    start_info_t *start_info __attribute__((unused)),
    1.53 -    unsigned long start_info_addr)
    1.54 -{
    1.55 -    uint32_t si[4] = {0, start_info_addr, 0, 0x1000};
    1.56 -    struct boot_param_header *header;
    1.57 -    void *chosen;
    1.58 -    void *xen;
    1.59 -    uint64_t initrd_end = initrd_base + initrd_len;
    1.60 -    unsigned int devtree_size;
    1.61 -    int rc = 0;
    1.62 -
    1.63 -    DPRINTF("adding initrd props\n");
    1.64 -
    1.65 -    chosen = ft_find_node(devtree, "/chosen");
    1.66 -    if (chosen == NULL) {
    1.67 -        DPRINTF("couldn't find /chosen\n");
    1.68 -        return -1;
    1.69 -    }
    1.70 -
    1.71 -    xen = ft_find_node(devtree, "/xen");
    1.72 -    if (xen == NULL) {
    1.73 -        DPRINTF("couldn't find /xen\n");
    1.74 -        return -1;
    1.75 -    }
    1.76 -
    1.77 -    /* initrd-start */
    1.78 -    rc = ft_set_prop(&devtree, chosen, "linux,initrd-start",
    1.79 -            &initrd_base, sizeof(initrd_base));
    1.80 -    if (rc < 0) {
    1.81 -        DPRINTF("couldn't set /chosen/linux,initrd-start\n");
    1.82 -        return rc;
    1.83 -    }
    1.84 -
    1.85 -    /* initrd-end */
    1.86 -    rc = ft_set_prop(&devtree, chosen, "linux,initrd-end",
    1.87 -            &initrd_end, sizeof(initrd_end));
    1.88 -    if (rc < 0) {
    1.89 -        DPRINTF("couldn't set /chosen/linux,initrd-end\n");
    1.90 -        return rc;
    1.91 -    }
    1.92 -
    1.93 -    rc = ft_set_rsvmap(devtree, 1, initrd_base, initrd_len);
    1.94 -    if (rc < 0) {
    1.95 -        DPRINTF("couldn't set initrd reservation\n");
    1.96 -        return ~0UL;
    1.97 -    }
    1.98 -
    1.99 -    /* start-info (XXX being removed soon) */
   1.100 -    rc = ft_set_prop(&devtree, xen, "start-info", si, sizeof(si));
   1.101 -    if (rc < 0) {
   1.102 -        DPRINTF("couldn't set /xen/start-info\n");
   1.103 -        return rc;
   1.104 -    }
   1.105 -
   1.106 -    header = devtree;
   1.107 -    devtree_size = header->totalsize;
   1.108 -    {
   1.109 -        static const char dtb[] = "/tmp/xc_domU.dtb";
   1.110 -        int dfd = creat(dtb, 0666);
   1.111 -        if (dfd != -1) {
   1.112 -            write(dfd, devtree, devtree_size);
   1.113 -            close(dfd);
   1.114 -        } else
   1.115 -            DPRINTF("could not open(\"%s\")\n", dtb);
   1.116 -    }
   1.117 -
   1.118 -    DPRINTF("copying device tree to 0x%lx[0x%x]\n", DEVTREE_ADDR, devtree_size);
   1.119 -    return install_image(xc_handle, domid, page_array, devtree, DEVTREE_ADDR,
   1.120 -                       devtree_size);
   1.121 -}
   1.122 -
   1.123  static int load_initrd(
   1.124      int xc_handle,
   1.125      int domid,
   1.126 @@ -188,13 +105,12 @@ out:
   1.127  }
   1.128  
   1.129  static unsigned long create_start_info(
   1.130 -	void *devtree, start_info_t *start_info,
   1.131 +	start_info_t *start_info,
   1.132          unsigned int console_evtchn, unsigned int store_evtchn,
   1.133  	unsigned long nr_pages, unsigned long rma_pages, const char *cmdline)
   1.134  {
   1.135      unsigned long start_info_addr;
   1.136      uint64_t rma_top;
   1.137 -    int rc;
   1.138  
   1.139      memset(start_info, 0, sizeof(*start_info));
   1.140      snprintf(start_info->magic, sizeof(start_info->magic),
   1.141 @@ -214,12 +130,6 @@ static unsigned long create_start_info(
   1.142      start_info->cmd_line[MAX_GUEST_CMDLINE-1]=0;
   1.143      start_info_addr = rma_top - 4*PAGE_SIZE;
   1.144  
   1.145 -    rc = ft_set_rsvmap(devtree, 0, start_info_addr, 4*PAGE_SIZE);
   1.146 -    if (rc < 0) {
   1.147 -        DPRINTF("couldn't set start_info reservation\n");
   1.148 -        return ~0UL;
   1.149 -    }
   1.150 -
   1.151      return start_info_addr;
   1.152  }
   1.153  
   1.154 @@ -239,14 +149,12 @@ int xc_prose_build(int xc_handle,
   1.155                     unsigned int store_evtchn,
   1.156                     unsigned long *store_mfn,
   1.157                     unsigned int console_evtchn,
   1.158 -                   unsigned long *console_mfn,
   1.159 -                   void *devtree)
   1.160 +                   unsigned long *console_mfn)
   1.161  {
   1.162      start_info_t start_info;
   1.163      struct domain_setup_info dsi;
   1.164      xen_pfn_t *page_array = NULL;
   1.165      unsigned long nr_pages;
   1.166 -    unsigned long devtree_addr = 0;
   1.167      unsigned long kern_addr;
   1.168      unsigned long initrd_base = 0;
   1.169      unsigned long initrd_len = 0;
   1.170 @@ -261,11 +169,7 @@ int xc_prose_build(int xc_handle,
   1.171      nr_pages = mem_mb << (20 - PAGE_SHIFT);
   1.172      DPRINTF("nr_pages 0x%lx\n", nr_pages);
   1.173  
   1.174 -    rma_pages = get_rma_pages(devtree);
   1.175 -    if (rma_pages == 0) {
   1.176 -	    rc = -1;
   1.177 -	    goto out;
   1.178 -    }
   1.179 +    rma_pages = (1 << 26) >> PAGE_SHIFT; /* 64 MB */
   1.180  
   1.181      if (get_rma_page_array(xc_handle, domid, &page_array, rma_pages)) {
   1.182          rc = -1;
   1.183 @@ -289,9 +193,9 @@ int xc_prose_build(int xc_handle,
   1.184      }
   1.185  
   1.186      /* start_info stuff: about to be removed  */
   1.187 -    start_info_addr = create_start_info(devtree, &start_info, console_evtchn,
   1.188 +    start_info_addr = create_start_info(&start_info, console_evtchn,
   1.189                                          store_evtchn, nr_pages,
   1.190 -					rma_pages, cmdline);
   1.191 +                                        rma_pages, cmdline);
   1.192      *console_mfn = page_array[start_info.console.domU.mfn];
   1.193      *store_mfn = page_array[start_info.store_mfn];
   1.194      if (install_image(xc_handle, domid, page_array, &start_info,
   1.195 @@ -300,19 +204,7 @@ int xc_prose_build(int xc_handle,
   1.196          goto out;
   1.197      }
   1.198  
   1.199 -    if (devtree) {
   1.200 -        DPRINTF("loading flattened device tree\n");
   1.201 -        devtree_addr = DEVTREE_ADDR;
   1.202 -        if (load_devtree(xc_handle, domid, page_array, devtree, devtree_addr,
   1.203 -                         initrd_base, initrd_len, &start_info,
   1.204 -                         start_info_addr)) {
   1.205 -            DPRINTF("couldn't load flattened device tree.\n");
   1.206 -            rc = -1;
   1.207 -            goto out;
   1.208 -        }
   1.209 -    }
   1.210 -
   1.211 -    if (init_boot_vcpu(xc_handle, domid, &dsi, devtree_addr, kern_addr)) {
   1.212 +    if (init_boot_vcpu(xc_handle, domid, &dsi, kern_addr)) {
   1.213          rc = -1;
   1.214          goto out;
   1.215      }