mirror of
https://github.com/qemu/qemu.git
synced 2024-11-24 03:13:44 +08:00
hw/n*: pass owner to memory_region_init* functions
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
3c16154210
commit
eedfac6f38
@ -1163,7 +1163,8 @@ static int gem_init(SysBusDevice *dev)
|
||||
|
||||
s = FROM_SYSBUS(GemState, dev);
|
||||
gem_init_register_masks(s);
|
||||
memory_region_init_io(&s->iomem, NULL, &gem_ops, s, "enet", sizeof(s->regs));
|
||||
memory_region_init_io(&s->iomem, OBJECT(s), &gem_ops, s,
|
||||
"enet", sizeof(s->regs));
|
||||
sysbus_init_mmio(dev, &s->iomem);
|
||||
sysbus_init_irq(dev, &s->irq);
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
|
@ -1276,13 +1276,13 @@ e1000_mmio_setup(E1000State *d)
|
||||
E1000_IMC, E1000_TCTL, E1000_TDT, PNPMMIO_SIZE
|
||||
};
|
||||
|
||||
memory_region_init_io(&d->mmio, NULL, &e1000_mmio_ops, d, "e1000-mmio",
|
||||
PNPMMIO_SIZE);
|
||||
memory_region_init_io(&d->mmio, OBJECT(d), &e1000_mmio_ops, d,
|
||||
"e1000-mmio", PNPMMIO_SIZE);
|
||||
memory_region_add_coalescing(&d->mmio, 0, excluded_regs[0]);
|
||||
for (i = 0; excluded_regs[i] != PNPMMIO_SIZE; i++)
|
||||
memory_region_add_coalescing(&d->mmio, excluded_regs[i] + 4,
|
||||
excluded_regs[i+1] - excluded_regs[i] - 4);
|
||||
memory_region_init_io(&d->io, NULL, &e1000_io_ops, d, "e1000-io", IOPORT_SIZE);
|
||||
memory_region_init_io(&d->io, OBJECT(d), &e1000_io_ops, d, "e1000-io", IOPORT_SIZE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1876,15 +1876,15 @@ static int e100_nic_init(PCIDevice *pci_dev)
|
||||
s->eeprom = eeprom93xx_new(&pci_dev->qdev, EEPROM_SIZE);
|
||||
|
||||
/* Handler for memory-mapped I/O */
|
||||
memory_region_init_io(&s->mmio_bar, NULL, &eepro100_ops, s, "eepro100-mmio",
|
||||
PCI_MEM_SIZE);
|
||||
memory_region_init_io(&s->mmio_bar, OBJECT(s), &eepro100_ops, s,
|
||||
"eepro100-mmio", PCI_MEM_SIZE);
|
||||
pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->mmio_bar);
|
||||
memory_region_init_io(&s->io_bar, NULL, &eepro100_ops, s, "eepro100-io",
|
||||
PCI_IO_SIZE);
|
||||
memory_region_init_io(&s->io_bar, OBJECT(s), &eepro100_ops, s,
|
||||
"eepro100-io", PCI_IO_SIZE);
|
||||
pci_register_bar(&s->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_bar);
|
||||
/* FIXME: flash aliases to mmio?! */
|
||||
memory_region_init_io(&s->flash_bar, NULL, &eepro100_ops, s, "eepro100-flash",
|
||||
PCI_FLASH_SIZE);
|
||||
memory_region_init_io(&s->flash_bar, OBJECT(s), &eepro100_ops, s,
|
||||
"eepro100-flash", PCI_FLASH_SIZE);
|
||||
pci_register_bar(&s->dev, 2, 0, &s->flash_bar);
|
||||
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
|
@ -610,7 +610,8 @@ static int fs_eth_init(SysBusDevice *dev)
|
||||
s->dma_in->client.opaque = s;
|
||||
s->dma_in->client.pull = NULL;
|
||||
|
||||
memory_region_init_io(&s->mmio, NULL, ð_ops, s, "etraxfs-eth", 0x5c);
|
||||
memory_region_init_io(&s->mmio, OBJECT(dev), ð_ops, s,
|
||||
"etraxfs-eth", 0x5c);
|
||||
sysbus_init_mmio(dev, &s->mmio);
|
||||
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
|
@ -1328,7 +1328,8 @@ static int lan9118_init1(SysBusDevice *dev)
|
||||
const MemoryRegionOps *mem_ops =
|
||||
s->mode_16bit ? &lan9118_16bit_mem_ops : &lan9118_mem_ops;
|
||||
|
||||
memory_region_init_io(&s->mmio, NULL, mem_ops, s, "lan9118-mmio", 0x100);
|
||||
memory_region_init_io(&s->mmio, OBJECT(dev), mem_ops, s,
|
||||
"lan9118-mmio", 0x100);
|
||||
sysbus_init_mmio(dev, &s->mmio);
|
||||
sysbus_init_irq(dev, &s->irq);
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
|
@ -117,7 +117,8 @@ static int lance_init(SysBusDevice *dev)
|
||||
SysBusPCNetState *d = FROM_SYSBUS(SysBusPCNetState, dev);
|
||||
PCNetState *s = &d->state;
|
||||
|
||||
memory_region_init_io(&s->mmio, NULL, &lance_mem_ops, d, "lance-mmio", 4);
|
||||
memory_region_init_io(&s->mmio, OBJECT(d), &lance_mem_ops, d,
|
||||
"lance-mmio", 4);
|
||||
|
||||
qdev_init_gpio_in(&dev->qdev, parent_lance_reset, 1);
|
||||
|
||||
|
@ -461,12 +461,12 @@ static int milkymist_minimac2_init(SysBusDevice *dev)
|
||||
sysbus_init_irq(dev, &s->rx_irq);
|
||||
sysbus_init_irq(dev, &s->tx_irq);
|
||||
|
||||
memory_region_init_io(&s->regs_region, NULL, &minimac2_ops, s,
|
||||
memory_region_init_io(&s->regs_region, OBJECT(dev), &minimac2_ops, s,
|
||||
"milkymist-minimac2", R_MAX * 4);
|
||||
sysbus_init_mmio(dev, &s->regs_region);
|
||||
|
||||
/* register buffers memory */
|
||||
memory_region_init_ram(&s->buffers, NULL, "milkymist-minimac2.buffers",
|
||||
memory_region_init_ram(&s->buffers, OBJECT(dev), "milkymist-minimac2.buffers",
|
||||
buffers_size);
|
||||
vmstate_register_ram_global(&s->buffers);
|
||||
s->rx0_buf = memory_region_get_ram_ptr(&s->buffers);
|
||||
|
@ -235,7 +235,8 @@ static int mipsnet_sysbus_init(SysBusDevice *dev)
|
||||
{
|
||||
MIPSnetState *s = DO_UPCAST(MIPSnetState, busdev, dev);
|
||||
|
||||
memory_region_init_io(&s->io, NULL, &mipsnet_ioport_ops, s, "mipsnet-io", 36);
|
||||
memory_region_init_io(&s->io, OBJECT(dev), &mipsnet_ioport_ops, s,
|
||||
"mipsnet-io", 36);
|
||||
sysbus_init_mmio(dev, &s->io);
|
||||
sysbus_init_irq(dev, &s->irq);
|
||||
|
||||
|
@ -681,11 +681,11 @@ static int sysbus_open_eth_init(SysBusDevice *dev)
|
||||
{
|
||||
OpenEthState *s = DO_UPCAST(OpenEthState, dev, dev);
|
||||
|
||||
memory_region_init_io(&s->reg_io, NULL, &open_eth_reg_ops, s,
|
||||
memory_region_init_io(&s->reg_io, OBJECT(dev), &open_eth_reg_ops, s,
|
||||
"open_eth.regs", 0x54);
|
||||
sysbus_init_mmio(dev, &s->reg_io);
|
||||
|
||||
memory_region_init_io(&s->desc_io, NULL, &open_eth_desc_ops, s,
|
||||
memory_region_init_io(&s->desc_io, OBJECT(dev), &open_eth_desc_ops, s,
|
||||
"open_eth.desc", 0x400);
|
||||
sysbus_init_mmio(dev, &s->desc_io);
|
||||
|
||||
|
@ -315,10 +315,10 @@ static int pci_pcnet_init(PCIDevice *pci_dev)
|
||||
pci_conf[PCI_MAX_LAT] = 0xff;
|
||||
|
||||
/* Handler for memory-mapped I/O */
|
||||
memory_region_init_io(&d->state.mmio, NULL, &pcnet_mmio_ops, s, "pcnet-mmio",
|
||||
PCNET_PNPMMIO_SIZE);
|
||||
memory_region_init_io(&d->state.mmio, OBJECT(d), &pcnet_mmio_ops, s,
|
||||
"pcnet-mmio", PCNET_PNPMMIO_SIZE);
|
||||
|
||||
memory_region_init_io(&d->io_bar, NULL, &pcnet_io_ops, s, "pcnet-io",
|
||||
memory_region_init_io(&d->io_bar, OBJECT(d), &pcnet_io_ops, s, "pcnet-io",
|
||||
PCNET_IOPORT_SIZE);
|
||||
pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &d->io_bar);
|
||||
|
||||
|
@ -3486,8 +3486,10 @@ static int pci_rtl8139_init(PCIDevice *dev)
|
||||
* list bit in status register, and offset 0xdc seems unused. */
|
||||
pci_conf[PCI_CAPABILITY_LIST] = 0xdc;
|
||||
|
||||
memory_region_init_io(&s->bar_io, NULL, &rtl8139_io_ops, s, "rtl8139", 0x100);
|
||||
memory_region_init_io(&s->bar_mem, NULL, &rtl8139_mmio_ops, s, "rtl8139", 0x100);
|
||||
memory_region_init_io(&s->bar_io, OBJECT(s), &rtl8139_io_ops, s,
|
||||
"rtl8139", 0x100);
|
||||
memory_region_init_io(&s->bar_mem, OBJECT(s), &rtl8139_mmio_ops, s,
|
||||
"rtl8139", 0x100);
|
||||
pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->bar_io);
|
||||
pci_register_bar(&s->dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar_mem);
|
||||
|
||||
|
@ -747,7 +747,7 @@ static NetClientInfo net_smc91c111_info = {
|
||||
static int smc91c111_init1(SysBusDevice *dev)
|
||||
{
|
||||
smc91c111_state *s = FROM_SYSBUS(smc91c111_state, dev);
|
||||
memory_region_init_io(&s->mmio, NULL, &smc91c111_mem_ops, s,
|
||||
memory_region_init_io(&s->mmio, OBJECT(s), &smc91c111_mem_ops, s,
|
||||
"smc91c111-mmio", 16);
|
||||
sysbus_init_mmio(dev, &s->mmio);
|
||||
sysbus_init_irq(dev, &s->irq);
|
||||
|
@ -405,8 +405,8 @@ static int stellaris_enet_init(SysBusDevice *dev)
|
||||
{
|
||||
stellaris_enet_state *s = FROM_SYSBUS(stellaris_enet_state, dev);
|
||||
|
||||
memory_region_init_io(&s->mmio, NULL, &stellaris_enet_ops, s, "stellaris_enet",
|
||||
0x1000);
|
||||
memory_region_init_io(&s->mmio, OBJECT(s), &stellaris_enet_ops, s,
|
||||
"stellaris_enet", 0x1000);
|
||||
sysbus_init_mmio(dev, &s->mmio);
|
||||
sysbus_init_irq(dev, &s->irq);
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
|
@ -2073,17 +2073,17 @@ static int vmxnet3_pci_init(PCIDevice *pci_dev)
|
||||
|
||||
VMW_CBPRN("Starting init...");
|
||||
|
||||
memory_region_init_io(&s->bar0, NULL, &b0_ops, s,
|
||||
memory_region_init_io(&s->bar0, OBJECT(s), &b0_ops, s,
|
||||
"vmxnet3-b0", VMXNET3_PT_REG_SIZE);
|
||||
pci_register_bar(pci_dev, VMXNET3_BAR0_IDX,
|
||||
PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar0);
|
||||
|
||||
memory_region_init_io(&s->bar1, NULL, &b1_ops, s,
|
||||
memory_region_init_io(&s->bar1, OBJECT(s), &b1_ops, s,
|
||||
"vmxnet3-b1", VMXNET3_VD_REG_SIZE);
|
||||
pci_register_bar(pci_dev, VMXNET3_BAR1_IDX,
|
||||
PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar1);
|
||||
|
||||
memory_region_init(&s->msix_bar, NULL, "vmxnet3-msix-bar",
|
||||
memory_region_init(&s->msix_bar, OBJECT(s), "vmxnet3-msix-bar",
|
||||
VMXNET3_MSIX_BAR_SIZE);
|
||||
pci_register_bar(pci_dev, VMXNET3_MSIX_BAR_IDX,
|
||||
PCI_BASE_ADDRESS_SPACE_MEMORY, &s->msix_bar);
|
||||
|
@ -382,7 +382,8 @@ static int xgmac_enet_init(SysBusDevice *dev)
|
||||
{
|
||||
struct XgmacState *s = FROM_SYSBUS(typeof(*s), dev);
|
||||
|
||||
memory_region_init_io(&s->iomem, NULL, &enet_mem_ops, s, "xgmac", 0x1000);
|
||||
memory_region_init_io(&s->iomem, OBJECT(s), &enet_mem_ops, s,
|
||||
"xgmac", 0x1000);
|
||||
sysbus_init_mmio(dev, &s->iomem);
|
||||
sysbus_init_irq(dev, &s->sbd_irq);
|
||||
sysbus_init_irq(dev, &s->pmt_irq);
|
||||
|
@ -1001,7 +1001,7 @@ static void xilinx_enet_init(Object *obj)
|
||||
|
||||
sysbus_init_irq(sbd, &s->irq);
|
||||
|
||||
memory_region_init_io(&s->iomem, NULL, &enet_ops, s, "enet", 0x40000);
|
||||
memory_region_init_io(&s->iomem, OBJECT(s), &enet_ops, s, "enet", 0x40000);
|
||||
sysbus_init_mmio(sbd, &s->iomem);
|
||||
}
|
||||
|
||||
|
@ -221,8 +221,8 @@ static int xilinx_ethlite_init(SysBusDevice *dev)
|
||||
sysbus_init_irq(dev, &s->irq);
|
||||
s->rxbuf = 0;
|
||||
|
||||
memory_region_init_io(&s->mmio, NULL, ð_ops, s, "xlnx.xps-ethernetlite",
|
||||
R_MAX * 4);
|
||||
memory_region_init_io(&s->mmio, OBJECT(s), ð_ops, s,
|
||||
"xlnx.xps-ethernetlite", R_MAX * 4);
|
||||
sysbus_init_mmio(dev, &s->mmio);
|
||||
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
|
@ -117,7 +117,8 @@ static int nvram_sysbus_initfn(SysBusDevice *dev)
|
||||
|
||||
s->contents = g_malloc0(s->chip_size);
|
||||
|
||||
memory_region_init_io(&s->iomem, NULL, &nvram_ops, s, "nvram", s->chip_size);
|
||||
memory_region_init_io(&s->iomem, OBJECT(s), &nvram_ops, s,
|
||||
"nvram", s->chip_size);
|
||||
sysbus_init_mmio(dev, &s->iomem);
|
||||
|
||||
/* Read current file */
|
||||
|
@ -526,14 +526,14 @@ static int fw_cfg_init1(SysBusDevice *dev)
|
||||
{
|
||||
FWCfgState *s = FROM_SYSBUS(FWCfgState, dev);
|
||||
|
||||
memory_region_init_io(&s->ctl_iomem, NULL, &fw_cfg_ctl_mem_ops, s,
|
||||
memory_region_init_io(&s->ctl_iomem, OBJECT(s), &fw_cfg_ctl_mem_ops, s,
|
||||
"fwcfg.ctl", FW_CFG_SIZE);
|
||||
sysbus_init_mmio(dev, &s->ctl_iomem);
|
||||
memory_region_init_io(&s->data_iomem, NULL, &fw_cfg_data_mem_ops, s,
|
||||
memory_region_init_io(&s->data_iomem, OBJECT(s), &fw_cfg_data_mem_ops, s,
|
||||
"fwcfg.data", FW_CFG_DATA_SIZE);
|
||||
sysbus_init_mmio(dev, &s->data_iomem);
|
||||
/* In case ctl and data overlap: */
|
||||
memory_region_init_io(&s->comb_iomem, NULL, &fw_cfg_comb_mem_ops, s,
|
||||
memory_region_init_io(&s->comb_iomem, OBJECT(s), &fw_cfg_comb_mem_ops, s,
|
||||
"fwcfg", FW_CFG_SIZE);
|
||||
|
||||
if (s->ctl_iobase + 1 == s->data_iobase) {
|
||||
|
@ -115,8 +115,8 @@ static void macio_nvram_realizefn(DeviceState *dev, Error **errp)
|
||||
|
||||
s->data = g_malloc0(s->size);
|
||||
|
||||
memory_region_init_io(&s->mem, NULL, &macio_nvram_ops, s, "macio-nvram",
|
||||
s->size << s->it_shift);
|
||||
memory_region_init_io(&s->mem, OBJECT(s), &macio_nvram_ops, s,
|
||||
"macio-nvram", s->size << s->it_shift);
|
||||
sysbus_init_mmio(d, &s->mem);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user