mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
vga-isa: QOM'ify ISA VGA
Introduce type constant and cast macro to obsolete DO_UPCAST() and container_of(). Prepares for ISA realizefn. Unify function naming scheme while at it. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Andreas Färber <afaerber@suse.de> Message-id: 1367093935-29091-18-git-send-email-afaerber@suse.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
b582b5a398
commit
a72dc5fc67
1 changed files with 17 additions and 12 deletions
|
@ -31,14 +31,18 @@
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
|
|
||||||
|
#define TYPE_ISA_VGA "isa-vga"
|
||||||
|
#define ISA_VGA(obj) OBJECT_CHECK(ISAVGAState, (obj), TYPE_ISA_VGA)
|
||||||
|
|
||||||
typedef struct ISAVGAState {
|
typedef struct ISAVGAState {
|
||||||
ISADevice dev;
|
ISADevice parent_obj;
|
||||||
|
|
||||||
struct VGACommonState state;
|
struct VGACommonState state;
|
||||||
} ISAVGAState;
|
} ISAVGAState;
|
||||||
|
|
||||||
static void vga_reset_isa(DeviceState *dev)
|
static void vga_isa_reset(DeviceState *dev)
|
||||||
{
|
{
|
||||||
ISAVGAState *d = container_of(dev, ISAVGAState, dev.qdev);
|
ISAVGAState *d = ISA_VGA(dev);
|
||||||
VGACommonState *s = &d->state;
|
VGACommonState *s = &d->state;
|
||||||
|
|
||||||
vga_common_reset(s);
|
vga_common_reset(s);
|
||||||
|
@ -46,7 +50,7 @@ static void vga_reset_isa(DeviceState *dev)
|
||||||
|
|
||||||
static int vga_initfn(ISADevice *dev)
|
static int vga_initfn(ISADevice *dev)
|
||||||
{
|
{
|
||||||
ISAVGAState *d = DO_UPCAST(ISAVGAState, dev, dev);
|
ISAVGAState *d = ISA_VGA(dev);
|
||||||
VGACommonState *s = &d->state;
|
VGACommonState *s = &d->state;
|
||||||
MemoryRegion *vga_io_memory;
|
MemoryRegion *vga_io_memory;
|
||||||
const MemoryRegionPortio *vga_ports, *vbe_ports;
|
const MemoryRegionPortio *vga_ports, *vbe_ports;
|
||||||
|
@ -75,26 +79,27 @@ static Property vga_isa_properties[] = {
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
};
|
};
|
||||||
|
|
||||||
static void vga_class_initfn(ObjectClass *klass, void *data)
|
static void vga_isa_class_initfn(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
|
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
ic->init = vga_initfn;
|
ic->init = vga_initfn;
|
||||||
dc->reset = vga_reset_isa;
|
dc->reset = vga_isa_reset;
|
||||||
dc->vmsd = &vmstate_vga_common;
|
dc->vmsd = &vmstate_vga_common;
|
||||||
dc->props = vga_isa_properties;
|
dc->props = vga_isa_properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo vga_info = {
|
static const TypeInfo vga_isa_info = {
|
||||||
.name = "isa-vga",
|
.name = TYPE_ISA_VGA,
|
||||||
.parent = TYPE_ISA_DEVICE,
|
.parent = TYPE_ISA_DEVICE,
|
||||||
.instance_size = sizeof(ISAVGAState),
|
.instance_size = sizeof(ISAVGAState),
|
||||||
.class_init = vga_class_initfn,
|
.class_init = vga_isa_class_initfn,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void vga_register_types(void)
|
static void vga_isa_register_types(void)
|
||||||
{
|
{
|
||||||
type_register_static(&vga_info);
|
type_register_static(&vga_isa_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
type_init(vga_register_types)
|
type_init(vga_isa_register_types)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue