[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 20/54] acpi: q35: isa bridge: use AcpiDevAmlIf interface to build
From: |
Michael S. Tsirkin |
Subject: |
[PULL 20/54] acpi: q35: isa bridge: use AcpiDevAmlIf interface to build ISA device descriptors |
Date: |
Fri, 10 Jun 2022 03:58:00 -0400 |
From: Igor Mammedov <imammedo@redhat.com>
replaces adhoc 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_q35_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>
Message-Id: <20220608135340.3304695-21-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/i386/acpi-build.c | 30 +++++++++++-------------------
hw/isa/lpc_ich9.c | 19 +++++++++++++++++++
2 files changed, 30 insertions(+), 19 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index f903f30b7e..f7f1671407 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -864,20 +864,6 @@ static Aml *build_vmbus_device_aml(VMBusBridge
*vmbus_bridge)
return dev;
}
-static void build_isa_devices_aml(Aml *table)
-{
- bool ambiguous;
- Object *obj = object_resolve_path_type("", TYPE_ISA_BUS, &ambiguous);
- Aml *scope;
-
- assert(obj && !ambiguous);
-
- scope = aml_scope("_SB.PCI0.ISA");
- isa_build_aml(ISA_BUS(obj), scope);
-
- aml_append(table, scope);
-}
-
static void build_dbg_aml(Aml *table)
{
Aml *field;
@@ -1263,15 +1249,22 @@ static void build_q35_isa_bridge(Aml *table)
{
Aml *dev;
Aml *scope;
+ Object *obj;
+ bool ambiguous;
+
+ /*
+ * temporarily fish out isa bridge, build_q35_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_ICH9_LPC_DEVICE, &ambiguous);
+ assert(obj && !ambiguous);
scope = aml_scope("_SB.PCI0");
dev = aml_device("ISA");
aml_append(dev, aml_name_decl("_ADR", aml_int(0x001F0000)));
- /* ICH9 PCI to ISA irq remapping */
- aml_append(dev, aml_operation_region("PIRQ", AML_PCI_CONFIG,
- aml_int(0x60), 0x0C));
-
+ call_dev_aml_func(DEVICE(obj), dev);
aml_append(scope, dev);
aml_append(table, scope);
}
@@ -1531,7 +1524,6 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
build_hpet_aml(dsdt);
}
build_q35_isa_bridge(dsdt);
- build_isa_devices_aml(dsdt);
if (pm->pcihp_bridge_en) {
build_x86_acpi_pci_hotplug(dsdt, pm->pcihp_io_base);
}
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 5f143dca17..4553b5925b 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -50,6 +50,7 @@
#include "hw/core/cpu.h"
#include "hw/nvram/fw_cfg.h"
#include "qemu/cutils.h"
+#include "hw/acpi/acpi_aml_interface.h"
/*****************************************************************************/
/* ICH9 LPC PCI to ISA bridge */
@@ -803,12 +804,28 @@ static void ich9_send_gpe(AcpiDeviceIf *adev,
AcpiEventStatusBits ev)
acpi_send_gpe_event(&s->pm.acpi_regs, s->pm.irq, ev);
}
+static void build_ich9_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
+{
+ BusChild *kid;
+ ICH9LPCState *s = ICH9_LPC_DEVICE(adev);
+ BusState *bus = BUS(s->isa_bus);
+
+ /* ICH9 PCI to ISA irq remapping */
+ aml_append(scope, aml_operation_region("PIRQ", AML_PCI_CONFIG,
+ aml_int(0x60), 0x0C));
+
+ QTAILQ_FOREACH(kid, &bus->children, sibling) {
+ call_dev_aml_func(DEVICE(kid->child), scope);
+ }
+}
+
static void ich9_lpc_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_CLASS(klass);
+ AcpiDevAmlIfClass *amldevc = ACPI_DEV_AML_IF_CLASS(klass);
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
dc->reset = ich9_lpc_reset;
@@ -833,6 +850,7 @@ static void ich9_lpc_class_init(ObjectClass *klass, void
*data)
adevc->ospm_status = ich9_pm_ospm_status;
adevc->send_event = ich9_send_gpe;
adevc->madt_cpu = pc_madt_cpu_entry;
+ amldevc->build_dev_aml = build_ich9_isa_aml;
}
static const TypeInfo ich9_lpc_info = {
@@ -845,6 +863,7 @@ static const TypeInfo ich9_lpc_info = {
{ TYPE_HOTPLUG_HANDLER },
{ TYPE_ACPI_DEVICE_IF },
{ INTERFACE_CONVENTIONAL_PCI_DEVICE },
+ { TYPE_ACPI_DEV_AML_IF },
{ }
}
};
--
MST
- [PULL 09/54] tests: acpi: add and whitelist DSDT.ipmismbus expected blob, (continued)
- [PULL 09/54] tests: acpi: add and whitelist DSDT.ipmismbus expected blob, Michael S. Tsirkin, 2022/06/10
- [PULL 10/54] tests: acpi: q35: add test for smbus-ipmi device, Michael S. Tsirkin, 2022/06/10
- [PULL 12/54] tests: acpi: whitelist DSDT.ipmismbus expected blob, Michael S. Tsirkin, 2022/06/10
- [PULL 13/54] ipmi: acpi: use relative path to resource source, Michael S. Tsirkin, 2022/06/10
- [PULL 14/54] tests: acpi: update expected DSDT.ipmismbus blob, Michael S. Tsirkin, 2022/06/10
- [PULL 15/54] acpi: ich9-smb: add support for AcpiDevAmlIf interface, Michael S. Tsirkin, 2022/06/10
- [PULL 16/54] acpi: ipmi: use AcpiDevAmlIf interface to build IPMI device descriptors, Michael S. Tsirkin, 2022/06/10
- [PULL 17/54] q35: acpi: drop not needed PCMachineClass::do_not_add_smb_acpi, Michael S. Tsirkin, 2022/06/10
- [PULL 18/54] tests: acpi: white-list to be re-factored pc/q35 DSDT, Michael S. Tsirkin, 2022/06/10
- [PULL 19/54] acpi: pc: isa bridge: use AcpiDevAmlIf interface to build ISA device descriptors, Michael S. Tsirkin, 2022/06/10
- [PULL 20/54] acpi: q35: isa bridge: use AcpiDevAmlIf interface to build ISA device descriptors,
Michael S. Tsirkin <=
- [PULL 21/54] tests: acpi: update expected blobs, Michael S. Tsirkin, 2022/06/10
- [PULL 22/54] tests: acpi: add and white-list DSDT.applesmc expected blob, Michael S. Tsirkin, 2022/06/10
- [PULL 23/54] tests: acpi: add applesmc testcase, Michael S. Tsirkin, 2022/06/10
- [PULL 24/54] acpi: applesmc: use AcpiDevAmlIfClass:build_dev_aml to provide device's AML, Michael S. Tsirkin, 2022/06/10
- [PULL 25/54] tests: acpi: update expected blobs, Michael S. Tsirkin, 2022/06/10
- [PULL 26/54] tests: acpi: white-lists expected DSDT.pvpanic-isa blob, Michael S. Tsirkin, 2022/06/10
- [PULL 27/54] tests: acpi: add pvpanic-isa: testcase, Michael S. Tsirkin, 2022/06/10
- [PULL 28/54] acpi: pvpanic-isa: use AcpiDevAmlIfClass:build_dev_aml to provide device's AML, Michael S. Tsirkin, 2022/06/10
- [PULL 29/54] tests: acpi: update expected DSDT.pvpanic-isa blob, Michael S. Tsirkin, 2022/06/10
- [PULL 30/54] tests: acpi: white-list DSDT.tis.tpm2/DSDT.tis.tpm12 expected blobs, Michael S. Tsirkin, 2022/06/10