aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-06-06 21:19:53 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2013-07-04 17:42:47 +0200
commitdb10ca9057b11222408f708d5d99a3888eca4feb (patch)
tree7900437ac9fa0a1fd3d85073bccc988c588cd7c8
parent3cd2cf4375993494bcf6195c1637a3d009aa6fae (diff)
downloadqemu-db10ca9057b11222408f708d5d99a3888eca4feb.zip
qemu-db10ca9057b11222408f708d5d99a3888eca4feb.tar.gz
qemu-db10ca9057b11222408f708d5d99a3888eca4feb.tar.bz2
piolist: add owner argument to initialization functions and pass devices
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--hw/audio/adlib.c2
-rw-r--r--hw/display/qxl.c3
-rw-r--r--hw/display/vga.c4
-rw-r--r--hw/dma/i82374.c2
-rw-r--r--hw/isa/isa-bus.c2
-rw-r--r--hw/isa/vt82c686.c2
-rw-r--r--hw/ppc/prep.c2
-rw-r--r--hw/watchdog/wdt_ib700.c2
-rw-r--r--include/exec/ioport.h4
-rw-r--r--ioport.c6
10 files changed, 17 insertions, 12 deletions
diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c
index 8b9b81e..f72e6ee 100644
--- a/hw/audio/adlib.c
+++ b/hw/audio/adlib.c
@@ -349,7 +349,7 @@ static void adlib_realizefn (DeviceState *dev, Error **errp)
adlib_portio_list[1].offset = s->port;
adlib_portio_list[2].offset = s->port + 8;
- portio_list_init (port_list, adlib_portio_list, s, "adlib");
+ portio_list_init (port_list, OBJECT(s), adlib_portio_list, s, "adlib");
portio_list_add (port_list, isa_address_space_io(&s->parent_obj), 0);
}
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 59925ec..3804fe2 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -2070,7 +2070,8 @@ static int qxl_init_primary(PCIDevice *dev)
vga_common_init(vga, OBJECT(dev));
vga_init(vga, OBJECT(dev),
pci_address_space(dev), pci_address_space_io(dev), false);
- portio_list_init(qxl_vga_port_list, qxl_vga_portio_list, vga, "vga");
+ portio_list_init(qxl_vga_port_list, OBJECT(dev), qxl_vga_portio_list,
+ vga, "vga");
portio_list_add(qxl_vga_port_list, pci_address_space_io(dev), 0x3b0);
vga->con = graphic_console_init(DEVICE(dev), &qxl_ops, qxl);
diff --git a/hw/display/vga.c b/hw/display/vga.c
index 1657356..06f44a8 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -2372,11 +2372,11 @@ void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
1);
memory_region_set_coalescing(vga_io_memory);
if (init_vga_ports) {
- portio_list_init(vga_port_list, vga_ports, s, "vga");
+ portio_list_init(vga_port_list, obj, vga_ports, s, "vga");
portio_list_add(vga_port_list, address_space_io, 0x3b0);
}
if (vbe_ports) {
- portio_list_init(vbe_port_list, vbe_ports, s, "vbe");
+ portio_list_init(vbe_port_list, obj, vbe_ports, s, "vbe");
portio_list_add(vbe_port_list, address_space_io, 0x1ce);
}
}
diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
index ecda5cb..a5b891f 100644
--- a/hw/dma/i82374.c
+++ b/hw/dma/i82374.c
@@ -139,7 +139,7 @@ static void i82374_isa_realize(DeviceState *dev, Error **errp)
I82374State *s = &isa->state;
PortioList *port_list = g_new(PortioList, 1);
- portio_list_init(port_list, i82374_portio_list, s, "i82374");
+ portio_list_init(port_list, OBJECT(isa), i82374_portio_list, s, "i82374");
portio_list_add(port_list, isa_address_space_io(&isa->parent_obj),
isa->iobase);
diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index 136d17e..cfd610c 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -115,7 +115,7 @@ void isa_register_portio_list(ISADevice *dev, uint16_t start,
actually handled e.g. the FDC device. */
isa_init_ioport(dev, start);
- portio_list_init(piolist, pio_start, opaque, name);
+ portio_list_init(piolist, OBJECT(dev), pio_start, opaque, name);
portio_list_add(piolist, isabus->address_space_io, start);
}
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index 1f63197..19c887d 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -443,7 +443,7 @@ static int vt82c686b_initfn(PCIDevice *d)
}
}
- memory_region_init_io(&vt82c->superio, NULL, &superio_ops,
+ memory_region_init_io(&vt82c->superio, OBJECT(d), &superio_ops,
&vt82c->superio_conf, "superio", 2);
memory_region_set_enabled(&vt82c->superio, false);
/* The floppy also uses 0x3f0 and 0x3f1.
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 899aa30..0081c70 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -653,7 +653,7 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
sysctrl->reset_irq = first_cpu->irq_inputs[PPC6xx_INPUT_HRESET];
- portio_list_init(port_list, prep_portio_list, sysctrl, "prep");
+ portio_list_init(port_list, NULL, prep_portio_list, sysctrl, "prep");
portio_list_add(port_list, get_system_io(), 0x0);
/* PowerPC control and status register group */
diff --git a/hw/watchdog/wdt_ib700.c b/hw/watchdog/wdt_ib700.c
index 597a923..c788554 100644
--- a/hw/watchdog/wdt_ib700.c
+++ b/hw/watchdog/wdt_ib700.c
@@ -112,7 +112,7 @@ static void wdt_ib700_realize(DeviceState *dev, Error **errp)
s->timer = qemu_new_timer_ns(vm_clock, ib700_timer_expired, s);
- portio_list_init(port_list, wdt_portio_list, s, "ib700");
+ portio_list_init(port_list, OBJECT(s), wdt_portio_list, s, "ib700");
portio_list_add(port_list, isa_address_space_io(&s->parent_obj), 0);
}
diff --git a/include/exec/ioport.h b/include/exec/ioport.h
index 6fb237d..bdd4e96 100644
--- a/include/exec/ioport.h
+++ b/include/exec/ioport.h
@@ -25,6 +25,7 @@
#define IOPORT_H
#include "qemu-common.h"
+#include "qom/object.h"
#include "exec/memory.h"
typedef uint32_t pio_addr_t;
@@ -53,6 +54,7 @@ uint32_t cpu_inl(pio_addr_t addr);
typedef struct PortioList {
const struct MemoryRegionPortio *ports;
+ Object *owner;
struct MemoryRegion *address_space;
unsigned nr;
struct MemoryRegion **regions;
@@ -60,7 +62,7 @@ typedef struct PortioList {
const char *name;
} PortioList;
-void portio_list_init(PortioList *piolist,
+void portio_list_init(PortioList *piolist, Object *owner,
const struct MemoryRegionPortio *callbacks,
void *opaque, const char *name);
void portio_list_destroy(PortioList *piolist);
diff --git a/ioport.c b/ioport.c
index 3a6a73d..79b7f1a 100644
--- a/ioport.c
+++ b/ioport.c
@@ -106,6 +106,7 @@ uint32_t cpu_inl(pio_addr_t addr)
}
void portio_list_init(PortioList *piolist,
+ Object *owner,
const MemoryRegionPortio *callbacks,
void *opaque, const char *name)
{
@@ -120,6 +121,7 @@ void portio_list_init(PortioList *piolist,
piolist->regions = g_new0(MemoryRegion *, n);
piolist->address_space = NULL;
piolist->opaque = opaque;
+ piolist->owner = owner;
piolist->name = name;
}
@@ -211,8 +213,8 @@ static void portio_list_add_1(PortioList *piolist,
* Use an alias so that the callback is called with an absolute address,
* rather than an offset relative to to start + off_low.
*/
- memory_region_init_io(&mrpio->mr, NULL, &portio_ops, mrpio, piolist->name,
- off_high - off_low);
+ memory_region_init_io(&mrpio->mr, piolist->owner, &portio_ops, mrpio,
+ piolist->name, off_high - off_low);
memory_region_add_subregion(piolist->address_space,
start + off_low, &mrpio->mr);
piolist->regions[piolist->nr] = &mrpio->mr;