Message ID | 20231230014559.1345-1-mario.limonciello@amd.com |
---|---|
State | Accepted |
Headers | show |
Series | [v2] Add support for ACPI 6.5 _UPC return values | expand |
Thanks! Acked-by: Ivan Hu <ivan.hu@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@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");
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");
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@amd.com> --- v1->v2: * Drop unnecessary for loop --- src/acpi/method/method.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-)