提交 29776739 编写于 作者: P Paolo Bonzini

hw/s*: pass owner to memory_region_init* functions

Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 40c5dce9
...@@ -349,7 +349,8 @@ static int esp_pci_scsi_init(PCIDevice *dev) ...@@ -349,7 +349,8 @@ static int esp_pci_scsi_init(PCIDevice *dev)
s->dma_memory_write = esp_pci_dma_memory_write; s->dma_memory_write = esp_pci_dma_memory_write;
s->dma_opaque = pci; s->dma_opaque = pci;
s->chip_id = TCHI_AM53C974; s->chip_id = TCHI_AM53C974;
memory_region_init_io(&pci->io, NULL, &esp_pci_io_ops, pci, "esp-io", 0x80); memory_region_init_io(&pci->io, OBJECT(pci), &esp_pci_io_ops, pci,
"esp-io", 0x80);
pci_register_bar(&pci->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &pci->io); pci_register_bar(&pci->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &pci->io);
s->irq = pci->dev.irq[0]; s->irq = pci->dev.irq[0];
......
...@@ -675,8 +675,8 @@ static int sysbus_esp_init(SysBusDevice *dev) ...@@ -675,8 +675,8 @@ static int sysbus_esp_init(SysBusDevice *dev)
assert(sysbus->it_shift != -1); assert(sysbus->it_shift != -1);
s->chip_id = TCHI_FAS100A; s->chip_id = TCHI_FAS100A;
memory_region_init_io(&sysbus->iomem, NULL, &sysbus_esp_mem_ops, sysbus, memory_region_init_io(&sysbus->iomem, OBJECT(sysbus), &sysbus_esp_mem_ops,
"esp", ESP_REGS << sysbus->it_shift); sysbus, "esp", ESP_REGS << sysbus->it_shift);
sysbus_init_mmio(dev, &sysbus->iomem); sysbus_init_mmio(dev, &sysbus->iomem);
qdev_init_gpio_in(&dev->qdev, sysbus_esp_gpio_demux, 2); qdev_init_gpio_in(&dev->qdev, sysbus_esp_gpio_demux, 2);
......
...@@ -2090,9 +2090,12 @@ static int lsi_scsi_init(PCIDevice *dev) ...@@ -2090,9 +2090,12 @@ static int lsi_scsi_init(PCIDevice *dev)
/* Interrupt pin A */ /* Interrupt pin A */
pci_conf[PCI_INTERRUPT_PIN] = 0x01; pci_conf[PCI_INTERRUPT_PIN] = 0x01;
memory_region_init_io(&s->mmio_io, NULL, &lsi_mmio_ops, s, "lsi-mmio", 0x400); memory_region_init_io(&s->mmio_io, OBJECT(s), &lsi_mmio_ops, s,
memory_region_init_io(&s->ram_io, NULL, &lsi_ram_ops, s, "lsi-ram", 0x2000); "lsi-mmio", 0x400);
memory_region_init_io(&s->io_io, NULL, &lsi_io_ops, s, "lsi-io", 256); memory_region_init_io(&s->ram_io, OBJECT(s), &lsi_ram_ops, s,
"lsi-ram", 0x2000);
memory_region_init_io(&s->io_io, OBJECT(s), &lsi_io_ops, s,
"lsi-io", 256);
pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_io); pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_io);
pci_register_bar(&s->dev, 1, 0, &s->mmio_io); pci_register_bar(&s->dev, 1, 0, &s->mmio_io);
......
...@@ -2098,11 +2098,11 @@ static int megasas_scsi_init(PCIDevice *dev) ...@@ -2098,11 +2098,11 @@ static int megasas_scsi_init(PCIDevice *dev)
/* Interrupt pin 1 */ /* Interrupt pin 1 */
pci_conf[PCI_INTERRUPT_PIN] = 0x01; pci_conf[PCI_INTERRUPT_PIN] = 0x01;
memory_region_init_io(&s->mmio_io, NULL, &megasas_mmio_ops, s, memory_region_init_io(&s->mmio_io, OBJECT(s), &megasas_mmio_ops, s,
"megasas-mmio", 0x4000); "megasas-mmio", 0x4000);
memory_region_init_io(&s->port_io, NULL, &megasas_port_ops, s, memory_region_init_io(&s->port_io, OBJECT(s), &megasas_port_ops, s,
"megasas-io", 256); "megasas-io", 256);
memory_region_init_io(&s->queue_io, NULL, &megasas_queue_ops, s, memory_region_init_io(&s->queue_io, OBJECT(s), &megasas_queue_ops, s,
"megasas-queue", 0x40000); "megasas-queue", 0x40000);
#ifdef USE_MSIX #ifdef USE_MSIX
......
...@@ -1075,7 +1075,7 @@ pvscsi_init(PCIDevice *pci_dev) ...@@ -1075,7 +1075,7 @@ pvscsi_init(PCIDevice *pci_dev)
/* Interrupt pin A */ /* Interrupt pin A */
pci_config_set_interrupt_pin(pci_dev->config, 1); pci_config_set_interrupt_pin(pci_dev->config, 1);
memory_region_init_io(&s->io_space, NULL, &pvscsi_ops, s, memory_region_init_io(&s->io_space, OBJECT(s), &pvscsi_ops, s,
"pvscsi-io", PVSCSI_MEM_SPACE_SIZE); "pvscsi-io", PVSCSI_MEM_SPACE_SIZE);
pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->io_space); pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->io_space);
......
...@@ -253,7 +253,7 @@ static int milkymist_memcard_init(SysBusDevice *dev) ...@@ -253,7 +253,7 @@ static int milkymist_memcard_init(SysBusDevice *dev)
s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false); s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false);
s->enabled = dinfo ? bdrv_is_inserted(dinfo->bdrv) : 0; s->enabled = dinfo ? bdrv_is_inserted(dinfo->bdrv) : 0;
memory_region_init_io(&s->regs_region, NULL, &memcard_mmio_ops, s, memory_region_init_io(&s->regs_region, OBJECT(s), &memcard_mmio_ops, s,
"milkymist-memcard", R_MAX * 4); "milkymist-memcard", R_MAX * 4);
sysbus_init_mmio(dev, &s->regs_region); sysbus_init_mmio(dev, &s->regs_region);
......
...@@ -479,7 +479,7 @@ static int pl181_init(SysBusDevice *dev) ...@@ -479,7 +479,7 @@ static int pl181_init(SysBusDevice *dev)
pl181_state *s = FROM_SYSBUS(pl181_state, dev); pl181_state *s = FROM_SYSBUS(pl181_state, dev);
DriveInfo *dinfo; DriveInfo *dinfo;
memory_region_init_io(&s->iomem, NULL, &pl181_ops, s, "pl181", 0x1000); memory_region_init_io(&s->iomem, OBJECT(s), &pl181_ops, s, "pl181", 0x1000);
sysbus_init_mmio(dev, &s->iomem); sysbus_init_mmio(dev, &s->iomem);
sysbus_init_irq(dev, &s->irq[0]); sysbus_init_irq(dev, &s->irq[0]);
sysbus_init_irq(dev, &s->irq[1]); sysbus_init_irq(dev, &s->irq[1]);
......
...@@ -1245,7 +1245,7 @@ static void sdhci_realize(DeviceState *dev, Error ** errp) ...@@ -1245,7 +1245,7 @@ static void sdhci_realize(DeviceState *dev, Error ** errp)
s->buf_maxsz = sdhci_get_fifolen(s); s->buf_maxsz = sdhci_get_fifolen(s);
s->fifo_buffer = g_malloc0(s->buf_maxsz); s->fifo_buffer = g_malloc0(s->buf_maxsz);
sysbus_init_irq(sbd, &s->irq); sysbus_init_irq(sbd, &s->irq);
memory_region_init_io(&s->iomem, NULL, &sdhci_mmio_ops, s, "sdhci", memory_region_init_io(&s->iomem, OBJECT(s), &sdhci_mmio_ops, s, "sdhci",
SDHC_REGISTERS_MAP_SIZE); SDHC_REGISTERS_MAP_SIZE);
sysbus_init_mmio(sbd, &s->iomem); sysbus_init_mmio(sbd, &s->iomem);
} }
......
...@@ -125,10 +125,10 @@ static int sh_pci_device_init(SysBusDevice *dev) ...@@ -125,10 +125,10 @@ static int sh_pci_device_init(SysBusDevice *dev)
get_system_memory(), get_system_memory(),
get_system_io(), get_system_io(),
PCI_DEVFN(0, 0), 4, TYPE_PCI_BUS); PCI_DEVFN(0, 0), 4, TYPE_PCI_BUS);
memory_region_init_io(&s->memconfig_p4, NULL, &sh_pci_reg_ops, s, memory_region_init_io(&s->memconfig_p4, OBJECT(s), &sh_pci_reg_ops, s,
"sh_pci", 0x224); "sh_pci", 0x224);
memory_region_init_alias(&s->memconfig_a7, NULL, "sh_pci.2", &s->memconfig_p4, memory_region_init_alias(&s->memconfig_a7, OBJECT(s), "sh_pci.2",
0, 0x224); &s->memconfig_p4, 0, 0x224);
isa_mmio_setup(&s->isa, 0x40000); isa_mmio_setup(&s->isa, 0x40000);
sysbus_init_mmio(dev, &s->memconfig_p4); sysbus_init_mmio(dev, &s->memconfig_p4);
sysbus_init_mmio(dev, &s->memconfig_a7); sysbus_init_mmio(dev, &s->memconfig_a7);
......
...@@ -582,7 +582,8 @@ static int idreg_init1(SysBusDevice *dev) ...@@ -582,7 +582,8 @@ static int idreg_init1(SysBusDevice *dev)
{ {
IDRegState *s = FROM_SYSBUS(IDRegState, dev); IDRegState *s = FROM_SYSBUS(IDRegState, dev);
memory_region_init_ram(&s->mem, NULL, "sun4m.idreg", sizeof(idreg_data)); memory_region_init_ram(&s->mem, OBJECT(s),
"sun4m.idreg", sizeof(idreg_data));
vmstate_register_ram_global(&s->mem); vmstate_register_ram_global(&s->mem);
memory_region_set_readonly(&s->mem, true); memory_region_set_readonly(&s->mem, true);
sysbus_init_mmio(dev, &s->mem); sysbus_init_mmio(dev, &s->mem);
...@@ -625,7 +626,7 @@ static int afx_init1(SysBusDevice *dev) ...@@ -625,7 +626,7 @@ static int afx_init1(SysBusDevice *dev)
{ {
AFXState *s = FROM_SYSBUS(AFXState, dev); AFXState *s = FROM_SYSBUS(AFXState, dev);
memory_region_init_ram(&s->mem, NULL, "sun4m.afx", 4); memory_region_init_ram(&s->mem, OBJECT(s), "sun4m.afx", 4);
vmstate_register_ram_global(&s->mem); vmstate_register_ram_global(&s->mem);
sysbus_init_mmio(dev, &s->mem); sysbus_init_mmio(dev, &s->mem);
return 0; return 0;
...@@ -695,7 +696,7 @@ static int prom_init1(SysBusDevice *dev) ...@@ -695,7 +696,7 @@ static int prom_init1(SysBusDevice *dev)
{ {
PROMState *s = FROM_SYSBUS(PROMState, dev); PROMState *s = FROM_SYSBUS(PROMState, dev);
memory_region_init_ram(&s->prom, NULL, "sun4m.prom", PROM_SIZE_MAX); memory_region_init_ram(&s->prom, OBJECT(s), "sun4m.prom", PROM_SIZE_MAX);
vmstate_register_ram_global(&s->prom); vmstate_register_ram_global(&s->prom);
memory_region_set_readonly(&s->prom, true); memory_region_set_readonly(&s->prom, true);
sysbus_init_mmio(dev, &s->prom); sysbus_init_mmio(dev, &s->prom);
...@@ -734,7 +735,7 @@ static int ram_init1(SysBusDevice *dev) ...@@ -734,7 +735,7 @@ static int ram_init1(SysBusDevice *dev)
{ {
RamDevice *d = FROM_SYSBUS(RamDevice, dev); RamDevice *d = FROM_SYSBUS(RamDevice, dev);
memory_region_init_ram(&d->ram, NULL, "sun4m.ram", d->size); memory_region_init_ram(&d->ram, OBJECT(d), "sun4m.ram", d->size);
vmstate_register_ram_global(&d->ram); vmstate_register_ram_global(&d->ram);
sysbus_init_mmio(dev, &d->ram); sysbus_init_mmio(dev, &d->ram);
return 0; return 0;
......
...@@ -680,7 +680,7 @@ static int prom_init1(SysBusDevice *dev) ...@@ -680,7 +680,7 @@ static int prom_init1(SysBusDevice *dev)
{ {
PROMState *s = FROM_SYSBUS(PROMState, dev); PROMState *s = FROM_SYSBUS(PROMState, dev);
memory_region_init_ram(&s->prom, NULL, "sun4u.prom", PROM_SIZE_MAX); memory_region_init_ram(&s->prom, OBJECT(s), "sun4u.prom", PROM_SIZE_MAX);
vmstate_register_ram_global(&s->prom); vmstate_register_ram_global(&s->prom);
memory_region_set_readonly(&s->prom, true); memory_region_set_readonly(&s->prom, true);
sysbus_init_mmio(dev, &s->prom); sysbus_init_mmio(dev, &s->prom);
...@@ -720,7 +720,7 @@ static int ram_init1(SysBusDevice *dev) ...@@ -720,7 +720,7 @@ static int ram_init1(SysBusDevice *dev)
{ {
RamDevice *d = FROM_SYSBUS(RamDevice, dev); RamDevice *d = FROM_SYSBUS(RamDevice, dev);
memory_region_init_ram(&d->ram, NULL, "sun4u.ram", d->size); memory_region_init_ram(&d->ram, OBJECT(d), "sun4u.ram", d->size);
vmstate_register_ram_global(&d->ram); vmstate_register_ram_global(&d->ram);
sysbus_init_mmio(dev, &d->ram); sysbus_init_mmio(dev, &d->ram);
return 0; return 0;
......
...@@ -277,7 +277,7 @@ static int pl022_init(SysBusDevice *dev) ...@@ -277,7 +277,7 @@ static int pl022_init(SysBusDevice *dev)
{ {
pl022_state *s = FROM_SYSBUS(pl022_state, dev); pl022_state *s = FROM_SYSBUS(pl022_state, dev);
memory_region_init_io(&s->iomem, NULL, &pl022_ops, s, "pl022", 0x1000); memory_region_init_io(&s->iomem, OBJECT(s), &pl022_ops, s, "pl022", 0x1000);
sysbus_init_mmio(dev, &s->iomem); sysbus_init_mmio(dev, &s->iomem);
sysbus_init_irq(dev, &s->irq); sysbus_init_irq(dev, &s->irq);
s->ssi = ssi_create_bus(&dev->qdev, "ssi"); s->ssi = ssi_create_bus(&dev->qdev, "ssi");
......
...@@ -330,7 +330,8 @@ static int xilinx_spi_init(SysBusDevice *dev) ...@@ -330,7 +330,8 @@ static int xilinx_spi_init(SysBusDevice *dev)
sysbus_init_irq(dev, &s->cs_lines[i]); sysbus_init_irq(dev, &s->cs_lines[i]);
} }
memory_region_init_io(&s->mmio, NULL, &spi_ops, s, "xilinx-spi", R_MAX * 4); memory_region_init_io(&s->mmio, OBJECT(s), &spi_ops, s,
"xilinx-spi", R_MAX * 4);
sysbus_init_mmio(dev, &s->mmio); sysbus_init_mmio(dev, &s->mmio);
s->irqline = -1; s->irqline = -1;
......
...@@ -663,7 +663,8 @@ static void xilinx_spips_realize(DeviceState *dev, Error **errp) ...@@ -663,7 +663,8 @@ static void xilinx_spips_realize(DeviceState *dev, Error **errp)
sysbus_init_irq(sbd, &s->cs_lines[i]); sysbus_init_irq(sbd, &s->cs_lines[i]);
} }
memory_region_init_io(&s->iomem, NULL, xsc->reg_ops, s, "spi", R_MAX*4); memory_region_init_io(&s->iomem, OBJECT(s), xsc->reg_ops, s,
"spi", R_MAX*4);
sysbus_init_mmio(sbd, &s->iomem); sysbus_init_mmio(sbd, &s->iomem);
s->irqline = -1; s->irqline = -1;
...@@ -685,7 +686,7 @@ static void xilinx_qspips_realize(DeviceState *dev, Error **errp) ...@@ -685,7 +686,7 @@ static void xilinx_qspips_realize(DeviceState *dev, Error **errp)
s->num_txrx_bytes = 4; s->num_txrx_bytes = 4;
xilinx_spips_realize(dev, errp); xilinx_spips_realize(dev, errp);
memory_region_init_io(&s->mmlqspi, NULL, &lqspi_ops, s, "lqspi", memory_region_init_io(&s->mmlqspi, OBJECT(s), &lqspi_ops, s, "lqspi",
(1 << LQSPI_ADDRESS_BITS) * 2); (1 << LQSPI_ADDRESS_BITS) * 2);
sysbus_init_mmio(sbd, &s->mmlqspi); sysbus_init_mmio(sbd, &s->mmlqspi);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册