diff options
author | Avi Kivity <avi@redhat.com> | 2011-07-24 17:47:18 +0300 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-09-04 17:46:50 +0300 |
commit | d0ed8076cbdc26138a7e33fed5e45a35d019a103 (patch) | |
tree | 5d63c2c4796d4ba51e7f4c2f8b44f22f9c19904f /hw/ppce500_pci.c | |
parent | 2b985d9c29efdd0a8394ad6b2edd2ba1acdb3536 (diff) |
pci_host: convert conf index and data ports to memory API
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/ppce500_pci.c')
-rw-r--r-- | hw/ppce500_pci.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/hw/ppce500_pci.c b/hw/ppce500_pci.c index 4390aeb559..2db365d0b6 100644 --- a/hw/ppce500_pci.c +++ b/hw/ppce500_pci.c @@ -79,8 +79,6 @@ struct PPCE500PCIState { uint32_t gasket_time; qemu_irq irq[4]; /* mmio maps */ - int cfgaddr; - int cfgdata; int reg; }; @@ -268,18 +266,18 @@ static void e500_pci_map(SysBusDevice *dev, target_phys_addr_t base) PCIHostState *h = FROM_SYSBUS(PCIHostState, sysbus_from_qdev(dev)); PPCE500PCIState *s = DO_UPCAST(PPCE500PCIState, pci_state, h); - cpu_register_physical_memory(base + PCIE500_CFGADDR, 4, s->cfgaddr); - cpu_register_physical_memory(base + PCIE500_CFGDATA, 4, s->cfgdata); + sysbus_add_memory(dev, base + PCIE500_CFGADDR, &h->conf_mem); + sysbus_add_memory(dev, base + PCIE500_CFGDATA, &h->data_mem); cpu_register_physical_memory(base + PCIE500_REG_BASE, PCIE500_REG_SIZE, s->reg); } static void e500_pci_unmap(SysBusDevice *dev, target_phys_addr_t base) { - cpu_register_physical_memory(base + PCIE500_CFGADDR, 4, - IO_MEM_UNASSIGNED); - cpu_register_physical_memory(base + PCIE500_CFGDATA, 4, - IO_MEM_UNASSIGNED); + PCIHostState *h = FROM_SYSBUS(PCIHostState, sysbus_from_qdev(dev)); + + sysbus_del_memory(dev, &h->conf_mem); + sysbus_del_memory(dev, &h->data_mem); cpu_register_physical_memory(base + PCIE500_REG_BASE, PCIE500_REG_SIZE, IO_MEM_UNASSIGNED); } @@ -309,9 +307,10 @@ static int e500_pcihost_initfn(SysBusDevice *dev) pci_create_simple(b, 0, "e500-host-bridge"); - s->cfgaddr = pci_host_conf_register_mmio(&s->pci_state, DEVICE_BIG_ENDIAN); - s->cfgdata = pci_host_data_register_mmio(&s->pci_state, - DEVICE_LITTLE_ENDIAN); + memory_region_init_io(&h->conf_mem, &pci_host_conf_be_ops, h, + "pci-conf-idx", 4); + memory_region_init_io(&h->data_mem, &pci_host_data_le_ops, h, + "pci-conf-data", 4); s->reg = cpu_register_io_memory(e500_pci_reg_read, e500_pci_reg_write, s, DEVICE_BIG_ENDIAN); sysbus_init_mmio_cb2(dev, e500_pci_map, e500_pci_unmap); |