~ubuntu-branches/ubuntu/trusty/qemu/trusty

« back to all changes in this revision

Viewing changes to hw/ppc/prep.c

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2013-10-22 22:47:07 UTC
  • mfrom: (1.8.3) (10.1.42 sid)
  • Revision ID: package-import@ubuntu.com-20131022224707-1lya34fw3k3f24tv
Tags: 1.6.0+dfsg-2ubuntu1
* Merge 1.6.0~rc0+dfsg-2exp from debian experimental.  Remaining changes:
  - debian/control
    * update maintainer
    * remove libiscsi, usb-redir, vde, vnc-jpeg, and libssh2-1-dev
      from build-deps
    * enable rbd
    * add qemu-system and qemu-common B/R to qemu-keymaps
    * add D:udev, R:qemu, R:qemu-common and B:qemu-common to
      qemu-system-common
    * qemu-system-arm, qemu-system-ppc, qemu-system-sparc:
      - add qemu-kvm to Provides
      - add qemu-common, qemu-kvm, kvm to B/R
      - remove openbios-sparc from qemu-system-sparc D
      - drop openbios-ppc and openhackware Depends to Suggests (for now)
    * qemu-system-x86:
      - add qemu-common to Breaks/Replaces.
      - add cpu-checker to Recommends.
    * qemu-user: add B/R:qemu-kvm
    * qemu-kvm:
      - add armhf armel powerpc sparc to Architecture
      - C/R/P: qemu-kvm-spice
    * add qemu-common package
    * drop qemu-slof which is not packaged in ubuntu
  - add qemu-system-common.links for tap ifup/down scripts and OVMF link.
  - qemu-system-x86.links:
    * remove pxe rom links which are in kvm-ipxe
    * add symlink for kvm.1 manpage
  - debian/rules
    * add kvm-spice symlink to qemu-kvm
    * call dh_installmodules for qemu-system-x86
    * update dh_installinit to install upstart script
    * run dh_installman (Closes: #709241) (cherrypicked from 1.5.0+dfsg-2)
  - Add qemu-utils.links for kvm-* symlinks.
  - Add qemu-system-x86.qemu-kvm.upstart and .default
  - Add qemu-system-x86.modprobe to set nesting=1
  - Add qemu-system-common.preinst to add kvm group
  - qemu-system-common.postinst: remove bad group acl if there, then have
    udev relabel /dev/kvm.
  - New linaro patches from qemu-linaro rebasing branch
  - Dropped patches:
    * xen-simplify-xen_enabled.patch
    * sparc-linux-user-fix-missing-symbols-in-.rel-.rela.plt-sections.patch
    * main_loop-do-not-set-nonblocking-if-xen_enabled.patch
    * xen_machine_pv-do-not-create-a-dummy-CPU-in-machine-.patch
    * virtio-rng-fix-crash
  - Kept patches:
    * expose_vms_qemu64cpu.patch - updated
    * linaro arm patches from qemu-linaro rebasing branch
  - New patches:
    * fix-pci-add: change CONFIG variable in ifdef to make sure that
      pci_add is defined.
* Add linaro patches
* Add experimental mach-virt patches for arm virtualization.
* qemu-system-common.install: add debian/tmp/usr/lib to install the
  qemu-bridge-helper

Show diffs side-by-side

added added

removed removed

Lines of Context:
410
410
        .read = { PPC_prep_io_readb, PPC_prep_io_readw, PPC_prep_io_readl },
411
411
        .write = { PPC_prep_io_writeb, PPC_prep_io_writew, PPC_prep_io_writel },
412
412
    },
413
 
    .endianness = DEVICE_LITTLE_ENDIAN,
 
413
    .endianness = DEVICE_NATIVE_ENDIAN,
414
414
};
415
415
 
416
416
#define NVRAM_SIZE        0x2000
417
417
 
418
418
static void cpu_request_exit(void *opaque, int irq, int level)
419
419
{
420
 
    CPUPPCState *env = cpu_single_env;
 
420
    CPUState *cpu = current_cpu;
421
421
 
422
 
    if (env && level) {
423
 
        cpu_exit(env);
 
422
    if (cpu && level) {
 
423
        cpu_exit(cpu);
424
424
    }
425
425
}
426
426
 
434
434
    cpu->env.nip = 0xfffffffc;
435
435
}
436
436
 
 
437
static const MemoryRegionPortio prep_portio_list[] = {
 
438
    /* System control ports */
 
439
    { 0x0092, 1, 1, .read = PREP_io_800_readb, .write = PREP_io_800_writeb, },
 
440
    { 0x0800, 0x52, 1,
 
441
      .read = PREP_io_800_readb, .write = PREP_io_800_writeb, },
 
442
    /* Special port to get debug messages from Open-Firmware */
 
443
    { 0x0F00, 4, 1, .write = PPC_debug_write, },
 
444
    PORTIO_END_OF_LIST(),
 
445
};
 
446
 
437
447
/* PowerPC PREP hardware initialisation */
438
448
static void ppc_prep_init(QEMUMachineInitArgs *args)
439
449
{
450
460
    nvram_t nvram;
451
461
    M48t59State *m48t59;
452
462
    MemoryRegion *PPC_io_memory = g_new(MemoryRegion, 1);
 
463
    PortioList *port_list = g_new(PortioList, 1);
453
464
#if 0
454
465
    MemoryRegion *xcsr = g_new(MemoryRegion, 1);
455
466
#endif
494
505
    }
495
506
 
496
507
    /* allocate RAM */
497
 
    memory_region_init_ram(ram, "ppc_prep.ram", ram_size);
 
508
    memory_region_init_ram(ram, NULL, "ppc_prep.ram", ram_size);
498
509
    vmstate_register_ram_global(ram);
499
510
    memory_region_add_subregion(sysmem, 0, ram);
500
511
 
501
512
    /* allocate and load BIOS */
502
 
    memory_region_init_ram(bios, "ppc_prep.bios", BIOS_SIZE);
 
513
    memory_region_init_ram(bios, NULL, "ppc_prep.bios", BIOS_SIZE);
503
514
    memory_region_set_readonly(bios, true);
504
515
    memory_region_add_subregion(sysmem, (uint32_t)(-BIOS_SIZE), bios);
505
516
    vmstate_register_ram_global(bios);
594
605
    /* PCI -> ISA bridge */
595
606
    pci = pci_create_simple(pci_bus, PCI_DEVFN(1, 0), "i82378");
596
607
    cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1);
 
608
    cpu = POWERPC_CPU(first_cpu);
597
609
    qdev_connect_gpio_out(&pci->qdev, 0,
598
 
                          first_cpu->irq_inputs[PPC6xx_INPUT_INT]);
 
610
                          cpu->env.irq_inputs[PPC6xx_INPUT_INT]);
599
611
    qdev_connect_gpio_out(&pci->qdev, 1, *cpu_exit_irq);
600
612
    sysbus_connect_irq(&pcihost->busdev, 0, qdev_get_gpio_in(&pci->qdev, 9));
601
613
    sysbus_connect_irq(&pcihost->busdev, 1, qdev_get_gpio_in(&pci->qdev, 11));
602
614
    sysbus_connect_irq(&pcihost->busdev, 2, qdev_get_gpio_in(&pci->qdev, 9));
603
615
    sysbus_connect_irq(&pcihost->busdev, 3, qdev_get_gpio_in(&pci->qdev, 11));
604
 
    isa_bus = DO_UPCAST(ISABus, qbus, qdev_get_child_bus(&pci->qdev, "isa.0"));
 
616
    isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(pci), "isa.0"));
605
617
 
606
618
    /* Super I/O (parallel + serial ports) */
607
619
    isa = isa_create(isa_bus, TYPE_PC87312);
608
 
    qdev_prop_set_uint8(&isa->qdev, "config", 13); /* fdc, ser0, ser1, par0 */
609
 
    qdev_init_nofail(&isa->qdev);
 
620
    dev = DEVICE(isa);
 
621
    qdev_prop_set_uint8(dev, "config", 13); /* fdc, ser0, ser1, par0 */
 
622
    qdev_init_nofail(dev);
610
623
 
611
624
    /* Register 8 MB of ISA IO space (needed for non-contiguous map) */
612
 
    memory_region_init_io(PPC_io_memory, &PPC_prep_io_ops, sysctrl,
 
625
    memory_region_init_io(PPC_io_memory, NULL, &PPC_prep_io_ops, sysctrl,
613
626
                          "ppc-io", 0x00800000);
614
627
    memory_region_add_subregion(sysmem, 0x80000000, PPC_io_memory);
615
628
 
627
640
            isa_ne2000_init(isa_bus, ne2000_io[i], ne2000_irq[i],
628
641
                            &nd_table[i]);
629
642
        } else {
630
 
            pci_nic_init_nofail(&nd_table[i], "ne2k_pci", NULL);
 
643
            pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL);
631
644
        }
632
645
    }
633
646
 
639
652
    }
640
653
    isa_create_simple(isa_bus, "i8042");
641
654
 
642
 
    sysctrl->reset_irq = first_cpu->irq_inputs[PPC6xx_INPUT_HRESET];
643
 
    /* System control ports */
644
 
    register_ioport_read(0x0092, 0x01, 1, &PREP_io_800_readb, sysctrl);
645
 
    register_ioport_write(0x0092, 0x01, 1, &PREP_io_800_writeb, sysctrl);
646
 
    register_ioport_read(0x0800, 0x52, 1, &PREP_io_800_readb, sysctrl);
647
 
    register_ioport_write(0x0800, 0x52, 1, &PREP_io_800_writeb, sysctrl);
 
655
    cpu = POWERPC_CPU(first_cpu);
 
656
    sysctrl->reset_irq = cpu->env.irq_inputs[PPC6xx_INPUT_HRESET];
 
657
 
 
658
    portio_list_init(port_list, NULL, prep_portio_list, sysctrl, "prep");
 
659
    portio_list_add(port_list, get_system_io(), 0x0);
 
660
 
648
661
    /* PowerPC control and status register group */
649
662
#if 0
650
 
    memory_region_init_io(xcsr, &PPC_XCSR_ops, NULL, "ppc-xcsr", 0x1000);
 
663
    memory_region_init_io(xcsr, NULL, &PPC_XCSR_ops, NULL, "ppc-xcsr", 0x1000);
651
664
    memory_region_add_subregion(sysmem, 0xFEFF0000, xcsr);
652
665
#endif
653
666
 
671
684
                         /* XXX: need an option to load a NVRAM image */
672
685
                         0,
673
686
                         graphic_width, graphic_height, graphic_depth);
674
 
 
675
 
    /* Special port to get debug messages from Open-Firmware */
676
 
    register_ioport_write(0x0F00, 4, 1, &PPC_debug_write, NULL);
677
687
}
678
688
 
679
689
static QEMUMachine prep_machine = {