[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 44/55] x86: acpi: _DSM: use Package to pass parameters
From: |
Michael S. Tsirkin |
Subject: |
[PULL 44/55] x86: acpi: _DSM: use Package to pass parameters |
Date: |
Mon, 10 Oct 2022 13:31:56 -0400 |
From: Igor Mammedov <imammedo@redhat.com>
Numer of possible arguments to pass to a method is limited
in ACPI. The following patches will need to pass over more
parameters to PDSM method, will hit that limit.
Prepare for this by passing structure (Package) to method,
which let us workaround arguments limitation.
Pass to PDSM all standard arguments of _DSM as is, and
pack custom parameters into Package that is passed as
the last argument to PDSM.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-7-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 | 40 +++++++++++++++++++++++++++-------------
1 file changed, 27 insertions(+), 13 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 6d02eed12c..a19900c4e4 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -431,11 +431,17 @@ static void build_append_pci_bus_devices(Aml
*parent_scope, PCIBus *bus,
);
aml_append(dev, method);
method = aml_method("_DSM", 4, AML_SERIALIZED);
- aml_append(method,
- aml_return(aml_call6("PDSM", aml_arg(0), aml_arg(1),
- aml_arg(2), aml_arg(3),
- aml_name("BSEL"), aml_name("_SUN")))
- );
+ {
+ Aml *params = aml_local(0);
+ Aml *pkg = aml_package(2);
+ aml_append(pkg, aml_name("BSEL"));
+ aml_append(pkg, aml_name("_SUN"));
+ aml_append(method, aml_store(pkg, params));
+ aml_append(method,
+ aml_return(aml_call5("PDSM", aml_arg(0), aml_arg(1),
+ aml_arg(2), aml_arg(3), params))
+ );
+ }
aml_append(dev, method);
aml_append(parent_scope, dev);
@@ -480,10 +486,17 @@ static void build_append_pci_bus_devices(Aml
*parent_scope, PCIBus *bus,
*/
aml_append(dev, aml_name_decl("ASUN", aml_int(slot)));
method = aml_method("_DSM", 4, AML_SERIALIZED);
- aml_append(method, aml_return(
- aml_call6("PDSM", aml_arg(0), aml_arg(1), aml_arg(2),
- aml_arg(3), aml_name("BSEL"), aml_name("ASUN"))
- ));
+ {
+ Aml *params = aml_local(0);
+ Aml *pkg = aml_package(2);
+ aml_append(pkg, aml_name("BSEL"));
+ aml_append(pkg, aml_name("ASUN"));
+ aml_append(method, aml_store(pkg, params));
+ aml_append(method, aml_return(
+ aml_call5("PDSM", aml_arg(0), aml_arg(1), aml_arg(2),
+ aml_arg(3), params)
+ ));
+ }
aml_append(dev, method);
}
@@ -580,12 +593,13 @@ Aml *aml_pci_device_dsm(void)
Aml *acpi_index = aml_local(2);
Aml *zero = aml_int(0);
Aml *one = aml_int(1);
- Aml *bnum = aml_arg(4);
Aml *func = aml_arg(2);
Aml *rev = aml_arg(1);
- Aml *sunum = aml_arg(5);
+ 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)));
- method = aml_method("PDSM", 6, AML_SERIALIZED);
+ method = aml_method("PDSM", 5, AML_SERIALIZED);
/* get supported functions */
ifctx = aml_if(aml_equal(func, zero));
@@ -662,10 +676,10 @@ Aml *aml_pci_device_dsm(void)
* update acpi-index to actual value
*/
aml_append(ifctx, aml_store(acpi_index, aml_index(ret, zero)));
+ aml_append(ifctx, aml_return(ret));
}
aml_append(method, ifctx);
- aml_append(method, aml_return(ret));
return method;
}
--
MST
- [PULL 34/55] qmp: add QMP command x-query-virtio-queue-element, (continued)
- [PULL 34/55] qmp: add QMP command x-query-virtio-queue-element, Michael S. Tsirkin, 2022/10/10
- [PULL 35/55] hmp: add virtio commands, Michael S. Tsirkin, 2022/10/10
- [PULL 36/55] pci: Remove unused pci_get_*_by_mask() functions, Michael S. Tsirkin, 2022/10/10
- [PULL 37/55] pci: Sanity check mask argument to pci_set_*_by_mask(), Michael S. Tsirkin, 2022/10/10
- [PULL 38/55] hw/smbios: support for type 8 (port connector), Michael S. Tsirkin, 2022/10/10
- [PULL 39/55] tests: acpi: whitelist pc/q35 DSDT due to HPET AML move, Michael S. Tsirkin, 2022/10/10
- [PULL 40/55] acpi: x86: deduplicate HPET AML building, Michael S. Tsirkin, 2022/10/10
- [PULL 41/55] tests: acpi: update expected blobs after HPET move, Michael S. Tsirkin, 2022/10/10
- [PULL 43/55] acpi: x86: refactor PDSM method to reduce nesting, Michael S. Tsirkin, 2022/10/10
- [PULL 42/55] tests: acpi: whitelist pc/q35 DSDT due to HPET AML move, Michael S. Tsirkin, 2022/10/10
- [PULL 44/55] x86: acpi: _DSM: use Package to pass parameters,
Michael S. Tsirkin <=
- [PULL 45/55] tests: acpi: update expected blobs, Michael S. Tsirkin, 2022/10/10
- [PULL 46/55] tests: acpi: whitelist pc/q35 DSDT before switching _DSM to use ASUN, Michael S. Tsirkin, 2022/10/10
- [PULL 47/55] x86: acpi: cleanup PCI device _DSM duplication, Michael S. Tsirkin, 2022/10/10
- [PULL 48/55] tests: acpi: update expected blobs, Michael S. Tsirkin, 2022/10/10
- [PULL 49/55] tests: acpi: whitelist pc/q35 DSDT before moving _ADR field, Michael S. Tsirkin, 2022/10/10
- [PULL 51/55] tests: acpi: update expected blobs, Michael S. Tsirkin, 2022/10/10
- [PULL 53/55] x86: pci: acpi: reorder Device's _DSM method, Michael S. Tsirkin, 2022/10/10
- [PULL 54/55] tests: acpi: update expected blobs, Michael S. Tsirkin, 2022/10/10
- [PULL 50/55] x86: pci: acpi: reorder Device's _ADR and _SUN fields, Michael S. Tsirkin, 2022/10/10
- [PULL 55/55] x86: pci: acpi: consolidate PCI slots creation, Michael S. Tsirkin, 2022/10/10