aboutsummaryrefslogtreecommitdiff
path: root/include/hw/timer
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2013-06-15 10:53:44 +0000
committerBlue Swirl <blauwirbel@gmail.com>2013-06-15 10:53:44 +0000
commit371a775dc18ece3ff7d77328d1ee28cb2d473706 (patch)
tree328c5e856f25c5f0176d9361b641e8061e093ae2 /include/hw/timer
parent22bfa16ed3d4c9d534dcfe6f2381a654f32296b9 (diff)
parentfef7fbc92496f5f6d2b7395263830bce15ebf410 (diff)
Merge branch 'realize-isa.v2' of git://github.com/afaerber/qemu-cpu
* 'realize-isa.v2' of git://github.com/afaerber/qemu-cpu: qdev: Drop FROM_QBUS() macro isa: QOM'ify ISADevice isa: QOM'ify ISABus i8259: Convert PICCommonState to use QOM realizefn kvm/i8259: QOM'ify some more i8259: QOM'ify some more i8254: Convert PITCommonState to QOM realizefn kvm/i8254: QOM'ify some more i8254: QOM'ify some more isa: Use realizefn for ISADevice cs4231a: QOM'ify some more gus: QOM'ify some more
Diffstat (limited to 'include/hw/timer')
-rw-r--r--include/hw/timer/i8254.h31
-rw-r--r--include/hw/timer/i8254_internal.h1
2 files changed, 19 insertions, 13 deletions
diff --git a/include/hw/timer/i8254.h b/include/hw/timer/i8254.h
index 75bb530ad9..434903348c 100644
--- a/include/hw/timer/i8254.h
+++ b/include/hw/timer/i8254.h
@@ -37,29 +37,36 @@ typedef struct PITChannelInfo {
int out;
} PITChannelInfo;
+#define TYPE_I8254 "isa-pit"
+#define TYPE_KVM_I8254 "kvm-pit"
+
static inline ISADevice *pit_init(ISABus *bus, int base, int isa_irq,
qemu_irq alt_irq)
{
- ISADevice *dev;
+ DeviceState *dev;
+ ISADevice *d;
- dev = isa_create(bus, "isa-pit");
- qdev_prop_set_uint32(&dev->qdev, "iobase", base);
- qdev_init_nofail(&dev->qdev);
- qdev_connect_gpio_out(&dev->qdev, 0,
- isa_irq >= 0 ? isa_get_irq(dev, isa_irq) : alt_irq);
+ d = isa_create(bus, TYPE_I8254);
+ dev = DEVICE(d);
+ qdev_prop_set_uint32(dev, "iobase", base);
+ qdev_init_nofail(dev);
+ qdev_connect_gpio_out(dev, 0,
+ isa_irq >= 0 ? isa_get_irq(d, isa_irq) : alt_irq);
- return dev;
+ return d;
}
static inline ISADevice *kvm_pit_init(ISABus *bus, int base)
{
- ISADevice *dev;
+ DeviceState *dev;
+ ISADevice *d;
- dev = isa_create(bus, "kvm-pit");
- qdev_prop_set_uint32(&dev->qdev, "iobase", base);
- qdev_init_nofail(&dev->qdev);
+ d = isa_create(bus, TYPE_KVM_I8254);
+ dev = DEVICE(d);
+ qdev_prop_set_uint32(dev, "iobase", base);
+ qdev_init_nofail(dev);
- return dev;
+ return d;
}
void pit_set_gate(ISADevice *dev, int channel, int val);
diff --git a/include/hw/timer/i8254_internal.h b/include/hw/timer/i8254_internal.h
index e0cff0cf5a..61a1bfbc4e 100644
--- a/include/hw/timer/i8254_internal.h
+++ b/include/hw/timer/i8254_internal.h
@@ -68,7 +68,6 @@ typedef struct PITCommonState {
typedef struct PITCommonClass {
ISADeviceClass parent_class;
- int (*init)(PITCommonState *s);
void (*set_channel_gate)(PITCommonState *s, PITChannelState *sc, int val);
void (*get_channel_info)(PITCommonState *s, PITChannelState *sc,
PITChannelInfo *info);