aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-01-23 23:03:56 +0000
committerAlexander Graf <agraf@suse.de>2013-01-25 22:02:54 +0100
commit7b925079e36cf26ca2e1f8db84b771ddc3d6340c (patch)
tree6989d01065dc1f262719d7914f5bc6bf37187c25
parentfcf1bbabf4de3bc125c4dff18ea1cb76d76f042a (diff)
macio: Delay qdev init until all fields are initialized
This turns macio_bar_setup() into an implementation detail of the qdev initfn, to be removed step by step. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r--hw/macio.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/hw/macio.c b/hw/macio.c
index 770e3bdb97..8b4b48d135 100644
--- a/hw/macio.c
+++ b/hw/macio.c
@@ -82,7 +82,13 @@ static void macio_bar_setup(MacIOState *macio_state)
static int macio_initfn(PCIDevice *d)
{
+ MacIOState *s = MACIO(d);
+
d->config[0x3d] = 0x01; // interrupt on pin 1
+
+ macio_bar_setup(s);
+ pci_register_bar(d, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar);
+
return 0;
}
@@ -127,7 +133,7 @@ void macio_init (PCIBus *bus, int device_id, int is_oldworld,
MacIOState *macio_state;
int i;
- d = pci_create_simple(bus, -1, TYPE_MACIO);
+ d = pci_create(bus, -1, TYPE_MACIO);
macio_state = MACIO(d);
macio_state->is_oldworld = is_oldworld;
@@ -148,6 +154,5 @@ void macio_init (PCIBus *bus, int device_id, int is_oldworld,
pci_config_set_device_id(d->config, device_id);
- macio_bar_setup(macio_state);
- pci_register_bar(d, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &macio_state->bar);
+ qdev_init_nofail(DEVICE(d));
}