mirror of https://gitee.com/openkylin/qemu.git
i82374: device only existed as ISA device, so simplify device
Merge ISAi82374State fields into parent structure I82374State. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Message-id: 1453843944-26833-2-git-send-email-hpoussin@reactos.org Signed-off-by: John Snow <jsnow@redhat.com>
This commit is contained in:
parent
fd9bdbd345
commit
449ae7eca9
|
@ -25,6 +25,9 @@
|
|||
#include "qemu/osdep.h"
|
||||
#include "hw/isa/isa.h"
|
||||
|
||||
#define TYPE_I82374 "i82374"
|
||||
#define I82374(obj) OBJECT_CHECK(I82374State, (obj), TYPE_I82374)
|
||||
|
||||
//#define DEBUG_I82374
|
||||
|
||||
#ifdef DEBUG_I82374
|
||||
|
@ -38,6 +41,9 @@ do {} while (0)
|
|||
do { fprintf(stderr, "i82374 ERROR: " fmt , ## __VA_ARGS__); } while (0)
|
||||
|
||||
typedef struct I82374State {
|
||||
ISADevice parent_obj;
|
||||
|
||||
uint32_t iobase;
|
||||
uint8_t commands[8];
|
||||
PortioList port_list;
|
||||
} I82374State;
|
||||
|
@ -99,32 +105,6 @@ static uint32_t i82374_read_descriptor(void *opaque, uint32_t nport)
|
|||
return val;
|
||||
}
|
||||
|
||||
static void i82374_realize(I82374State *s, Error **errp)
|
||||
{
|
||||
DMA_init(1);
|
||||
memset(s->commands, 0, sizeof(s->commands));
|
||||
}
|
||||
|
||||
#define TYPE_I82374 "i82374"
|
||||
#define I82374(obj) OBJECT_CHECK(ISAi82374State, (obj), TYPE_I82374)
|
||||
|
||||
typedef struct ISAi82374State {
|
||||
ISADevice parent_obj;
|
||||
|
||||
uint32_t iobase;
|
||||
I82374State state;
|
||||
} ISAi82374State;
|
||||
|
||||
static const VMStateDescription vmstate_isa_i82374 = {
|
||||
.name = "isa-i82374",
|
||||
.version_id = 0,
|
||||
.minimum_version_id = 0,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_STRUCT(state, ISAi82374State, 0, vmstate_i82374, I82374State),
|
||||
VMSTATE_END_OF_LIST()
|
||||
},
|
||||
};
|
||||
|
||||
static const MemoryRegionPortio i82374_portio_list[] = {
|
||||
{ 0x0A, 1, 1, .read = i82374_read_isr, },
|
||||
{ 0x10, 8, 1, .write = i82374_write_command, },
|
||||
|
@ -134,21 +114,21 @@ static const MemoryRegionPortio i82374_portio_list[] = {
|
|||
PORTIO_END_OF_LIST(),
|
||||
};
|
||||
|
||||
static void i82374_isa_realize(DeviceState *dev, Error **errp)
|
||||
static void i82374_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
ISAi82374State *isa = I82374(dev);
|
||||
I82374State *s = &isa->state;
|
||||
I82374State *s = I82374(dev);
|
||||
|
||||
portio_list_init(&s->port_list, OBJECT(isa), i82374_portio_list, s,
|
||||
portio_list_init(&s->port_list, OBJECT(s), i82374_portio_list, s,
|
||||
"i82374");
|
||||
portio_list_add(&s->port_list, isa_address_space_io(&isa->parent_obj),
|
||||
isa->iobase);
|
||||
portio_list_add(&s->port_list, isa_address_space_io(&s->parent_obj),
|
||||
s->iobase);
|
||||
|
||||
i82374_realize(s, errp);
|
||||
DMA_init(1);
|
||||
memset(s->commands, 0, sizeof(s->commands));
|
||||
}
|
||||
|
||||
static Property i82374_properties[] = {
|
||||
DEFINE_PROP_UINT32("iobase", ISAi82374State, iobase, 0x400),
|
||||
DEFINE_PROP_UINT32("iobase", I82374State, iobase, 0x400),
|
||||
DEFINE_PROP_END_OF_LIST()
|
||||
};
|
||||
|
||||
|
@ -156,21 +136,21 @@ static void i82374_class_init(ObjectClass *klass, void *data)
|
|||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
|
||||
dc->realize = i82374_isa_realize;
|
||||
dc->vmsd = &vmstate_isa_i82374;
|
||||
dc->realize = i82374_realize;
|
||||
dc->vmsd = &vmstate_i82374;
|
||||
dc->props = i82374_properties;
|
||||
}
|
||||
|
||||
static const TypeInfo i82374_isa_info = {
|
||||
static const TypeInfo i82374_info = {
|
||||
.name = TYPE_I82374,
|
||||
.parent = TYPE_ISA_DEVICE,
|
||||
.instance_size = sizeof(ISAi82374State),
|
||||
.instance_size = sizeof(I82374State),
|
||||
.class_init = i82374_class_init,
|
||||
};
|
||||
|
||||
static void i82374_register_types(void)
|
||||
{
|
||||
type_register_static(&i82374_isa_info);
|
||||
type_register_static(&i82374_info);
|
||||
}
|
||||
|
||||
type_init(i82374_register_types)
|
||||
|
|
Loading…
Reference in New Issue