[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 19/35] acpi: pc: isa bridge: use AcpiDevAmlIf interface to bui
From: |
Igor Mammedov |
Subject: |
[PATCH v2 19/35] acpi: pc: isa bridge: use AcpiDevAmlIf interface to build ISA device descriptors |
Date: |
Wed, 8 Jun 2022 09:53:24 -0400 |
replaces ad-hoc build_isa_devices_aml() with generic AcpiDevAmlIf
way to build bridge AML including all devices that are attached to
its ISA bus.
Later when PCI is converted to AcpiDevAmlIf, build_piix4_isa_bridge()
will also be dropped since PCI parts itself will take care of
building device prologue/epilogue AML for each enumerated PCI
device.
Expected AML change is contextual, where ISA devices are moved
from separately declared _SB.PCI0.ISA scope , directly under
Device(ISA) node.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/i386/acpi-build.c | 16 +++++++++++-----
hw/isa/piix3.c | 17 +++++++++++++++++
2 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index d943354999..f903f30b7e 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1280,15 +1280,22 @@ static void build_piix4_isa_bridge(Aml *table)
{
Aml *dev;
Aml *scope;
+ Object *obj;
+ bool ambiguous;
+
+ /*
+ * temporarily fish out isa bridge, build_piix4_isa_bridge() will be
dropped
+ * once PCI is converted to AcpiDevAmlIf and would be ble to generate
+ * AML for bridge itself
+ */
+ obj = object_resolve_path_type("", TYPE_PIIX3_PCI_DEVICE, &ambiguous);
+ assert(obj && !ambiguous);
scope = aml_scope("_SB.PCI0");
dev = aml_device("ISA");
aml_append(dev, aml_name_decl("_ADR", aml_int(0x00010000)));
- /* PIIX PCI to ISA irq remapping */
- aml_append(dev, aml_operation_region("P40C", AML_PCI_CONFIG,
- aml_int(0x60), 0x04));
-
+ call_dev_aml_func(DEVICE(obj), dev);
aml_append(scope, dev);
aml_append(table, scope);
}
@@ -1476,7 +1483,6 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
build_hpet_aml(dsdt);
}
build_piix4_isa_bridge(dsdt);
- build_isa_devices_aml(dsdt);
if (pm->pcihp_bridge_en || pm->pcihp_root_en) {
build_x86_acpi_pci_hotplug(dsdt, pm->pcihp_io_base);
}
diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c
index dab901c9ad..bfccd666d4 100644
--- a/hw/isa/piix3.c
+++ b/hw/isa/piix3.c
@@ -32,6 +32,7 @@
#include "sysemu/reset.h"
#include "sysemu/runstate.h"
#include "migration/vmstate.h"
+#include "hw/acpi/acpi_aml_interface.h"
#define XEN_PIIX_NUM_PIRQS 128ULL
@@ -286,10 +287,24 @@ static void piix3_realize(PCIDevice *dev, Error **errp)
qemu_register_reset(piix3_reset, d);
}
+static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
+{
+ BusChild *kid;
+ BusState *bus = qdev_get_child_bus(DEVICE(adev), "isa.0");
+
+ /* PIIX PCI to ISA irq remapping */
+ aml_append(scope, aml_operation_region("P40C", AML_PCI_CONFIG,
+ aml_int(0x60), 0x04));
+ QTAILQ_FOREACH(kid, &bus->children, sibling) {
+ call_dev_aml_func(DEVICE(kid->child), scope);
+ }
+}
+
static void pci_piix3_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+ AcpiDevAmlIfClass *adevc = ACPI_DEV_AML_IF_CLASS(klass);
dc->desc = "ISA bridge";
dc->vmsd = &vmstate_piix3;
@@ -304,6 +319,7 @@ static void pci_piix3_class_init(ObjectClass *klass, void
*data)
* pc_piix.c's pc_init1()
*/
dc->user_creatable = false;
+ adevc->build_dev_aml = build_pci_isa_aml;
}
static const TypeInfo piix3_pci_type_info = {
@@ -314,6 +330,7 @@ static const TypeInfo piix3_pci_type_info = {
.class_init = pci_piix3_class_init,
.interfaces = (InterfaceInfo[]) {
{ INTERFACE_CONVENTIONAL_PCI_DEVICE },
+ { TYPE_ACPI_DEV_AML_IF },
{ },
},
};
--
2.31.1
- [PATCH v2 12/35] tests: acpi: whitelist DSDT.ipmismbus expected blob, (continued)
- [PATCH v2 12/35] tests: acpi: whitelist DSDT.ipmismbus expected blob, Igor Mammedov, 2022/06/08
- [PATCH v2 14/35] tests: acpi: update expected DSDT.ipmismbus blob, Igor Mammedov, 2022/06/08
- [PATCH v2 13/35] ipmi: acpi: use relative path to resource source, Igor Mammedov, 2022/06/08
- [PATCH v2 05/35] acpi: serial-is: replace ISADeviceClass::build_aml with AcpiDevAmlIfClass:build_dev_aml, Igor Mammedov, 2022/06/08
- [PATCH v2 15/35] acpi: ich9-smb: add support for AcpiDevAmlIf interface, Igor Mammedov, 2022/06/08
- [PATCH v2 16/35] acpi: ipmi: use AcpiDevAmlIf interface to build IPMI device descriptors, Igor Mammedov, 2022/06/08
- [PATCH v2 18/35] tests: acpi: white-list to be re-factored pc/q35 DSDT, Igor Mammedov, 2022/06/08
- [PATCH v2 17/35] q35: acpi: drop not needed PCMachineClass::do_not_add_smb_acpi, Igor Mammedov, 2022/06/08
- [PATCH v2 06/35] acpi: mc146818rtc: replace ISADeviceClass::build_aml with AcpiDevAmlIfClass:build_dev_aml, Igor Mammedov, 2022/06/08
- [PATCH v2 19/35] acpi: pc: isa bridge: use AcpiDevAmlIf interface to build ISA device descriptors,
Igor Mammedov <=
- [PATCH v2 20/35] acpi: q35: isa bridge: use AcpiDevAmlIf interface to build ISA device descriptors, Igor Mammedov, 2022/06/08
- [PATCH v2 22/35] tests: acpi: add and white-list DSDT.applesmc expected blob, Igor Mammedov, 2022/06/08
- [PATCH v2 23/35] tests: acpi: add applesmc testcase, Igor Mammedov, 2022/06/08
- [PATCH v2 24/35] acpi: applesmc: use AcpiDevAmlIfClass:build_dev_aml to provide device's AML, Igor Mammedov, 2022/06/08
- [PATCH v2 26/35] tests: acpi: white-lists expected DSDT.pvpanic-isa blob, Igor Mammedov, 2022/06/08
- [PATCH v2 27/35] tests: acpi: add pvpanic-isa: testcase, Igor Mammedov, 2022/06/08
- [PATCH v2 21/35] tests: acpi: update expected blobs, Igor Mammedov, 2022/06/08
- [PATCH v2 29/35] tests: acpi: update expected DSDT.pvpanic-isa blob, Igor Mammedov, 2022/06/08
- [PATCH v2 25/35] tests: acpi: update expected blobs, Igor Mammedov, 2022/06/08