ia64/xen-unstable

changeset 12963:5909f57c8c39

[XEN][POWERPC] Early boot memory avoidance improvemnts
This patch add a simple memory allocator that can be used to:
- repect our loaded image
- repect firmware suggestions on "availble" memory
- avoid memory we know to have issues with various different FW
Also cleans up a lot of the previous logic and no longer updates the
multipboot memory map since that is no longer used anyway.
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 Nov 22 14:35:09 2006 -0500 (2006-11-22)
parents d6b44cb7d2c9
children f911e945d959
files xen/arch/powerpc/boot_of.c xen/arch/powerpc/setup.c
line diff
     1.1 --- a/xen/arch/powerpc/boot_of.c	Tue Nov 21 15:25:02 2006 -0600
     1.2 +++ b/xen/arch/powerpc/boot_of.c	Wed Nov 22 14:35:09 2006 -0500
     1.3 @@ -41,11 +41,16 @@ volatile unsigned int __spin_ack;
     1.4  static ulong of_vec;
     1.5  static ulong of_msr;
     1.6  static int of_out;
     1.7 +static ulong eomem;
     1.8 +
     1.9 +#define MEM_AVAILABLE_PAGES ((32 << 20) >> PAGE_SHIFT)
    1.10 +static DECLARE_BITMAP(mem_available_pages, MEM_AVAILABLE_PAGES);
    1.11  
    1.12  extern char builtin_cmdline[];
    1.13  extern struct ns16550_defaults ns16550;
    1.14  
    1.15  #undef OF_DEBUG
    1.16 +#undef OF_DEBUG_LOW
    1.17  
    1.18  #ifdef OF_DEBUG
    1.19  #define DBG(args...) of_printf(args)
    1.20 @@ -53,6 +58,12 @@ extern struct ns16550_defaults ns16550;
    1.21  #define DBG(args...)
    1.22  #endif
    1.23  
    1.24 +#ifdef OF_DEBUG_LOW
    1.25 +#define DBG_LOW(args...) of_printf(args)
    1.26 +#else
    1.27 +#define DBG_LOW(args...)
    1.28 +#endif
    1.29 +
    1.30  #define of_panic(MSG...) \
    1.31      do { of_printf(MSG); of_printf("\nHANG\n"); for (;;); } while (0)
    1.32  
    1.33 @@ -75,7 +86,6 @@ static int __init of_call(
    1.34      if (of_vec != 0) {
    1.35          va_list args;
    1.36          int i;
    1.37 -
    1.38          memset(&s, 0, sizeof (s));
    1.39          s.ofs_service = (ulong)service;
    1.40          s.ofs_nargs = nargs;
    1.41 @@ -186,7 +196,7 @@ static int __init of_finddevice(const ch
    1.42          DBG("finddevice %s -> FAILURE %d\n",devspec,rets[0]);
    1.43          return OF_FAILURE;
    1.44      }
    1.45 -    DBG("finddevice %s -> %d\n",devspec, rets[0]);
    1.46 +    DBG_LOW("finddevice %s -> %d\n",devspec, rets[0]);
    1.47      return rets[0];
    1.48  }
    1.49  
    1.50 @@ -197,11 +207,11 @@ static int __init of_getprop(int ph, con
    1.51      of_call("getprop", 4, 1, rets, ph, name, buf, buflen);
    1.52  
    1.53      if (rets[0] == OF_FAILURE) {
    1.54 -        DBG("getprop 0x%x %s -> FAILURE\n", ph, name);
    1.55 +        DBG_LOW("getprop 0x%x %s -> FAILURE\n", ph, name);
    1.56          return OF_FAILURE;
    1.57      }
    1.58  
    1.59 -    DBG("getprop 0x%x %s -> 0x%x (%s)\n", ph, name, rets[0], (char *)buf);
    1.60 +    DBG_LOW("getprop 0x%x %s -> 0x%x (%s)\n", ph, name, rets[0], (char *)buf);
    1.61      return rets[0];
    1.62  }
    1.63  
    1.64 @@ -217,7 +227,7 @@ static int __init of_setprop(
    1.65          return OF_FAILURE;
    1.66      }
    1.67  
    1.68 -    DBG("setprop 0x%x %s -> %s\n", ph, name, (char *)buf);
    1.69 +    DBG_LOW("setprop 0x%x %s -> %s\n", ph, name, (char *)buf);
    1.70      return rets[0];
    1.71  }
    1.72  
    1.73 @@ -229,7 +239,7 @@ static int __init of_getchild(int ph)
    1.74      int rets[1] = { OF_FAILURE };
    1.75  
    1.76      of_call("child", 1, 1, rets, ph);
    1.77 -    DBG("getchild 0x%x -> 0x%x\n", ph, rets[0]);
    1.78 +    DBG_LOW("getchild 0x%x -> 0x%x\n", ph, rets[0]);
    1.79  
    1.80      return rets[0];
    1.81  }
    1.82 @@ -242,7 +252,7 @@ static int __init of_getpeer(int ph)
    1.83      int rets[1] = { OF_FAILURE };
    1.84  
    1.85      of_call("peer", 1, 1, rets, ph);
    1.86 -    DBG("getpeer 0x%x -> 0x%x\n", ph, rets[0]);
    1.87 +    DBG_LOW("getpeer 0x%x -> 0x%x\n", ph, rets[0]);
    1.88  
    1.89      return rets[0];
    1.90  }
    1.91 @@ -256,7 +266,7 @@ static int __init of_getproplen(int ph, 
    1.92          DBG("getproplen 0x%x %s -> FAILURE\n", ph, name);
    1.93          return OF_FAILURE;
    1.94      }
    1.95 -    DBG("getproplen 0x%x %s -> 0x%x\n", ph, name, rets[0]);
    1.96 +    DBG_LOW("getproplen 0x%x %s -> 0x%x\n", ph, name, rets[0]);
    1.97      return rets[0];
    1.98  }
    1.99  
   1.100 @@ -269,7 +279,7 @@ static int __init of_package_to_path(int
   1.101          DBG("%s 0x%x -> FAILURE\n", __func__, ph);
   1.102          return OF_FAILURE;
   1.103      }
   1.104 -    DBG("%s 0x%x %s -> 0x%x\n", __func__, ph, buffer, rets[0]);
   1.105 +    DBG_LOW("%s 0x%x %s -> 0x%x\n", __func__, ph, buffer, rets[0]);
   1.106      if (rets[0] <= buflen)
   1.107          buffer[rets[0]] = '\0';
   1.108      return rets[0];
   1.109 @@ -286,7 +296,7 @@ static int __init of_nextprop(int ph, co
   1.110          return OF_FAILURE;
   1.111      }
   1.112  
   1.113 -    DBG("nextprop 0x%x %s -> %s\n", ph, name, (char *)buf);
   1.114 +    DBG_LOW("nextprop 0x%x %s -> %s\n", ph, name, (char *)buf);
   1.115      return rets[0];
   1.116  }
   1.117  
   1.118 @@ -333,7 +343,7 @@ static int __init of_claim(u32 virt, u32
   1.119          return OF_FAILURE;
   1.120      }
   1.121  
   1.122 -    DBG("%s 0x%08x 0x%08x  0x%08x -> 0x%08x\n", __func__, virt, size, align,
   1.123 +    DBG_LOW("%s 0x%08x 0x%08x  0x%08x -> 0x%08x\n", __func__, virt, size, align,
   1.124          rets[0]);
   1.125      return rets[0];
   1.126  }
   1.127 @@ -355,7 +365,7 @@ static int __init of_getparent(int ph)
   1.128  
   1.129      of_call("parent", 1, 1, rets, ph);
   1.130  
   1.131 -    DBG("getparent 0x%x -> 0x%x\n", ph, rets[0]);
   1.132 +    DBG_LOW("getparent 0x%x -> 0x%x\n", ph, rets[0]);
   1.133      return rets[0];
   1.134  }
   1.135  
   1.136 @@ -367,25 +377,196 @@ static int __init of_open(const char *de
   1.137      return rets[0];
   1.138  }
   1.139  
   1.140 -static void boot_of_probemem(multiboot_info_t *mbi)
   1.141 +static void boot_of_alloc_init(int m, uint addr_cells, uint size_cells)
   1.142 +{
   1.143 +    int rc;
   1.144 +    uint pg;
   1.145 +    uint a[64];
   1.146 +    int tst;
   1.147 +    u64 start;
   1.148 +    u64 size;
   1.149 +
   1.150 +    rc = of_getprop(m, "available", a, sizeof (a));
   1.151 +    if (rc > 0) {
   1.152 +        int l =  rc / sizeof(a[0]);
   1.153 +        int r = 0;
   1.154 +
   1.155 +#ifdef OF_DEBUG
   1.156 +        { 
   1.157 +            int i;
   1.158 +            of_printf("avail:\n");
   1.159 +            for (i = 0; i < l; i += 4)
   1.160 +                of_printf("  0x%x%x, 0x%x%x\n",
   1.161 +                          a[i], a[i + 1],
   1.162 +                          a[i + 2] ,a[i + 3]);
   1.163 +        }
   1.164 +#endif
   1.165 +            
   1.166 +        pg = 0;
   1.167 +        while (pg < MEM_AVAILABLE_PAGES && r < l) {
   1.168 +            ulong end;
   1.169 +
   1.170 +            start = a[r++];
   1.171 +            if (addr_cells == 2 && (r < l) )
   1.172 +                start = (start << 32) | a[r++];
   1.173 +            
   1.174 +            size = a[r++];
   1.175 +            if (size_cells == 2 && (r < l) )
   1.176 +                size = (size << 32) | a[r++];
   1.177 +                
   1.178 +            end = ALIGN_DOWN(start + size, PAGE_SIZE);
   1.179 +
   1.180 +            start = ALIGN_UP(start, PAGE_SIZE);
   1.181 +
   1.182 +            DBG("%s: marking 0x%x - 0x%lx\n", __func__,
   1.183 +                pg << PAGE_SHIFT, start);
   1.184 +
   1.185 +            start >>= PAGE_SHIFT;
   1.186 +            while (pg < MEM_AVAILABLE_PAGES && pg < start) {
   1.187 +                set_bit(pg, mem_available_pages);
   1.188 +                pg++;
   1.189 +            }
   1.190 +
   1.191 +            pg = end  >> PAGE_SHIFT;
   1.192 +        }
   1.193 +    }
   1.194 +
   1.195 +    /* FW is incorrect in that the space below our image is not safe
   1.196 +     * either */
   1.197 +    start = (ulong)_start >> PAGE_SHIFT;
   1.198 +    pg = 0;
   1.199 +    DBG("%s: marking 0x%x - 0x%lx\n", __func__,
   1.200 +        pg << PAGE_SHIFT, start);
   1.201 +    while (pg < start - 1) {
   1.202 +        set_bit(pg, mem_available_pages);
   1.203 +        ++pg;
   1.204 +    }
   1.205 +        
   1.206 +    /* Now make sure we mark our own memory */
   1.207 +    pg = start;
   1.208 +    start = (ulong)_end >> PAGE_SHIFT;
   1.209 +
   1.210 +    DBG("%s: marking 0x%x - 0x%lx\n", __func__,
   1.211 +        pg << PAGE_SHIFT, start << PAGE_SHIFT);
   1.212 +
   1.213 +    /* Lets try and detect if our image has stepped on something. It
   1.214 +     * is possible that FW has already subtracted our image from
   1.215 +     * available memory so we must make sure that the previous bits
   1.216 +     * are the same for the whole image */
   1.217 +    tst = test_and_set_bit(pg, mem_available_pages);
   1.218 +    ++pg;
   1.219 +    while (pg <= start) {
   1.220 +        if (test_and_set_bit(pg, mem_available_pages) != tst)
   1.221 +            of_panic("%s: pg :0x%x of our image is different\n",
   1.222 +                     __func__, pg);
   1.223 +        ++pg;
   1.224 +    }
   1.225 +
   1.226 +    DBG("%s: marking 0x%x - 0x%x\n", __func__,
   1.227 +        0 << PAGE_SHIFT, 3 << PAGE_SHIFT);
   1.228 +    /* First for pages (where the vectors are) should be left alone as well */
   1.229 +    set_bit(0, mem_available_pages);
   1.230 +    set_bit(1, mem_available_pages);
   1.231 +    set_bit(2, mem_available_pages);
   1.232 +    set_bit(3, mem_available_pages);
   1.233 +}
   1.234 +
   1.235 +#ifdef BOOT_OF_FREE
   1.236 +/* this is here in case we ever need a free call at a later date */
   1.237 +static void boot_of_free(ulong addr, ulong size)
   1.238 +{
   1.239 +    ulong bits;
   1.240 +    ulong pos;
   1.241 +    ulong i;
   1.242 +
   1.243 +    size = ALIGN_UP(size, PAGE_SIZE);
   1.244 +    bits = size >> PAGE_SHIFT;
   1.245 +    pos = addr >> PAGE_SHIFT;
   1.246 +
   1.247 +    for (i = 0; i < bits; i++) {
   1.248 +        if (!test_and_clear_bit(pos + i, mem_available_pages))
   1.249 +            of_panic("%s: pg :0x%lx was never allocated\n",
   1.250 +                     __func__, pos + i);
   1.251 +    }
   1.252 +}
   1.253 +#endif
   1.254 +
   1.255 +static ulong boot_of_alloc(ulong size)
   1.256 +{
   1.257 +    ulong bits;
   1.258 +    ulong pos;
   1.259 +
   1.260 +    if (size == 0)
   1.261 +        return 0;
   1.262 +
   1.263 +    DBG("%s(0x%lx)\n", __func__, size);
   1.264 +
   1.265 +    size = ALIGN_UP(size, PAGE_SIZE);
   1.266 +    bits = size >> PAGE_SHIFT;
   1.267 +    pos = 0;
   1.268 +    for (;;) {
   1.269 +        ulong i;
   1.270 +
   1.271 +        pos = find_next_zero_bit(mem_available_pages,
   1.272 +                                 MEM_AVAILABLE_PAGES, pos);
   1.273 +        DBG("%s: found start bit at: 0x%lx\n", __func__, pos);
   1.274 +
   1.275 +        /* found nothing */
   1.276 +        if ((pos + bits) > MEM_AVAILABLE_PAGES) {
   1.277 +            of_printf("%s: allocation of size: 0x%lx failed\n",
   1.278 +                     __func__, size);
   1.279 +            return 0;
   1.280 +        }
   1.281 +
   1.282 +        /* find a set that fits */
   1.283 +        DBG("%s: checking for 0x%lx bits: 0x%lx\n", __func__, bits, pos);
   1.284 +
   1.285 +        i = 1;
   1.286 +        while (i < bits && !test_bit(pos + i, mem_available_pages))
   1.287 +            ++i;
   1.288 +
   1.289 +        if (i == bits) {
   1.290 +            uint addr = pos << PAGE_SHIFT;
   1.291 +
   1.292 +            /* make sure OF is happy with our choice */
   1.293 +            if (of_claim(addr, size, 0) != OF_FAILURE) {
   1.294 +                for (i = 0; i < bits; i++)
   1.295 +                    set_bit(pos + i, mem_available_pages);
   1.296 +
   1.297 +                DBG("%s: 0x%lx is good returning 0x%x\n",
   1.298 +                    __func__, pos, addr);
   1.299 +                return addr;
   1.300 +            }
   1.301 +            /* if OF did not like the address then simply start from
   1.302 +             * the next bit */
   1.303 +            i = 1;
   1.304 +        }
   1.305 +
   1.306 +        pos = pos + i;
   1.307 +    }
   1.308 +}
   1.309 +
   1.310 +static ulong boot_of_mem_init(void)
   1.311  {
   1.312      int root;
   1.313      int p;
   1.314 -    u32 addr_cells = 1;
   1.315 -    u32 size_cells = 1;
   1.316      int rc;
   1.317 -    int mcount = 0;
   1.318 -    static memory_map_t mmap[16];
   1.319 +    uint addr_cells;
   1.320 +    uint size_cells;
   1.321  
   1.322      root = of_finddevice("/");
   1.323      p = of_getchild(root);
   1.324  
   1.325      /* code is writen to assume sizes of 1 */
   1.326 -    of_getprop(root, "#address-cells", &addr_cells, sizeof (addr_cells));
   1.327 -    of_getprop(root, "#size-cells", &size_cells, sizeof (size_cells));
   1.328 +    of_getprop(root, "#address-cells", &addr_cells,
   1.329 +               sizeof (addr_cells));
   1.330 +    of_getprop(root, "#size-cells", &size_cells,
   1.331 +               sizeof (size_cells));
   1.332      DBG("%s: address_cells=%d  size_cells=%d\n",
   1.333                      __func__, addr_cells, size_cells);
   1.334 -    
   1.335 +
   1.336 +    /* We do ream memory discovery later, for now we only want to find
   1.337 +     * the first LMB */
   1.338      do {
   1.339          const char memory[] = "memory";
   1.340          char type[32];
   1.341 @@ -394,67 +575,52 @@ static void boot_of_probemem(multiboot_i
   1.342  
   1.343          of_getprop(p, "device_type", type, sizeof (type));
   1.344          if (strncmp(type, memory, sizeof (memory)) == 0) {
   1.345 -            u32 reg[48];  
   1.346 -            u32 al, ah, ll, lh;
   1.347 +            uint reg[48];  
   1.348 +            u64 start;
   1.349 +            u64 size;
   1.350              int r;
   1.351 +            int l;
   1.352  
   1.353              rc = of_getprop(p, "reg", reg, sizeof (reg));
   1.354              if (rc == OF_FAILURE) {
   1.355                  of_panic("no reg property for memory node: 0x%x.\n", p);
   1.356              }
   1.357 -            int l = rc/sizeof(u32); /* number reg element */
   1.358 +
   1.359 +            l = rc / sizeof(reg[0]); /* number reg element */
   1.360              DBG("%s: number of bytes in property 'reg' %d\n",
   1.361                              __func__, rc);
   1.362              
   1.363              r = 0;
   1.364              while (r < l) {
   1.365 -                al = ah = ll = lh = 0;
   1.366 -                if (addr_cells == 2) {
   1.367 -                    ah = reg[r++];
   1.368 -                    if (r >= l)
   1.369 -                        break;  /* partial line.  Skip  */
   1.370 -                    al = reg[r++];
   1.371 -                    if (r >= l)
   1.372 -                        break;  /* partial line.  Skip */
   1.373 -                } else {
   1.374 -                    al = reg[r++];
   1.375 -                    if (r >= l)
   1.376 -                        break;  /* partial line.  Skip */
   1.377 -                }
   1.378 -                if (size_cells == 2) {
   1.379 -                    lh = reg[r++];
   1.380 -                    if (r >= l)
   1.381 -                        break;  /* partial line.  Skip */
   1.382 -                    ll = reg[r++];
   1.383 -                } else {
   1.384 -                    ll = reg[r++];
   1.385 +                start = reg[r++];
   1.386 +                if (addr_cells == 2 && (r < l) )
   1.387 +                    start = (start << 32) | reg[r++];
   1.388 +
   1.389 +                if (r >= l)
   1.390 +                    break;  /* partial line.  Skip */
   1.391 +
   1.392 +                if (start > 0) {
   1.393 +                    /* this is not the first LMB so we skip it */
   1.394 +                    break;
   1.395                  }
   1.396  
   1.397 -                if ((ll != 0) || (lh != 0)) {
   1.398 -                    mmap[mcount].size = 20; /* - size field */
   1.399 -                    mmap[mcount].type = 1; /* Regular ram */
   1.400 -                    mmap[mcount].length_high = lh;
   1.401 -                    mmap[mcount].length_low = ll;
   1.402 -                    mmap[mcount].base_addr_high = ah;
   1.403 -                    mmap[mcount].base_addr_low = al;
   1.404 -                    of_printf("%s: memory 0x%016lx[0x%08lx]\n",
   1.405 -                      __func__,
   1.406 -                      (u64)(((u64)mmap[mcount].base_addr_high << 32)
   1.407 -                            | mmap[mcount].base_addr_low),
   1.408 -                      (u64)(((u64)mmap[mcount].length_high << 32)
   1.409 -                            | mmap[mcount].length_low));
   1.410 -                    ++mcount;
   1.411 -                }
   1.412 +                size = reg[r++];
   1.413 +                if (size_cells == 2 && (r < l) )
   1.414 +                    size = (size << 32) | reg[r++];
   1.415 +                
   1.416 +                if (r >= l)
   1.417 +                    break;  /* partial line.  Skip */
   1.418 +
   1.419 +                boot_of_alloc_init(p, addr_cells, size_cells);
   1.420 +                
   1.421 +                eomem = size;
   1.422 +                return size;
   1.423              }
   1.424          }
   1.425          p = of_getpeer(p);
   1.426      } while (p != OF_FAILURE && p != 0);
   1.427  
   1.428 -    if (mcount > 0) {
   1.429 -        mbi->flags |= MBI_MEMMAP;
   1.430 -        mbi->mmap_length = sizeof (mmap[0]) * mcount;
   1.431 -        mbi->mmap_addr = (ulong)mmap;
   1.432 -    }
   1.433 +    return 0;
   1.434  }
   1.435  
   1.436  static void boot_of_bootargs(multiboot_info_t *mbi)
   1.437 @@ -571,7 +737,7 @@ retry:
   1.438      }
   1.439  }
   1.440  
   1.441 -static int pkg_save(void *mem)
   1.442 +static long pkg_save(void *mem)
   1.443  {
   1.444      int root;
   1.445      char path[256];
   1.446 @@ -587,7 +753,7 @@ static int pkg_save(void *mem)
   1.447  
   1.448      do_pkg(mem, OFD_ROOT, root, path, sizeof(path));
   1.449  
   1.450 -    r = (((ofdn_t *)mem)[1] + 1) * sizeof (u64);
   1.451 +    r = ofd_size(mem);
   1.452  
   1.453      of_printf("%s: saved device tree in 0x%x bytes\n", __func__, r);
   1.454  
   1.455 @@ -707,56 +873,6 @@ static int boot_of_fixup_chosen(void *me
   1.456      return rc;
   1.457  }
   1.458  
   1.459 -static ulong space_base;
   1.460 -
   1.461 -/*
   1.462 - * The following function is necessary because we cannot depend on all
   1.463 - * FW to actually allocate us any space, so we look for it _hoping_
   1.464 - * that at least is will fail if we try to claim something that
   1.465 - * belongs to FW.  This hope does not seem to be true on some version
   1.466 - * of PIBS.
   1.467 - */
   1.468 -static ulong find_space(u32 size, u32 align, multiboot_info_t *mbi)
   1.469 -{
   1.470 -    memory_map_t *map = (memory_map_t *)((ulong)mbi->mmap_addr);
   1.471 -    ulong eomem = ((u64)map->length_high << 32) | (u64)map->length_low;
   1.472 -    ulong base;
   1.473 -
   1.474 -    if (size == 0)
   1.475 -        return 0;
   1.476 -
   1.477 -    if (align == 0)
   1.478 -        of_panic("cannot call %s() with align of 0\n", __func__);
   1.479 -
   1.480 -#ifdef BROKEN_CLAIM_WORKAROUND
   1.481 -    {
   1.482 -        static int broken_claim;
   1.483 -        if (!broken_claim) {
   1.484 -            /* just try and claim it to the FW chosen address */
   1.485 -            base = of_claim(0, size, align);
   1.486 -            if (base != OF_FAILURE)
   1.487 -                return base;
   1.488 -            of_printf("%s: Firmware does not allocate memory for you\n",
   1.489 -                      __func__);
   1.490 -            broken_claim = 1;
   1.491 -        }
   1.492 -    }
   1.493 -#endif
   1.494 -
   1.495 -    of_printf("%s base=0x%016lx  eomem=0x%016lx  size=0x%08x  align=0x%x\n",
   1.496 -                    __func__, space_base, eomem, size, align);
   1.497 -    base = ALIGN_UP(space_base, PAGE_SIZE);
   1.498 -
   1.499 -    while ((base + size) < rma_size(cpu_default_rma_order_pages())) {
   1.500 -        if (of_claim(base, size, 0) != OF_FAILURE) {
   1.501 -            space_base = base + size;
   1.502 -            return base;
   1.503 -        }
   1.504 -        base += (PAGE_SIZE >  align) ? PAGE_SIZE : align;
   1.505 -    }
   1.506 -    of_panic("Cannot find memory in the RMA\n");
   1.507 -}
   1.508 -
   1.509  /* PIBS Version 1.05.0000 04/26/2005 has an incorrect /ht/isa/ranges
   1.510   * property.  The values are bad, and it doesn't even have the
   1.511   * right number of cells. */
   1.512 @@ -896,7 +1012,7 @@ static int __init boot_of_rtas(module_t 
   1.513      if (size == 0) {
   1.514          of_printf("RTAS, has no size\n");
   1.515          return 0;
   1.516 -    }        
   1.517 +    }
   1.518  
   1.519      rtas_instance = of_open("/rtas");
   1.520      if (rtas_instance == OF_FAILURE) {
   1.521 @@ -906,10 +1022,12 @@ static int __init boot_of_rtas(module_t 
   1.522  
   1.523      size = ALIGN_UP(size, PAGE_SIZE);
   1.524      
   1.525 -    mem = find_space(size, PAGE_SIZE, mbi);
   1.526 +    mem = boot_of_alloc(size);
   1.527      if (mem == 0)
   1.528          of_panic("Could not allocate RTAS tree\n");
   1.529  
   1.530 +    of_printf("instantiating RTAS at: 0x%x\n", mem);
   1.531 +
   1.532      ret = of_call("call-method", 3, 2, res,
   1.533                    "instantiate-rtas", rtas_instance, mem);
   1.534      if (ret == OF_FAILURE) {
   1.535 @@ -933,11 +1051,11 @@ static void * __init boot_of_devtree(mod
   1.536      ulong oft_sz = 48 * PAGE_SIZE;
   1.537  
   1.538      /* snapshot the tree */
   1.539 -    oft = (void*)find_space(oft_sz, PAGE_SIZE, mbi);
   1.540 -    if (oft == 0)
   1.541 +    oft = (void *)boot_of_alloc(oft_sz);
   1.542 +    if (oft == NULL)
   1.543          of_panic("Could not allocate OFD tree\n");
   1.544  
   1.545 -    of_printf("creating oftree\n");
   1.546 +    of_printf("creating oftree at: 0x%p\n", oft);
   1.547      of_test("package-to-path");
   1.548      oft = ofd_create(oft, oft_sz);
   1.549      pkg_save(oft);
   1.550 @@ -1014,8 +1132,6 @@ static void * __init boot_of_module(ulon
   1.551          of_printf("mod0: %o %c %c %c\n", c[0], c[1], c[2], c[3]);
   1.552      }
   1.553  
   1.554 -    space_base = (ulong)_end;
   1.555 -
   1.556      mod = 0;
   1.557      mods[mod].mod_start = mod0_start;
   1.558      mods[mod].mod_end = mod0_start + mod0_size;
   1.559 @@ -1036,6 +1152,7 @@ static void * __init boot_of_module(ulon
   1.560          ++mod;
   1.561  
   1.562      oft = boot_of_devtree(&mods[mod], mbi);
   1.563 +    of_printf("hello\n");
   1.564      if (oft == NULL)
   1.565          of_panic("%s: boot_of_devtree failed\n", __func__);
   1.566  
   1.567 @@ -1192,14 +1309,14 @@ multiboot_info_t __init *boot_of_init(
   1.568              r3, r4, vec, r6, r7, orig_msr);
   1.569  
   1.570      if ((vec >= (ulong)_start) && (vec <= (ulong)_end)) {
   1.571 -        of_printf("Hmm.. OF[0x%lx] seems to have stepped on our image "
   1.572 -                "that ranges: %p .. %p.\n HANG!\n",
   1.573 +        of_panic("Hmm.. OF[0x%lx] seems to have stepped on our image "
   1.574 +                "that ranges: %p .. %p.\n",
   1.575                  vec, _start, _end);
   1.576      }
   1.577      of_printf("%s: _start %p _end %p 0x%lx\n", __func__, _start, _end, r6);
   1.578  
   1.579      boot_of_fix_maple();
   1.580 -    boot_of_probemem(&mbi);
   1.581 +    boot_of_mem_init();
   1.582      boot_of_bootargs(&mbi);
   1.583      oft = boot_of_module(r3, r4, &mbi);
   1.584      boot_of_cpus();
     2.1 --- a/xen/arch/powerpc/setup.c	Tue Nov 21 15:25:02 2006 -0600
     2.2 +++ b/xen/arch/powerpc/setup.c	Wed Nov 22 14:35:09 2006 -0500
     2.3 @@ -301,10 +301,6 @@ static void __init __start_xen(multiboot
     2.4          panic("FATAL ERROR: Require at least one Multiboot module.\n");
     2.5      }
     2.6  
     2.7 -    if (!(mbi->flags & MBI_MEMMAP)) {
     2.8 -        panic("FATAL ERROR: Bootloader provided no memory information.\n");
     2.9 -    }
    2.10 -
    2.11      /* OF dev tree is the last module */
    2.12      oftree = mod[mbi->mods_count-1].mod_start;
    2.13      oftree_end = mod[mbi->mods_count-1].mod_end;