ACK: [PATCH v2] Add support for ACPI 6.5 _UPC return values
ivanhu
ivan.hu at canonical.com
Tue Jan 2 03:08:58 UTC 2024
Thanks!
Acked-by: Ivan Hu <ivan.hu at canonical.com>
On 12/30/23 09:45, Mario Limonciello wrote:
> The ACPI 6.5 specification includes `USB-C Port Capabilities` as
> part of the possible return values for `_UPC`.
>
> Add checks that match this guidance.
>
> Link: https://uefi.org/specs/ACPI/6.5/09_ACPI_Defined_Devices_and_Device_Specific_Objects.html?highlight=upc#upc-usb-port-capabilities
> Signed-off-by: Mario Limonciello <mario.limonciello at amd.com>
> ---
> v1->v2:
> * Drop unnecessary for loop
> ---
> src/acpi/method/method.c | 34 +++++++++++++++++++++++++++-------
> 1 file changed, 27 insertions(+), 7 deletions(-)
>
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index 27e2410d..ec48f72b 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -2844,12 +2844,12 @@ static void method_test_UPC_return(
> ACPI_OBJECT *obj,
> void *private)
> {
> - uint32_t i, connector_type;
> + uint32_t connector_type, capabilities;
>
> static const fwts_package_element elements[] = {
> { ACPI_TYPE_INTEGER, "Connectable" },
> { ACPI_TYPE_INTEGER, "Type" },
> - { ACPI_TYPE_INTEGER, "Reserved0" },
> + { ACPI_TYPE_INTEGER, "USB-C Port Capabilities" },
> { ACPI_TYPE_INTEGER, "Reserved1" },
> };
>
> @@ -2868,13 +2868,33 @@ static void method_test_UPC_return(
> return;
> }
>
> - for (i = 2; i < 4; i++) {
> - if (obj->Package.Elements[i].Integer.Value != 0) {
> - fwts_failed(fw, LOG_LEVEL_MEDIUM,
> - "Method_UPCBadReturnType",
> - "%s element %" PRIu32 " is not zero.", name, i);
> + capabilities = obj->Package.Elements[2].Integer.Value;
> + switch (connector_type) {
> + case 0x08:
> + case 0x09:
> + case 0x0a:
> + if (capabilities & 0xffffffc0) {
> + fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_UPCBadReturnType",
> + "%s %s set reserved bits (%d)",
> + name, elements[2].name, capabilities);
> + return;
> + }
> + break;
> + default:
> + if (capabilities != 0) {
> + fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_UPCBadReturnType",
> + "%s %s returned %d which is incompatible with connector type %d.",
> + name, elements[2].name, capabilities, connector_type);
> return;
> }
> + break;
> + }
> +
> + if (obj->Package.Elements[3].Integer.Value != 0) {
> + fwts_failed(fw, LOG_LEVEL_MEDIUM,
> + "Method_UPCBadReturnType",
> + "%s element 3 is not zero.", name);
> + return;
> }
>
> fwts_method_passed_sane(fw, name, "package");
More information about the fwts-devel
mailing list