[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 40/73] pcihp: move PCI _DSM function 0 prolog into separate functi
From: |
Michael S. Tsirkin |
Subject: |
[PULL 40/73] pcihp: move PCI _DSM function 0 prolog into separate function |
Date: |
Tue, 7 Mar 2023 20:12:49 -0500 |
From: Igor Mammedov <imammedo@redhat.com>
it will be reused by follow up patches that will implement
static _DSM for non-hotpluggable devices.
no functional AML change, only context one, where 'cap' (Local1)
initialization is moved after UUID/revision checks.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-15-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 | 54 ++++++++++++++++++++++++--------------------
1 file changed, 30 insertions(+), 24 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index c691104d47..d8ec91b8e3 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -373,6 +373,33 @@ Aml *aml_pci_device_dsm(void)
return method;
}
+static void build_append_pci_dsm_func0_common(Aml *ctx, Aml *retvar)
+{
+ Aml *UUID, *ifctx1;
+ uint8_t byte_list[1] = { 0 }; /* nothing supported yet */
+
+ aml_append(ctx, aml_store(aml_buffer(1, byte_list), retvar));
+ /*
+ * PCI Firmware Specification 3.1
+ * 4.6. _DSM Definitions for PCI
+ */
+ UUID = aml_touuid("E5C937D0-3553-4D7A-9117-EA4D19C3434D");
+ ifctx1 = aml_if(aml_lnot(aml_equal(aml_arg(0), UUID)));
+ {
+ /* call is for unsupported UUID, bail out */
+ aml_append(ifctx1, aml_return(retvar));
+ }
+ aml_append(ctx, ifctx1);
+
+ ifctx1 = aml_if(aml_lless(aml_arg(1), aml_int(2)));
+ {
+ /* call is for unsupported REV, bail out */
+ aml_append(ifctx1, aml_return(retvar));
+ }
+ aml_append(ctx, ifctx1);
+}
+
+
static void build_append_pcihp_notify_entry(Aml *method, int slot)
{
Aml *if_ctx;
@@ -570,14 +597,13 @@ static bool build_append_notfication_callback(Aml
*parent_scope,
static Aml *aml_pci_pdsm(void)
{
- Aml *method, *UUID, *ifctx, *ifctx1;
+ Aml *method, *ifctx, *ifctx1;
Aml *ret = aml_local(0);
Aml *caps = aml_local(1);
Aml *acpi_index = aml_local(2);
Aml *zero = aml_int(0);
Aml *one = aml_int(1);
Aml *func = aml_arg(2);
- Aml *rev = aml_arg(1);
Aml *params = aml_arg(4);
Aml *bnum = aml_derefof(aml_index(params, aml_int(0)));
Aml *sunum = aml_derefof(aml_index(params, aml_int(1)));
@@ -587,29 +613,9 @@ static Aml *aml_pci_pdsm(void)
/* get supported functions */
ifctx = aml_if(aml_equal(func, zero));
{
- uint8_t byte_list[1] = { 0 }; /* nothing supported yet */
- aml_append(ifctx, aml_store(aml_buffer(1, byte_list), ret));
+ build_append_pci_dsm_func0_common(ifctx, ret);
+
aml_append(ifctx, aml_store(zero, caps));
-
- /*
- * PCI Firmware Specification 3.1
- * 4.6. _DSM Definitions for PCI
- */
- UUID = aml_touuid("E5C937D0-3553-4D7A-9117-EA4D19C3434D");
- ifctx1 = aml_if(aml_lnot(aml_equal(aml_arg(0), UUID)));
- {
- /* call is for unsupported UUID, bail out */
- aml_append(ifctx1, aml_return(ret));
- }
- aml_append(ifctx, ifctx1);
-
- ifctx1 = aml_if(aml_lless(rev, aml_int(2)));
- {
- /* call is for unsupported REV, bail out */
- aml_append(ifctx1, aml_return(ret));
- }
- aml_append(ifctx, ifctx1);
-
aml_append(ifctx,
aml_store(aml_call2("AIDX", bnum, sunum), acpi_index));
/*
--
MST
- [PULL 25/73] vdpa net: allow VHOST_F_LOG_ALL, (continued)
- [PULL 25/73] vdpa net: allow VHOST_F_LOG_ALL, Michael S. Tsirkin, 2023/03/07
- [PULL 27/73] Revert "tests/qtest: Check for devices in bios-tables-test", Michael S. Tsirkin, 2023/03/07
- [PULL 31/73] tests: acpi: whitelist q35/DSDT.multi-bridge before extending testcase, Michael S. Tsirkin, 2023/03/07
- [PULL 33/73] x86: pcihp: fix missing PCNT callchain when intermediate root-port has 'hotplug=off' set, Michael S. Tsirkin, 2023/03/07
- [PULL 32/73] tests: acpi: extend multi-bridge case with case 'root-port,id=HOHP,hotplug=off root-port,bus=NOHP', Michael S. Tsirkin, 2023/03/07
- [PULL 34/73] tests: acpi: whitelist pc/DSDT.hpbrroot and pc/DSDT.hpbridge tests, Michael S. Tsirkin, 2023/03/07
- [PULL 35/73] x86: pcihp: fix missing bridge AML when intermediate root-port has 'hotplug=off' set, Michael S. Tsirkin, 2023/03/07
- [PULL 36/73] tests: acpi: update expected blobs, Michael S. Tsirkin, 2023/03/07
- [PULL 37/73] pcihp: piix4: do not redirect hotplug controller to piix4 when ACPI hotplug is disabled, Michael S. Tsirkin, 2023/03/07
- [PULL 38/73] pci: fix 'hotplugglable' property behavior, Michael S. Tsirkin, 2023/03/07
- [PULL 40/73] pcihp: move PCI _DSM function 0 prolog into separate function,
Michael S. Tsirkin <=
- [PULL 39/73] tests: acpi: whitelist DSDT blobs before isolating PCI _DSM func 0 prolog, Michael S. Tsirkin, 2023/03/07
- [PULL 41/73] tests: acpi: update expected blobs, Michael S. Tsirkin, 2023/03/07
- [PULL 42/73] tests: acpi: whitelist DSDT before adding EDSM method, Michael S. Tsirkin, 2023/03/07
- [PULL 43/73] acpi: pci: add EDSM method to DSDT, Michael S. Tsirkin, 2023/03/07
- [PULL 44/73] tests: acpi: update expected blobs, Michael S. Tsirkin, 2023/03/07
- [PULL 45/73] tests: acpi: whitelist DSDT before adding device with acpi-index to testcases, Michael S. Tsirkin, 2023/03/07
- [PULL 46/73] tests: acpi: add device with acpi-index on non-hotpluggble bus, Michael S. Tsirkin, 2023/03/07
- [PULL 47/73] acpi: pci: support acpi-index for non-hotpluggable devices, Michael S. Tsirkin, 2023/03/07
- [PULL 48/73] tests: acpi: update expected blobs, Michael S. Tsirkin, 2023/03/07
- [PULL 52/73] tests: acpi: whitelist DSDT before adding non-0 function device with acpi-index to testcases, Michael S. Tsirkin, 2023/03/07