piix4: QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
Gonglei 2015-05-13 08:43:24 +08:00 committed by Michael Tokarev
parent b7c69719d2
commit acff3e48b7

View File

@ -34,6 +34,10 @@ typedef struct PIIX4State {
PCIDevice dev; PCIDevice dev;
} PIIX4State; } PIIX4State;
#define TYPE_PIIX4_PCI_DEVICE "PIIX4"
#define PIIX4_PCI_DEVICE(obj) \
OBJECT_CHECK(PIIX4State, (obj), TYPE_PIIX4_PCI_DEVICE)
static void piix4_reset(void *opaque) static void piix4_reset(void *opaque)
{ {
PIIX4State *d = opaque; PIIX4State *d = opaque;
@ -84,7 +88,7 @@ static const VMStateDescription vmstate_piix4 = {
static void piix4_realize(PCIDevice *dev, Error **errp) static void piix4_realize(PCIDevice *dev, Error **errp)
{ {
PIIX4State *d = DO_UPCAST(PIIX4State, dev, dev); PIIX4State *d = PIIX4_PCI_DEVICE(dev);
isa_bus_new(DEVICE(d), pci_address_space(dev), isa_bus_new(DEVICE(d), pci_address_space(dev),
pci_address_space_io(dev)); pci_address_space_io(dev));
@ -121,7 +125,7 @@ static void piix4_class_init(ObjectClass *klass, void *data)
} }
static const TypeInfo piix4_info = { static const TypeInfo piix4_info = {
.name = "PIIX4", .name = TYPE_PIIX4_PCI_DEVICE,
.parent = TYPE_PCI_DEVICE, .parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(PIIX4State), .instance_size = sizeof(PIIX4State),
.class_init = piix4_class_init, .class_init = piix4_class_init,