Revision 39ac8455 hw/spapr.c

b/hw/spapr.c
40 40
#define KERNEL_LOAD_ADDR        0x00000000
41 41
#define INITRD_LOAD_ADDR        0x02800000
42 42
#define FDT_MAX_SIZE            0x10000
43
#define RTAS_MAX_SIZE           0x10000
43 44

  
44 45
#define TIMEBASE_FREQ           512000000ULL
45 46

  
......
53 54
                              target_phys_addr_t initrd_base,
54 55
                              target_phys_addr_t initrd_size,
55 56
                              const char *kernel_cmdline,
57
                              target_phys_addr_t rtas_addr,
58
                              target_phys_addr_t rtas_size,
56 59
                              long hash_shift)
57 60
{
58 61
    void *fdt;
......
195 198
        exit(1);
196 199
    }
197 200

  
201
    /* RTAS */
202
    ret = spapr_rtas_device_tree_setup(fdt, rtas_addr, rtas_size);
203
    if (ret < 0) {
204
        fprintf(stderr, "Couldn't set up RTAS device tree properties\n");
205
    }
206

  
198 207
    _FDT((fdt_pack(fdt)));
199 208

  
200 209
    *fdt_size = fdt_totalsize(fdt);
......
224 233
    void *fdt, *htab;
225 234
    int i;
226 235
    ram_addr_t ram_offset;
227
    target_phys_addr_t fdt_addr;
236
    target_phys_addr_t fdt_addr, rtas_addr;
228 237
    uint32_t kernel_base, initrd_base;
229
    long kernel_size, initrd_size, htab_size;
238
    long kernel_size, initrd_size, htab_size, rtas_size;
230 239
    long pteg_shift = 17;
231 240
    int fdt_size;
241
    char *filename;
232 242

  
233 243
    spapr = qemu_malloc(sizeof(*spapr));
234 244
    cpu_ppc_hypercall = emulate_spapr_hypercall;
......
237 247
     * 2GB, so that it can be processed with 32-bit code if
238 248
     * necessary */
239 249
    fdt_addr = MIN(ram_size, 0x80000000) - FDT_MAX_SIZE;
250
    /* RTAS goes just below that */
251
    rtas_addr = fdt_addr - RTAS_MAX_SIZE;
240 252

  
241 253
    /* init CPUs */
242 254
    if (cpu_model == NULL) {
......
276 288
        envs[i]->htab_mask = htab_size - 1;
277 289
    }
278 290

  
291
    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "spapr-rtas.bin");
292
    rtas_size = load_image_targphys(filename, rtas_addr, ram_size - rtas_addr);
293
    if (rtas_size < 0) {
294
        hw_error("qemu: could not load LPAR rtas '%s'\n", filename);
295
        exit(1);
296
    }
297
    qemu_free(filename);
298

  
279 299
    spapr->vio_bus = spapr_vio_bus_init();
280 300

  
281 301
    for (i = 0; i < MAX_SERIAL_PORTS; i++) {
......
323 343
    /* Prepare the device tree */
324 344
    fdt = spapr_create_fdt(&fdt_size, ram_size, cpu_model, envs, spapr,
325 345
                           initrd_base, initrd_size, kernel_cmdline,
326
                           pteg_shift + 7);
346
                           rtas_addr, rtas_size, pteg_shift + 7);
327 347
    assert(fdt != NULL);
328 348

  
329 349
    cpu_physical_memory_write(fdt_addr, fdt, fdt_size);

Also available in: Unified diff