mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
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
This commit is contained in:
commit
371a775dc1
53 changed files with 533 additions and 389 deletions
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue