aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-04-27 22:18:46 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2013-04-29 08:27:48 -0500
commita0881c64081f750be2e44a9b7000e18e4cea065e (patch)
tree9708cd9073ccfbe6251b115c4cba1a4568178075
parentb0dc5ee6bd0b16986a0f45ca778f3ead2398b2ee (diff)
pc: QOM'ify port 92
Introduce type constant and cast macro to obsolete DO_UPCAST(). Prepares for ISA realizefn. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Andreas Färber <afaerber@suse.de> Message-id: 1367093935-29091-12-git-send-email-afaerber@suse.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--hw/i386/pc.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 0d6e72b209..29d2703330 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -429,9 +429,13 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
qemu_register_reset(pc_cmos_init_late, &arg);
}
+#define TYPE_PORT92 "port92"
+#define PORT92(obj) OBJECT_CHECK(Port92State, (obj), TYPE_PORT92)
+
/* port 92 stuff: could be split off */
typedef struct Port92State {
- ISADevice dev;
+ ISADevice parent_obj;
+
MemoryRegion io;
uint8_t outport;
qemu_irq *a20_out;
@@ -463,7 +467,7 @@ static uint64_t port92_read(void *opaque, hwaddr addr,
static void port92_init(ISADevice *dev, qemu_irq *a20_out)
{
- Port92State *s = DO_UPCAST(Port92State, dev, dev);
+ Port92State *s = PORT92(dev);
s->a20_out = a20_out;
}
@@ -481,7 +485,7 @@ static const VMStateDescription vmstate_port92_isa = {
static void port92_reset(DeviceState *d)
{
- Port92State *s = container_of(d, Port92State, dev.qdev);
+ Port92State *s = PORT92(d);
s->outport &= ~1;
}
@@ -498,7 +502,7 @@ static const MemoryRegionOps port92_ops = {
static int port92_initfn(ISADevice *dev)
{
- Port92State *s = DO_UPCAST(Port92State, dev, dev);
+ Port92State *s = PORT92(dev);
memory_region_init_io(&s->io, &port92_ops, s, "port92", 1);
isa_register_ioport(dev, &s->io, 0x92);
@@ -518,7 +522,7 @@ static void port92_class_initfn(ObjectClass *klass, void *data)
}
static const TypeInfo port92_info = {
- .name = "port92",
+ .name = TYPE_PORT92,
.parent = TYPE_ISA_DEVICE,
.instance_size = sizeof(Port92State),
.class_init = port92_class_initfn,