Revision e9df014c hw/ppc_chrp.c

b/hw/ppc_chrp.c
23 23
 */
24 24
#include "vl.h"
25 25

  
26
/* SMP is not enabled, for now */
27
#define MAX_CPUS 1
28

  
26 29
#define BIOS_FILENAME "ppc_rom.bin"
27 30
#define VGABIOS_FILENAME "video.x"
28 31
#define NVRAM_SIZE        0x2000
......
296 299
                           const char *cpu_model,
297 300
                           int is_heathrow)
298 301
{
299
    CPUState *env;
302
    CPUState *env, *envs[MAX_CPUS];
300 303
    char buf[1024];
301
    qemu_irq *pic;
304
    qemu_irq *pic, **openpic_irqs;
302 305
    m48t59_t *nvram;
303 306
    int unin_memory;
304 307
    int linux_boot, i;
......
329 332
    if (def == NULL) {
330 333
        cpu_abort(env, "Unable to find PowerPC CPU definition\n");
331 334
    }
332
    cpu_ppc_register(env, def);
333
    cpu_ppc_irq_init_cpu(env);
334

  
335
    /* Set time-base frequency to 100 Mhz */
336
    cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL);
337
    
338
    env->osi_call = vga_osi_call;
335
    for (i = 0; i < smp_cpus; i++) {
336
        cpu_ppc_register(env, def);
337
        /* Set time-base frequency to 100 Mhz */
338
        cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL);
339
        env->osi_call = vga_osi_call;
340
        envs[i] = env;
341
    }
339 342

  
340 343
    /* allocate RAM */
341 344
    cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
......
458 461
        unin_memory = cpu_register_io_memory(0, unin_read, unin_write, NULL);
459 462
        cpu_register_physical_memory(0xf8000000, 0x00001000, unin_memory);
460 463

  
461
        pic = openpic_init(NULL, &ppc_openpic_irq, &openpic_mem_index, 1, &env);
464
        openpic_irqs = qemu_mallocz(smp_cpus * sizeof(qemu_irq *));
465
        openpic_irqs[0] =
466
            qemu_mallocz(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB);
467
        for (i = 0; i < smp_cpus; i++) {
468
            /* Mac99 IRQ connection between OpenPIC outputs pins
469
             * and PowerPC input pins
470
             */
471
            openpic_irqs[i] = openpic_irqs[0] + (i * OPENPIC_OUTPUT_NB);
472
            openpic_irqs[i][OPENPIC_OUTPUT_INT] =
473
                ((qemu_irq *)env->irq_inputs)[PPC_INPUT_INT];
474
            openpic_irqs[i][OPENPIC_OUTPUT_CINT] =
475
                ((qemu_irq *)env->irq_inputs)[PPC_INPUT_INT];
476
            openpic_irqs[i][OPENPIC_OUTPUT_MCK] =
477
                ((qemu_irq *)env->irq_inputs)[PPC_INPUT_MCP];
478
            openpic_irqs[i][OPENPIC_OUTPUT_DEBUG] = NULL; /* Not connected ? */
479
            openpic_irqs[i][OPENPIC_OUTPUT_RESET] =
480
                ((qemu_irq *)env->irq_inputs)[PPC_INPUT_HRESET]; /* Check this */
481
        }
482
        pic = openpic_init(NULL, &openpic_mem_index, smp_cpus,
483
                           openpic_irqs, NULL);
462 484
        pci_bus = pci_pmac_init(pic);
463 485
        /* init basic PC hardware */
464 486
        pci_vga_init(pci_bus, ds, phys_ram_base + ram_size,

Also available in: Unified diff