aboutsummaryrefslogtreecommitdiff
path: root/include/hw
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
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')
-rw-r--r--include/hw/audio/pcspk.h14
-rw-r--r--include/hw/char/serial.h2
-rw-r--r--include/hw/i386/pc.h30
-rw-r--r--include/hw/isa/i8259_internal.h2
-rw-r--r--include/hw/isa/isa.h11
-rw-r--r--include/hw/qdev-core.h2
-rw-r--r--include/hw/timer/i8254.h31
-rw-r--r--include/hw/timer/i8254_internal.h1
8 files changed, 54 insertions, 39 deletions
diff --git a/include/hw/audio/pcspk.h b/include/hw/audio/pcspk.h
index 7625137991..ef95dd1360 100644
--- a/include/hw/audio/pcspk.h
+++ b/include/hw/audio/pcspk.h
@@ -32,14 +32,16 @@
static inline ISADevice *pcspk_init(ISABus *bus, ISADevice *pit)
{
- ISADevice *dev;
+ DeviceState *dev;
+ ISADevice *isadev;
- dev = isa_create(bus, TYPE_PC_SPEAKER);
- qdev_prop_set_uint32(&dev->qdev, "iobase", 0x61);
- qdev_prop_set_ptr(&dev->qdev, "pit", pit);
- qdev_init_nofail(&dev->qdev);
+ isadev = isa_create(bus, TYPE_PC_SPEAKER);
+ dev = DEVICE(isadev);
+ qdev_prop_set_uint32(dev, "iobase", 0x61);
+ qdev_prop_set_ptr(dev, "pit", pit);
+ qdev_init_nofail(dev);
- return dev;
+ return isadev;
}
#endif /* !HW_PCSPK_H */
diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
index 9ab81f6321..85f58acd51 100644
--- a/include/hw/char/serial.h
+++ b/include/hw/char/serial.h
@@ -78,7 +78,7 @@ struct SerialState {
extern const VMStateDescription vmstate_serial;
extern const MemoryRegionOps serial_io_ops;
-void serial_init_core(SerialState *s);
+void serial_realize_core(SerialState *s, Error **errp);
void serial_exit_core(SerialState *s);
void serial_set_frequency(SerialState *s, uint32_t frequency);
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index fab9be51cc..7f0496764c 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -14,15 +14,17 @@
/* parallel.c */
static inline bool parallel_init(ISABus *bus, int index, CharDriverState *chr)
{
- ISADevice *dev;
+ DeviceState *dev;
+ ISADevice *isadev;
- dev = isa_try_create(bus, "isa-parallel");
- if (!dev) {
+ isadev = isa_try_create(bus, "isa-parallel");
+ if (!isadev) {
return false;
}
- qdev_prop_set_uint32(&dev->qdev, "index", index);
- qdev_prop_set_chr(&dev->qdev, "chardev", chr);
- if (qdev_init(&dev->qdev) < 0) {
+ dev = DEVICE(isadev);
+ qdev_prop_set_uint32(dev, "index", index);
+ qdev_prop_set_chr(dev, "chardev", chr);
+ if (qdev_init(dev) < 0) {
return false;
}
return true;
@@ -155,18 +157,20 @@ int isa_vga_mm_init(hwaddr vram_base,
/* ne2000.c */
static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo *nd)
{
- ISADevice *dev;
+ DeviceState *dev;
+ ISADevice *isadev;
qemu_check_nic_model(nd, "ne2k_isa");
- dev = isa_try_create(bus, "ne2k_isa");
- if (!dev) {
+ isadev = isa_try_create(bus, "ne2k_isa");
+ if (!isadev) {
return false;
}
- qdev_prop_set_uint32(&dev->qdev, "iobase", base);
- qdev_prop_set_uint32(&dev->qdev, "irq", irq);
- qdev_set_nic_properties(&dev->qdev, nd);
- qdev_init_nofail(&dev->qdev);
+ dev = DEVICE(isadev);
+ qdev_prop_set_uint32(dev, "iobase", base);
+ qdev_prop_set_uint32(dev, "irq", irq);
+ qdev_set_nic_properties(dev, nd);
+ qdev_init_nofail(dev);
return true;
}
diff --git a/include/hw/isa/i8259_internal.h b/include/hw/isa/i8259_internal.h
index b4e757a461..cded509636 100644
--- a/include/hw/isa/i8259_internal.h
+++ b/include/hw/isa/i8259_internal.h
@@ -42,7 +42,7 @@ typedef struct PICCommonState PICCommonState;
typedef struct PICCommonClass
{
ISADeviceClass parent_class;
- void (*init)(PICCommonState *s);
+
void (*pre_save)(PICCommonState *s);
void (*post_load)(PICCommonState *s);
} PICCommonClass;
diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index 82da37c11d..e1bf96ca69 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -22,17 +22,22 @@
typedef struct ISADeviceClass {
DeviceClass parent_class;
- int (*init)(ISADevice *dev);
} ISADeviceClass;
struct ISABus {
- BusState qbus;
+ /*< private >*/
+ BusState parent_obj;
+ /*< public >*/
+
MemoryRegion *address_space_io;
qemu_irq *irqs;
};
struct ISADevice {
- DeviceState qdev;
+ /*< private >*/
+ DeviceState parent_obj;
+ /*< public >*/
+
uint32_t isairq[2];
int nirqs;
int ioport_id;
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index cf83d5471a..7fbffcbaad 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -261,8 +261,6 @@ void qbus_reset_all_fn(void *opaque);
void qbus_free(BusState *bus);
-#define FROM_QBUS(type, dev) DO_UPCAST(type, qbus, dev)
-
/* This should go away once we get rid of the NULL bus hack */
BusState *sysbus_get_default(void);
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);