prep_pci: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
cd5cba7941
commit
f81138ce97
|
@ -34,6 +34,7 @@ struct PCIHostState {
|
||||||
SysBusDevice busdev;
|
SysBusDevice busdev;
|
||||||
MemoryRegion conf_mem;
|
MemoryRegion conf_mem;
|
||||||
MemoryRegion data_mem;
|
MemoryRegion data_mem;
|
||||||
|
MemoryRegion mmcfg;
|
||||||
MemoryRegion *address_space;
|
MemoryRegion *address_space;
|
||||||
uint32_t config_reg;
|
uint32_t config_reg;
|
||||||
PCIBus *bus;
|
PCIBus *bus;
|
||||||
|
|
|
@ -86,16 +86,12 @@ static uint32_t PPC_PCIIO_readl (void *opaque, target_phys_addr_t addr)
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CPUWriteMemoryFunc * const PPC_PCIIO_write[] = {
|
static const MemoryRegionOps PPC_PCIIO_ops = {
|
||||||
&PPC_PCIIO_writeb,
|
.old_mmio = {
|
||||||
&PPC_PCIIO_writew,
|
.read = { PPC_PCIIO_readb, PPC_PCIIO_readw, PPC_PCIIO_readl, },
|
||||||
&PPC_PCIIO_writel,
|
.write = { PPC_PCIIO_writeb, PPC_PCIIO_writew, PPC_PCIIO_writel, },
|
||||||
};
|
},
|
||||||
|
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||||
static CPUReadMemoryFunc * const PPC_PCIIO_read[] = {
|
|
||||||
&PPC_PCIIO_readb,
|
|
||||||
&PPC_PCIIO_readw,
|
|
||||||
&PPC_PCIIO_readl,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int prep_map_irq(PCIDevice *pci_dev, int irq_num)
|
static int prep_map_irq(PCIDevice *pci_dev, int irq_num)
|
||||||
|
@ -116,7 +112,6 @@ PCIBus *pci_prep_init(qemu_irq *pic,
|
||||||
{
|
{
|
||||||
PREPPCIState *s;
|
PREPPCIState *s;
|
||||||
PCIDevice *d;
|
PCIDevice *d;
|
||||||
int PPC_io_memory;
|
|
||||||
|
|
||||||
s = g_malloc0(sizeof(PREPPCIState));
|
s = g_malloc0(sizeof(PREPPCIState));
|
||||||
s->bus = pci_register_bus(NULL, "pci",
|
s->bus = pci_register_bus(NULL, "pci",
|
||||||
|
@ -135,10 +130,8 @@ PCIBus *pci_prep_init(qemu_irq *pic,
|
||||||
memory_region_add_subregion(address_space_io, 0xcfc, &s->data_mem);
|
memory_region_add_subregion(address_space_io, 0xcfc, &s->data_mem);
|
||||||
sysbus_init_ioports(&s->busdev, 0xcfc, 1);
|
sysbus_init_ioports(&s->busdev, 0xcfc, 1);
|
||||||
|
|
||||||
PPC_io_memory = cpu_register_io_memory(PPC_PCIIO_read,
|
memory_region_init_io(&s->mmcfg, &PPC_PCIIO_ops, s, "pciio", 0x00400000);
|
||||||
PPC_PCIIO_write, s,
|
memory_region_add_subregion(address_space_mem, 0x80800000, &s->mmcfg);
|
||||||
DEVICE_NATIVE_ENDIAN);
|
|
||||||
cpu_register_physical_memory(0x80800000, 0x00400000, PPC_io_memory);
|
|
||||||
|
|
||||||
/* PCI host bridge */
|
/* PCI host bridge */
|
||||||
d = pci_register_device(s->bus, "PREP Host Bridge - Motorola Raven",
|
d = pci_register_device(s->bus, "PREP Host Bridge - Motorola Raven",
|
||||||
|
|
Reference in New Issue