mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
ahci: split realize and init
Do the init level tasks asap and the realize later (mainly when num_ports is available). This allows sub-class realize routines to work with the device post-init. Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Reviewed-by: John Snow <jsnow@redhat.com> Message-id: 1a7c7b2b32e5ccf49373a5065da5ece89730d3ac.1445917756.git.crosthwaite.peter@gmail.com Signed-off-by: John Snow <jsnow@redhat.com>
This commit is contained in:
parent
802742670d
commit
0487eea48e
3 changed files with 34 additions and 15 deletions
10
hw/ide/ich.c
10
hw/ide/ich.c
|
@ -97,6 +97,13 @@ static void pci_ich9_reset(DeviceState *dev)
|
|||
ahci_reset(&d->ahci);
|
||||
}
|
||||
|
||||
static void pci_ich9_ahci_init(Object *obj)
|
||||
{
|
||||
struct AHCIPCIState *d = ICH_AHCI(obj);
|
||||
|
||||
ahci_init(&d->ahci, DEVICE(obj));
|
||||
}
|
||||
|
||||
static void pci_ich9_ahci_realize(PCIDevice *dev, Error **errp)
|
||||
{
|
||||
struct AHCIPCIState *d;
|
||||
|
@ -104,7 +111,7 @@ static void pci_ich9_ahci_realize(PCIDevice *dev, Error **errp)
|
|||
uint8_t *sata_cap;
|
||||
d = ICH_AHCI(dev);
|
||||
|
||||
ahci_init(&d->ahci, DEVICE(dev), pci_get_address_space(dev), 6);
|
||||
ahci_realize(&d->ahci, DEVICE(dev), pci_get_address_space(dev), 6);
|
||||
|
||||
pci_config_set_prog_interface(dev->config, AHCI_PROGMODE_MAJOR_REV_1);
|
||||
|
||||
|
@ -171,6 +178,7 @@ static const TypeInfo ich_ahci_info = {
|
|||
.name = TYPE_ICH9_AHCI,
|
||||
.parent = TYPE_PCI_DEVICE,
|
||||
.instance_size = sizeof(AHCIPCIState),
|
||||
.instance_init = pci_ich9_ahci_init,
|
||||
.class_init = ich_ahci_class_init,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue