rtc: make piix3 set the rtc as a child (v2)

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Anthony Liguori 2011-12-12 14:29:38 -06:00
parent 8eb02831af
commit d0c5be5870
2 changed files with 14 additions and 0 deletions

View File

@ -205,6 +205,17 @@ static void pc_init1(MemoryRegion *system_memory,
}
}
/* FIXME there's some major spaghetti here. Somehow we create the devices
* on the PIIX before we actually create it. We create the PIIX3 deep in
* the recess of the i440fx creation too and then lose the DeviceState.
*
* For now, let's "fix" this by making judicious use of paths. This is not
* generally the right way to do this.
*/
qdev_property_add_child(qdev_resolve_path("/i440fx/piix3", NULL),
"rtc", (DeviceState *)rtc_state, NULL);
audio_init(gsi, pci_enabled ? pci_bus : NULL);
pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,

View File

@ -288,6 +288,7 @@ static PCIBus *i440fx_common_init(const char *device_name,
address_space_io, 0);
s->bus = b;
qdev_init_nofail(dev);
qdev_property_add_child(qdev_get_root(), "i440fx", dev, NULL);
d = pci_create_simple(b, 0, device_name);
*pi440fx_state = DO_UPCAST(PCII440FXState, dev, d);
@ -323,6 +324,8 @@ static PCIBus *i440fx_common_init(const char *device_name,
pci_create_simple_multifunction(b, -1, true, "PIIX3"));
pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3,
PIIX_NUM_PIRQS);
qdev_property_add_child(dev, "piix3", &piix3->dev.qdev, NULL);
}
piix3->pic = pic;