[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/8] hw/pci-host/bonito: Create PCI function #0 in bridge realize
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 5/8] hw/pci-host/bonito: Create PCI function #0 in bridge realize() handler |
Date: |
Thu, 5 Jan 2023 14:07:07 +0100 |
The PCI function #0 is an integral part of the PCI bridge,
instantiate it internally during the bridge creation.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/pci-host/bonito.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index d881c85509..7722636e9e 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -651,6 +651,11 @@ static void bonito_host_realize(DeviceState *dev, Error
**errp)
}
create_unimplemented_device("pci.io", BONITO_PCIIO_BASE, 1 * MiB);
+
+ bs->pci_dev = PCI_BONITO(pci_new(PCI_DEVFN(0, 0), TYPE_PCI_BONITO));
+ object_property_add_const_link(OBJECT(bs->pci_dev), "host-bridge",
+ OBJECT(bs));
+ pci_realize_and_unref(PCI_DEVICE(bs->pci_dev), phb->bus, &error_fatal);
}
static void bonito_pci_realize(PCIDevice *dev, Error **errp)
@@ -752,7 +757,6 @@ PCIBus *bonito_init(qemu_irq *pic)
DeviceState *dev;
BonitoState *pcihost;
PCIHostState *phb;
- PCIDevice *d;
dev = qdev_new(TYPE_BONITO_PCI_HOST_BRIDGE);
phb = PCI_HOST_BRIDGE(dev);
@@ -760,11 +764,6 @@ PCIBus *bonito_init(qemu_irq *pic)
pcihost->pic = pic;
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
- d = pci_new(PCI_DEVFN(0, 0), TYPE_PCI_BONITO);
- object_property_add_const_link(OBJECT(d), "host-bridge", OBJECT(dev));
- pci_realize_and_unref(d, phb->bus, &error_fatal);
- pcihost->pci_dev = PCI_BONITO(d);
-
return phb->bus;
}
--
2.38.1
- [PATCH 1/8] hw/pci-host/bonito: Convert to 3-phase reset, (continued)
- [PATCH 1/8] hw/pci-host/bonito: Convert to 3-phase reset, Philippe Mathieu-Daudé, 2023/01/05
- [PATCH 2/8] hw/pci-host/bonito: Use 'bonito_host' for PCI host bridge code, Philippe Mathieu-Daudé, 2023/01/05
- [PATCH 3/8] hw/pci-host/bonito: Use 'bonito_pci' for PCI function #0 code, Philippe Mathieu-Daudé, 2023/01/05
- [PATCH 4/8] hw/pci-host/bonito: Set reference using object_property_add_const_link(), Philippe Mathieu-Daudé, 2023/01/05
- [PATCH 8/8] hw/mips/fuloong2e: Open code bonito_init(), Philippe Mathieu-Daudé, 2023/01/05
- [PATCH 5/8] hw/pci-host/bonito: Create PCI function #0 in bridge realize() handler,
Philippe Mathieu-Daudé <=
- [PATCH 7/8] hw/pci-host/bonito: Declare TYPE_BONITO_PCI_HOST_BRIDGE in header, Philippe Mathieu-Daudé, 2023/01/05
- [PATCH 6/8] hw/pci-host/bonito: Sysbus'ify outgoing IRQ, Philippe Mathieu-Daudé, 2023/01/05
- Re: [PATCH 0/8] hw/pci-host/bonito: Housekeeping, Philippe Mathieu-Daudé, 2023/01/13