Skip to content

Commit

Permalink
x86: acpi: _DSM: use Package to pass parameters
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Igor Mammedov authored and mstsirkin committed Oct 9, 2022
1 parent a12cf69 commit 467d099
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions hw/i386/acpi-build.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 467d099

Please sign in to comment.