From 6c36ec46b0d28f682eed1ce1278989535c1307dc Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Thu, 12 Jan 2023 15:03:01 +0100 Subject: pcihp: make bridge describe itself using AcpiDevAmlIfClass:build_dev_aml simplify build_append_pci_bus_devices() a bit by handling bridge specific logic in bridge dedicated AcpiDevAmlIfClass::build_dev_aml callback. Signed-off-by: Igor Mammedov Message-Id: <20230112140312.3096331-30-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pci_bridge.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'hw/pci') diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c index a1a1cc8..dd5af50 100644 --- a/hw/pci/pci_bridge.c +++ b/hw/pci/pci_bridge.c @@ -37,6 +37,7 @@ #include "qemu/range.h" #include "qapi/error.h" #include "hw/acpi/acpi_aml_interface.h" +#include "hw/acpi/pci.h" /* PCI bridge subsystem vendor ID helper functions */ #define PCI_SSVID_SIZEOF 8 @@ -468,10 +469,18 @@ int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, int cap_offset, return 0; } +static void pci_bridge_class_init(ObjectClass *klass, void *data) +{ + AcpiDevAmlIfClass *adevc = ACPI_DEV_AML_IF_CLASS(klass); + + adevc->build_dev_aml = build_pci_bridge_aml; +} + static const TypeInfo pci_bridge_type_info = { .name = TYPE_PCI_BRIDGE, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(PCIBridge), + .class_init = pci_bridge_class_init, .abstract = true, .interfaces = (InterfaceInfo[]) { { TYPE_ACPI_DEV_AML_IF }, -- cgit v1.1