mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
hw/versatile_pci: Expose multiple sysbus mmio regions
Clean up versatile_pci to expose the various PCI mmio regions properly as separate mmio regions rather than as a single mmio which uses callbacks to map and unmap everything. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
dd236a50aa
commit
7d6e771f49
3 changed files with 28 additions and 38 deletions
|
@ -58,38 +58,6 @@ static void pci_vpb_set_irq(void *opaque, int irq_num, int level)
|
|||
qemu_set_irq(pic[irq_num], level);
|
||||
}
|
||||
|
||||
|
||||
static void pci_vpb_map(SysBusDevice *dev, target_phys_addr_t base)
|
||||
{
|
||||
PCIVPBState *s = (PCIVPBState *)dev;
|
||||
/* Selfconfig area. */
|
||||
memory_region_add_subregion(get_system_memory(), base + 0x01000000,
|
||||
&s->mem_config);
|
||||
/* Normal config area. */
|
||||
memory_region_add_subregion(get_system_memory(), base + 0x02000000,
|
||||
&s->mem_config2);
|
||||
|
||||
if (s->realview) {
|
||||
/* IO memory area. */
|
||||
memory_region_add_subregion(get_system_memory(), base + 0x03000000,
|
||||
&s->isa);
|
||||
}
|
||||
}
|
||||
|
||||
static void pci_vpb_unmap(SysBusDevice *dev, target_phys_addr_t base)
|
||||
{
|
||||
PCIVPBState *s = (PCIVPBState *)dev;
|
||||
/* Selfconfig area. */
|
||||
memory_region_del_subregion(get_system_memory(), &s->mem_config);
|
||||
/* Normal config area. */
|
||||
memory_region_del_subregion(get_system_memory(), &s->mem_config2);
|
||||
|
||||
if (s->realview) {
|
||||
/* IO memory area. */
|
||||
memory_region_del_subregion(get_system_memory(), &s->isa);
|
||||
}
|
||||
}
|
||||
|
||||
static int pci_vpb_init(SysBusDevice *dev)
|
||||
{
|
||||
PCIVPBState *s = FROM_SYSBUS(PCIVPBState, dev);
|
||||
|
@ -106,16 +74,22 @@ static int pci_vpb_init(SysBusDevice *dev)
|
|||
|
||||
/* ??? Register memory space. */
|
||||
|
||||
/* Our memory regions are:
|
||||
* 0 : PCI self config window
|
||||
* 1 : PCI config window
|
||||
* 2 : PCI IO window (realview_pci only)
|
||||
*/
|
||||
memory_region_init_io(&s->mem_config, &pci_vpb_config_ops, bus,
|
||||
"pci-vpb-selfconfig", 0x1000000);
|
||||
sysbus_init_mmio_region(dev, &s->mem_config);
|
||||
memory_region_init_io(&s->mem_config2, &pci_vpb_config_ops, bus,
|
||||
"pci-vpb-config", 0x1000000);
|
||||
sysbus_init_mmio_region(dev, &s->mem_config2);
|
||||
if (s->realview) {
|
||||
isa_mmio_setup(&s->isa, 0x0100000);
|
||||
sysbus_init_mmio_region(dev, &s->isa);
|
||||
}
|
||||
|
||||
sysbus_init_mmio_cb2(dev, pci_vpb_map, pci_vpb_unmap);
|
||||
|
||||
pci_create_simple(bus, -1, "versatile_pci_host");
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue