ia64/xen-unstable

changeset 12952:5c3b6b623c57

[TOOLS][POWERPC] apply start_info changes to xc_prose_build.c
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Wed Oct 18 06:50:35 2006 -0400 (2006-10-18)
parents f2aaf35c7759
children 1a3c1168db6a
files tools/libxc/powerpc64/xc_prose_build.c
line diff
     1.1 --- a/tools/libxc/powerpc64/xc_prose_build.c	Wed Oct 18 06:43:33 2006 -0400
     1.2 +++ b/tools/libxc/powerpc64/xc_prose_build.c	Wed Oct 18 06:50:35 2006 -0400
     1.3 @@ -167,10 +167,10 @@ static int load_devtree(
     1.4      unsigned long devtree_addr,
     1.5      uint64_t initrd_base,
     1.6      unsigned long initrd_len,
     1.7 -    start_info_t *si,
     1.8 -    unsigned long si_addr)
     1.9 +    start_info_t *start_info __attribute__((unused)),
    1.10 +    unsigned long start_info_addr)
    1.11  {
    1.12 -    uint32_t start_info[4] = {0, si_addr, 0, 0x1000};
    1.13 +    uint32_t si[4] = {0, start_info_addr, 0, 0x1000};
    1.14      struct boot_param_header *header;
    1.15      void *chosen;
    1.16      void *xen;
    1.17 @@ -215,8 +215,7 @@ static int load_devtree(
    1.18      }
    1.19  
    1.20      /* start-info (XXX being removed soon) */
    1.21 -    rc = ft_set_prop(&devtree, xen, "start-info",
    1.22 -            start_info, sizeof(start_info));
    1.23 +    rc = ft_set_prop(&devtree, xen, "start-info", si, sizeof(si));
    1.24      if (rc < 0) {
    1.25          DPRINTF("couldn't set /xen/start-info\n");
    1.26          return rc;
    1.27 @@ -317,18 +316,19 @@ out:
    1.28      return rc;
    1.29  }
    1.30  
    1.31 -static unsigned long create_start_info(void *devtree, start_info_t *si,
    1.32 +static unsigned long create_start_info(void *devtree, start_info_t *start_info,
    1.33          unsigned int console_evtchn, unsigned int store_evtchn,
    1.34          unsigned long nr_pages, const char *cmdline)
    1.35  {
    1.36      void *rma;
    1.37 -    unsigned long si_addr;
    1.38 +    unsigned long start_info_addr;
    1.39      uint64_t rma_reg[2];
    1.40      uint64_t rma_top;
    1.41      int rc;
    1.42  
    1.43 -    memset(si, 0, sizeof(*si));
    1.44 -    snprintf(si->magic, sizeof(si->magic), "xen-%d.%d-powerpc64HV", 3, 0);
    1.45 +    memset(start_info, 0, sizeof(*start_info));
    1.46 +    snprintf(start_info->magic, sizeof(start_info->magic),
    1.47 +             "xen-%d.%d-powerpc64HV", 3, 0);
    1.48  
    1.49      rma = ft_find_node(devtree, "/memory@0");
    1.50      if (rma == NULL) {
    1.51 @@ -343,25 +343,22 @@ static unsigned long create_start_info(v
    1.52      rma_top = rma_reg[0] + rma_reg[1];
    1.53      DPRINTF("RMA top = 0x%"PRIX64"\n", rma_top);
    1.54  
    1.55 -    si->nr_pages = nr_pages;
    1.56 -    si->shared_info = rma_top - PAGE_SIZE;
    1.57 -    si->store_mfn = (rma_top >> PAGE_SHIFT) - 2;
    1.58 -    si->store_evtchn = store_evtchn;
    1.59 -    si->console.domU.mfn = (rma_top >> PAGE_SHIFT) - 3;
    1.60 -    si->console.domU.evtchn = console_evtchn;
    1.61 -    strncpy((char *)si->cmd_line, cmdline, MAX_GUEST_CMDLINE);
    1.62 -    /* just in case we truncated cmdline with strncpy add 0 at the end */
    1.63 -    si->cmd_line[MAX_GUEST_CMDLINE]=0;
    1.64 -    si_addr = rma_top - 4*PAGE_SIZE;
    1.65 +    start_info->nr_pages = nr_pages;
    1.66 +    start_info->shared_info = rma_top - PAGE_SIZE;
    1.67 +    start_info->store_mfn = (rma_top >> PAGE_SHIFT) - 2;
    1.68 +    start_info->store_evtchn = store_evtchn;
    1.69 +    start_info->console.domU.mfn = (rma_top >> PAGE_SHIFT) - 3;
    1.70 +    start_info->console.domU.evtchn = console_evtchn;
    1.71 +    start_info_addr = rma_top - 4*PAGE_SIZE;
    1.72  
    1.73 -    rc = ft_set_rsvmap(devtree, 0, si_addr, 4*PAGE_SIZE);
    1.74 +    rc = ft_set_rsvmap(devtree, 0, start_info_addr, 4*PAGE_SIZE);
    1.75      if (rc < 0) {
    1.76          DPRINTF("couldn't set start_info reservation\n");
    1.77          return ~0UL;
    1.78      }
    1.79  
    1.80  
    1.81 -    return si_addr;
    1.82 +    return start_info_addr;
    1.83  }
    1.84  
    1.85  static int get_page_array(int xc_handle, int domid, xen_pfn_t **page_array,
    1.86 @@ -409,7 +406,7 @@ int xc_prose_build(int xc_handle,
    1.87                     unsigned long *console_mfn,
    1.88                     void *devtree)
    1.89  {
    1.90 -    start_info_t si;
    1.91 +    start_info_t start_info;
    1.92      struct domain_setup_info dsi;
    1.93      xen_pfn_t *page_array = NULL;
    1.94      unsigned long nr_pages;
    1.95 @@ -417,7 +414,7 @@ int xc_prose_build(int xc_handle,
    1.96      unsigned long kern_addr;
    1.97      unsigned long initrd_base = 0;
    1.98      unsigned long initrd_len = 0;
    1.99 -    unsigned long si_addr;
   1.100 +    unsigned long start_info_addr;
   1.101      int rc = 0;
   1.102  
   1.103      DPRINTF("%s\n", __func__);
   1.104 @@ -446,12 +443,12 @@ int xc_prose_build(int xc_handle,
   1.105      }
   1.106  
   1.107      /* start_info stuff: about to be removed  */
   1.108 -    si_addr = create_start_info(devtree, &si, console_evtchn, store_evtchn,
   1.109 -                                nr_pages,cmdline);
   1.110 -    *console_mfn = page_array[si.console.domU.mfn];
   1.111 -    *store_mfn = page_array[si.store_mfn];
   1.112 -    if (install_image(xc_handle, domid, page_array, &si, si_addr,
   1.113 -                sizeof(start_info_t))) {
   1.114 +    start_info_addr = create_start_info(devtree, &start_info, console_evtchn,
   1.115 +                                        store_evtchn, nr_pages, cmdline);
   1.116 +    *console_mfn = page_array[start_info.console.domU.mfn];
   1.117 +    *store_mfn = page_array[start_info.store_mfn];
   1.118 +    if (install_image(xc_handle, domid, page_array, &start_info,
   1.119 +                      start_info_addr, sizeof(start_info_t))) {
   1.120          rc = -1;
   1.121          goto out;
   1.122      }
   1.123 @@ -460,7 +457,8 @@ int xc_prose_build(int xc_handle,
   1.124          DPRINTF("loading flattened device tree\n");
   1.125          devtree_addr = DEVTREE_ADDR;
   1.126          if (load_devtree(xc_handle, domid, page_array, devtree, devtree_addr,
   1.127 -                     initrd_base, initrd_len, &si, si_addr)) {
   1.128 +                         initrd_base, initrd_len, &start_info,
   1.129 +                         start_info_addr)) {
   1.130              DPRINTF("couldn't load flattened device tree.\n");
   1.131              rc = -1;
   1.132              goto out;