From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: mst@redhat.com, ani@anisinha.ca, minyard@acm.org,
stefanb@linux.vnet.ibm.com, marcandre.lureau@redhat.com,
kraxel@redhat.com
Subject: [PATCH 20/35] acpi: q35: isa bridge: use AcpiDevAmlIf interface to build ISA device descriptors
Date: Mon, 16 May 2022 11:25:55 -0400 [thread overview]
Message-ID: <20220516152610.1963435-21-imammedo@redhat.com> (raw)
In-Reply-To: <20220516152610.1963435-1-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>
---
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 a5dd3e4fee..33ee5bfcfb 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -861,20 +861,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;
@@ -1260,15 +1246,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);
}
@@ -1511,7 +1504,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 },
{ }
}
};
--
2.31.1
next prev parent reply other threads:[~2022-05-16 15:56 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-16 15:25 [PATCH 00/35] pc/q35: refactor ISA and SMBUS AML generation Igor Mammedov
2022-05-16 15:25 ` [PATCH 01/35] acpi: add interface to build device specific AML Igor Mammedov
2022-05-18 10:00 ` Ani Sinha
2022-05-19 12:54 ` Igor Mammedov
2022-05-16 15:25 ` [PATCH 02/35] acpi: make isa_build_aml() support AcpiDevAmlIf interface Igor Mammedov
2022-05-18 10:13 ` Ani Sinha
2022-05-16 15:25 ` [PATCH 03/35] acpi: fdc-isa: replace ISADeviceClass::build_aml with AcpiDevAmlIfClass:build_dev_aml Igor Mammedov
2022-05-16 15:25 ` [PATCH 04/35] acpi: parallel port: " Igor Mammedov
2022-05-16 15:25 ` [PATCH 05/35] acpi: serial-is: " Igor Mammedov
2022-05-16 15:25 ` [PATCH 06/35] acpi: mc146818rtc: " Igor Mammedov
2022-05-16 15:25 ` [PATCH 07/35] acpi: pckbd: " Igor Mammedov
2022-05-16 15:25 ` [PATCH 08/35] isa-bus: drop no longer used ISADeviceClass::build_aml Igor Mammedov
2022-05-16 15:25 ` [PATCH 09/35] tests: acpi: add and whitelist DSDT.ipmismbus expected blob Igor Mammedov
2022-05-16 15:25 ` [PATCH 10/35] tests: acpi: q35: add test for smbus-ipmi device Igor Mammedov
2022-05-16 15:25 ` [PATCH 11/35] tests: acpi: update expected blob DSDT.ipmismbus Igor Mammedov
2022-05-16 15:25 ` [PATCH 12/35] tests: acpi: whitelist DSDT.ipmismbus expected blob Igor Mammedov
2022-05-16 15:25 ` [PATCH 13/35] ipmi: acpi: use relative path to resource source Igor Mammedov
2022-05-16 15:25 ` [PATCH 14/35] tests: acpi: update expected DSDT.ipmismbus blob Igor Mammedov
2022-05-16 15:25 ` [PATCH 15/35] acpi: ich9-smb: add support for AcpiDevAmlIf interface Igor Mammedov
2022-05-16 15:25 ` [PATCH 16/35] acpi: ipmi: use AcpiDevAmlIf interface to build IPMI device descriptors Igor Mammedov
2022-06-07 10:56 ` Michael S. Tsirkin
2022-05-16 15:25 ` [PATCH 17/35] q35: acpi: drop not needed PCMachineClass::do_not_add_smb_acpi Igor Mammedov
2022-05-16 15:25 ` [PATCH 18/35] tests: acpi: white-list to be re-factored pc/q35 DSDT Igor Mammedov
2022-05-16 15:25 ` [PATCH 19/35] acpi: pc: isa bridge: use AcpiDevAmlIf interface to build ISA device descriptors Igor Mammedov
2022-05-16 15:25 ` Igor Mammedov [this message]
2022-05-16 15:25 ` [PATCH 21/35] tests: acpi: update expected blobs Igor Mammedov
2022-05-16 15:25 ` [PATCH 22/35] tests: acpi: add and white-list DSDT.applesmc expected blob Igor Mammedov
2022-05-16 15:25 ` [PATCH 23/35] tests: acpi: add applesmc testcase Igor Mammedov
2022-05-16 15:25 ` [PATCH 24/35] acpi: applesmc: use AcpiDevAmlIfClass:build_dev_aml to provide device's AML Igor Mammedov
2022-05-16 15:26 ` [PATCH 25/35] tests: acpi: update expected blobs Igor Mammedov
2022-05-16 15:26 ` [PATCH 26/35] tests: acpi: white-lists expected DSDT.pvpanic-isa blob Igor Mammedov
2022-05-16 15:26 ` [PATCH 27/35] tests: acpi: add pvpanic-isa: testcase Igor Mammedov
2022-05-16 15:26 ` [PATCH 28/35] acpi: pvpanic-isa: use AcpiDevAmlIfClass:build_dev_aml to provide device's AML Igor Mammedov
2022-05-16 20:46 ` Michael S. Tsirkin
2022-05-17 8:13 ` Gerd Hoffmann
2022-05-18 16:29 ` Michael S. Tsirkin
2022-05-19 11:52 ` Igor Mammedov
2022-05-26 13:57 ` Igor Mammedov
2022-05-17 16:01 ` Igor Mammedov
2022-05-19 17:56 ` Igor Mammedov
2022-05-16 15:26 ` [PATCH 29/35] tests: acpi: update expected DSDT.pvpanic-isa blob Igor Mammedov
2022-05-16 15:26 ` [PATCH 30/35] tests: acpi: white-list DSDT.tis.tpm2/DSDT.tis.tpm12 expected blobs Igor Mammedov
2022-05-18 10:20 ` Ani Sinha
2022-05-16 15:26 ` [PATCH 31/35] acpi: pc/q35: tpm-tis: fix TPM device scope Igor Mammedov
2022-05-18 9:03 ` Ani Sinha
2022-05-19 12:55 ` Igor Mammedov
2022-05-16 15:26 ` [PATCH 32/35] acpi: pc/q35: remove not needed 'if' condition on pci bus Igor Mammedov
2022-05-18 8:43 ` Ani Sinha
2022-05-16 15:26 ` [PATCH 33/35] acpi: tpm-tis: use AcpiDevAmlIfClass:build_dev_aml to provide device's AML Igor Mammedov
2022-05-18 10:45 ` Ani Sinha
2022-05-16 15:26 ` [PATCH 34/35] tests: acpi: update expected DSDT.tis.tpm2/DSDT.tis.tpm12 blobs Igor Mammedov
2022-05-18 10:49 ` Ani Sinha
2022-05-16 15:26 ` [PATCH 35/35] x86: acpi-build: do not include hw/isa/isa.h directly Igor Mammedov
2022-05-16 20:47 ` [PATCH 00/35] pc/q35: refactor ISA and SMBUS AML generation Michael S. Tsirkin
2022-05-17 16:09 ` Igor Mammedov
2022-05-17 8:17 ` Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220516152610.1963435-21-imammedo@redhat.com \
--to=imammedo@redhat.com \
--cc=ani@anisinha.ca \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=minyard@acm.org \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanb@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).