[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 31/34] acpi: pci: move BSEL into build_append_pcihp_slots()
From: |
Igor Mammedov |
Subject: |
[PATCH v2 31/34] acpi: pci: move BSEL into build_append_pcihp_slots() |
Date: |
Thu, 2 Mar 2023 17:15:40 +0100 |
Generic PCI enumeration code doesn't really need access to
BSEL value, it is only used as means to decide if hotplug
enumerator should be called.
Use stateless object_property_find() to do that, and move
the rest of BSEL handling into build_append_pcihp_slots()
where it belongs.
This cleans up generic code a bit from hotplug stuff
and follow up patch will remove remaining call to
build_append_pcihp_slots() from generic code, making
it possible to use without ACPI PCI hotplug dependencies.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
hw/i386/acpi-build.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index ce14866eda..0459acfbb4 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -520,12 +520,14 @@ static bool is_devfn_ignored_hotplug(const int devfn,
const PCIBus *bus)
return false;
}
-static void build_append_pcihp_slots(Aml *parent_scope, PCIBus *bus,
- QObject *bsel)
+static void build_append_pcihp_slots(Aml *parent_scope, PCIBus *bus)
{
int devfn;
Aml *dev, *notify_method = NULL, *method;
+ QObject *bsel = object_property_get_qobject(OBJECT(bus),
+ ACPI_PCIHP_PROP_BSEL, NULL);
uint64_t bsel_val = qnum_get_uint(qobject_to(QNum, bsel));
+ qobject_unref(bsel);
aml_append(parent_scope, aml_name_decl("BSEL", aml_int(bsel_val)));
notify_method = aml_method("DVNT", 2, AML_NOTSERIALIZED);
@@ -570,12 +572,9 @@ static void build_append_pcihp_slots(Aml *parent_scope,
PCIBus *bus,
void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus)
{
- QObject *bsel;
int devfn;
Aml *dev;
- bsel = object_property_get_qobject(OBJECT(bus), ACPI_PCIHP_PROP_BSEL,
NULL);
-
for (devfn = 0; devfn < ARRAY_SIZE(bus->devices); devfn++) {
/* ACPI spec: 1.0b: Table 6-2 _ADR Object Bus Types, PCI type */
int adr = PCI_SLOT(devfn) << 16 | PCI_FUNC(devfn);
@@ -601,11 +600,9 @@ void build_append_pci_bus_devices(Aml *parent_scope,
PCIBus *bus)
aml_append(parent_scope, dev);
}
- if (bsel) {
- build_append_pcihp_slots(parent_scope, bus, bsel);
+ if (object_property_find(OBJECT(bus), ACPI_PCIHP_PROP_BSEL)) {
+ build_append_pcihp_slots(parent_scope, bus);
}
-
- qobject_unref(bsel);
}
static bool build_append_notfication_callback(Aml *parent_scope,
--
2.39.1
- [PATCH v2 20/34] tests: acpi: add device with acpi-index on non-hotpluggble bus, (continued)
- [PATCH v2 20/34] tests: acpi: add device with acpi-index on non-hotpluggble bus, Igor Mammedov, 2023/03/02
- [PATCH v2 07/34] x86: pcihp: fix missing PCNT callchain when intermediate root-port has 'hotplug=off' set, Igor Mammedov, 2023/03/02
- [PATCH v2 12/34] pci: fix 'hotplugglable' property behavior, Igor Mammedov, 2023/03/02
- [PATCH v2 16/34] tests: acpi: whitelist DSDT before adding EDSM method, Igor Mammedov, 2023/03/02
- [PATCH v2 02/34] tests: acpi: whitelist new q35.noacpihp test and pc.hpbrroot, Igor Mammedov, 2023/03/02
- [PATCH v2 08/34] tests: acpi: whitelist pc/DSDT.hpbrroot and pc/DSDT.hpbridge tests, Igor Mammedov, 2023/03/02
- [PATCH v2 05/34] tests: acpi: whitelist q35/DSDT.multi-bridge before extending testcase, Igor Mammedov, 2023/03/02
- [PATCH v2 09/34] x86: pcihp: fix missing bridge AML when intermediate root-port has 'hotplug=off' set, Igor Mammedov, 2023/03/02
- [PATCH v2 17/34] acpi: pci: add EDSM method to DSDT, Igor Mammedov, 2023/03/02
- [PATCH v2 25/34] tests: acpi: update expected blobs, Igor Mammedov, 2023/03/02
- [PATCH v2 31/34] acpi: pci: move BSEL into build_append_pcihp_slots(),
Igor Mammedov <=
- [PATCH v2 24/34] acpi: pci: describe all functions on populated slots, Igor Mammedov, 2023/03/02
- [PATCH v2 30/34] acpi: pci: drop BSEL usage when deciding that device isn't hotpluggable, Igor Mammedov, 2023/03/02
- [PATCH v2 32/34] acpi: pci: move out ACPI PCI hotplug generator from generic slot generator build_append_pci_bus_devices(), Igor Mammedov, 2023/03/02