mirror of
https://github.com/qemu/qemu.git
synced 2025-08-15 05:06:56 +00:00
ide/ich: Convert to realize
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Gonglei <arei.gonglei@huawei.com>
This commit is contained in:
parent
28d85904da
commit
b8a2dac04a
13
hw/ide/ich.c
13
hw/ide/ich.c
@ -98,7 +98,7 @@ static void pci_ich9_reset(DeviceState *dev)
|
|||||||
ahci_reset(&d->ahci);
|
ahci_reset(&d->ahci);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pci_ich9_ahci_init(PCIDevice *dev)
|
static void pci_ich9_ahci_realize(PCIDevice *dev, Error **errp)
|
||||||
{
|
{
|
||||||
struct AHCIPCIState *d;
|
struct AHCIPCIState *d;
|
||||||
int sata_cap_offset;
|
int sata_cap_offset;
|
||||||
@ -123,10 +123,11 @@ static int pci_ich9_ahci_init(PCIDevice *dev)
|
|||||||
pci_register_bar(dev, ICH9_MEM_BAR, PCI_BASE_ADDRESS_SPACE_MEMORY,
|
pci_register_bar(dev, ICH9_MEM_BAR, PCI_BASE_ADDRESS_SPACE_MEMORY,
|
||||||
&d->ahci.mem);
|
&d->ahci.mem);
|
||||||
|
|
||||||
sata_cap_offset = pci_add_capability(dev, PCI_CAP_ID_SATA,
|
sata_cap_offset = pci_add_capability2(dev, PCI_CAP_ID_SATA,
|
||||||
ICH9_SATA_CAP_OFFSET, SATA_CAP_SIZE);
|
ICH9_SATA_CAP_OFFSET, SATA_CAP_SIZE,
|
||||||
|
errp);
|
||||||
if (sata_cap_offset < 0) {
|
if (sata_cap_offset < 0) {
|
||||||
return sata_cap_offset;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sata_cap = dev->config + sata_cap_offset;
|
sata_cap = dev->config + sata_cap_offset;
|
||||||
@ -139,8 +140,6 @@ static int pci_ich9_ahci_init(PCIDevice *dev)
|
|||||||
* should be PMCAP, the Intel ICH9 data sheet specifies that the ICH9
|
* should be PMCAP, the Intel ICH9 data sheet specifies that the ICH9
|
||||||
* AHCI device puts the MSI capability first, pointing to 0x80. */
|
* AHCI device puts the MSI capability first, pointing to 0x80. */
|
||||||
msi_init(dev, ICH9_MSI_CAP_OFFSET, 1, true, false);
|
msi_init(dev, ICH9_MSI_CAP_OFFSET, 1, true, false);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pci_ich9_uninit(PCIDevice *dev)
|
static void pci_ich9_uninit(PCIDevice *dev)
|
||||||
@ -158,7 +157,7 @@ static void ich_ahci_class_init(ObjectClass *klass, void *data)
|
|||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
k->init = pci_ich9_ahci_init;
|
k->realize = pci_ich9_ahci_realize;
|
||||||
k->exit = pci_ich9_uninit;
|
k->exit = pci_ich9_uninit;
|
||||||
k->vendor_id = PCI_VENDOR_ID_INTEL;
|
k->vendor_id = PCI_VENDOR_ID_INTEL;
|
||||||
k->device_id = PCI_DEVICE_ID_INTEL_82801IR;
|
k->device_id = PCI_DEVICE_ID_INTEL_82801IR;
|
||||||
|
Loading…
Reference in New Issue
Block a user