Revision e61c36d5 hw/ppce500_mpc8544ds.c

b/hw/ppce500_mpc8544ds.c
226 226
                         const char *cpu_model)
227 227
{
228 228
    PCIBus *pci_bus;
229
    CPUState *env;
229
    CPUState *env = NULL;
230 230
    uint64_t elf_entry;
231 231
    uint64_t elf_lowaddr;
232 232
    target_phys_addr_t entry=0;
......
240 240
    qemu_irq *irqs, *mpic;
241 241
    DeviceState *dev;
242 242
    struct boot_info *boot_info;
243
    CPUState *firstenv = NULL;
243 244

  
244
    /* Setup CPU */
245
    /* Setup CPUs */
245 246
    if (cpu_model == NULL) {
246 247
        cpu_model = "e500v2_v30";
247 248
    }
248 249

  
249
    env = cpu_ppc_init(cpu_model);
250
    if (!env) {
251
        fprintf(stderr, "Unable to initialize CPU!\n");
252
        exit(1);
253
    }
250
    for (i = 0; i < smp_cpus; i++) {
251
        qemu_irq *input;
252
        env = cpu_ppc_init(cpu_model);
253
        if (!env) {
254
            fprintf(stderr, "Unable to initialize CPU!\n");
255
            exit(1);
256
        }
257

  
258
        if (!firstenv) {
259
            firstenv = env;
260
        }
254 261

  
255
    /* XXX register timer? */
256
    ppc_emb_timers_init(env, 400000000, PPC_INTERRUPT_DECR);
257
    ppc_dcr_init(env, NULL, NULL);
262
        env->spr[SPR_BOOKE_PIR] = env->cpu_index = i;
258 263

  
259
    /* Register reset handler */
260
    qemu_register_reset(mpc8544ds_cpu_reset, env);
264
        /* XXX register timer? */
265
        ppc_emb_timers_init(env, 400000000, PPC_INTERRUPT_DECR);
266
        ppc_dcr_init(env, NULL, NULL);
267
        /* XXX Enable DEC interrupts - probably wrong in the backend */
268
        env->spr[SPR_40x_TCR] = 1 << 26;
269

  
270
        /* Register reset handler */
271
        boot_info = g_malloc0(sizeof(struct boot_info));
272
        qemu_register_reset(mpc8544ds_cpu_reset, env);
273
        env->load_info = boot_info;
274
    }
275

  
276
    env = firstenv;
261 277

  
262 278
    /* Fixup Memory size on a alignment boundary */
263 279
    ram_size &= ~(RAM_SIZES_ALIGN - 1);
......
336 352
        }
337 353
    }
338 354

  
339
    boot_info = g_malloc0(sizeof(struct boot_info));
340

  
341 355
    /* If we're loading a kernel directly, we must load the device tree too. */
342 356
    if (kernel_filename) {
343 357
#ifndef CONFIG_FDT
......
350 364
            exit(1);
351 365
        }
352 366

  
367
        boot_info = env->load_info;
353 368
        boot_info->entry = entry;
354 369
        boot_info->dt_base = dt_base;
355 370
    }
356
    env->load_info = boot_info;
357 371

  
358 372
    if (kvm_enabled()) {
359 373
        kvmppc_init();

Also available in: Unified diff