xref: /openbmc/qemu/hw/acpi/pci-bridge.c (revision 674acdd17808052519aafcbee1583ad89b66181a)
16c36ec46SIgor Mammedov /*
26c36ec46SIgor Mammedov  * QEMU ACPI PCI bridge
36c36ec46SIgor Mammedov  *
46c36ec46SIgor Mammedov  * Copyright (c) 2023 Red Hat, Inc.
56c36ec46SIgor Mammedov  *
66c36ec46SIgor Mammedov  * Author:
76c36ec46SIgor Mammedov  *   Igor Mammedov <imammedo@redhat.com>
86c36ec46SIgor Mammedov  *
96c36ec46SIgor Mammedov  * SPDX-License-Identifier: GPL-2.0-or-later
106c36ec46SIgor Mammedov  *
116c36ec46SIgor Mammedov  * This work is licensed under the terms of the GNU GPL, version 2 or later.
126c36ec46SIgor Mammedov  * See the COPYING file in the top-level directory.
136c36ec46SIgor Mammedov  */
146c36ec46SIgor Mammedov 
156c36ec46SIgor Mammedov #include "qemu/osdep.h"
166c36ec46SIgor Mammedov #include "hw/acpi/pci.h"
176c36ec46SIgor Mammedov #include "hw/pci/pci_bridge.h"
186c36ec46SIgor Mammedov #include "hw/acpi/pcihp.h"
196c36ec46SIgor Mammedov 
build_pci_bridge_aml(AcpiDevAmlIf * adev,Aml * scope)206c36ec46SIgor Mammedov void build_pci_bridge_aml(AcpiDevAmlIf *adev, Aml *scope)
216c36ec46SIgor Mammedov {
226c36ec46SIgor Mammedov     PCIBridge *br = PCI_BRIDGE(adev);
236c36ec46SIgor Mammedov 
240e84fd3bSIgor Mammedov     if (!DEVICE(br)->hotplugged) {
25*02c10613SIgor Mammedov         PCIBus *sec_bus = pci_bridge_get_sec_bus(br);
26*02c10613SIgor Mammedov 
27*02c10613SIgor Mammedov         build_append_pci_bus_devices(scope, sec_bus);
28*02c10613SIgor Mammedov 
29*02c10613SIgor Mammedov         /*
30*02c10613SIgor Mammedov          * generate hotplug slots descriptors if
31*02c10613SIgor Mammedov          * bridge has ACPI PCI hotplug attached,
32*02c10613SIgor Mammedov          */
33*02c10613SIgor Mammedov         if (object_property_find(OBJECT(sec_bus), ACPI_PCIHP_PROP_BSEL)) {
34*02c10613SIgor Mammedov             build_append_pcihp_slots(scope, sec_bus);
35*02c10613SIgor Mammedov         }
366c36ec46SIgor Mammedov     }
376c36ec46SIgor Mammedov }
38