Message ID | 1519328633-19598-1-git-send-email-alex.hung@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | [V2] acpi: method: allow _WAK to return an integer | expand |
On 22/02/18 19:43, Alex Hung wrote: > Linux kernel allows _WAK to return an integer, as in acpica/acpredef.h. > The reason seems to be that so many system BIOS returns an integer > instead of a package defined in ACPI spec, and it becomes a strange > standard already. Since operating system allows the integer, it should > be appropriate for fwts to relax it as well. > > Signed-off-by: Alex Hung <alex.hung@canonical.com> > --- > src/acpi/method/method.c | 28 ++++++++++++++++++++-------- > 1 file changed, 20 insertions(+), 8 deletions(-) > > diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c > index 0df3526..48736af 100644 > --- a/src/acpi/method/method.c > +++ b/src/acpi/method/method.c > @@ -5554,17 +5554,29 @@ static void method_test_WAK_return( > void *private) > { > FWTS_UNUSED(private); > + FWTS_UNUSED(buf); > > - if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) != FWTS_OK) > - return; > - > - if (fwts_method_package_count_equal(fw, name, "_WAK", obj, 2) != FWTS_OK) > - return; > + switch (obj->Type) { > + case ACPI_TYPE_PACKAGE: > + if (fwts_method_package_count_equal(fw, name, "_WAK", obj, 2) != FWTS_OK) > + return; > > - if (fwts_method_package_elements_all_type(fw, name, "_WAK", obj, ACPI_TYPE_INTEGER) != FWTS_OK) > - return; > + if (fwts_method_package_elements_all_type(fw, name, "_WAK", obj, ACPI_TYPE_INTEGER) != FWTS_OK) > + return; > > - fwts_method_passed_sane(fw, name, "package"); > + fwts_method_passed_sane(fw, name, "package"); > + break; > + case ACPI_TYPE_INTEGER: > + fwts_warning(fw, "In ACPI spec, _WAK shall return a package " > + "containing two integers; however, Linux " > + "also accepts an integer for legacy reasons."); > + fwts_method_passed_sane(fw, name, "integer"); > + break; > + default: > + fwts_failed(fw, LOG_LEVEL_CRITICAL, "MethodReturnBadType", > + "%s did not return a package or an integer.", name); > + break; > + } > } > > static int method_test_WAK(fwts_framework *fw) > Thanks Alex, Acked-by: Colin Ian King <colin.king@canonical.com>
On 02/23/2018 03:43 AM, Alex Hung wrote: > Linux kernel allows _WAK to return an integer, as in acpica/acpredef.h. > The reason seems to be that so many system BIOS returns an integer > instead of a package defined in ACPI spec, and it becomes a strange > standard already. Since operating system allows the integer, it should > be appropriate for fwts to relax it as well. > > Signed-off-by: Alex Hung <alex.hung@canonical.com> > --- > src/acpi/method/method.c | 28 ++++++++++++++++++++-------- > 1 file changed, 20 insertions(+), 8 deletions(-) > > diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c > index 0df3526..48736af 100644 > --- a/src/acpi/method/method.c > +++ b/src/acpi/method/method.c > @@ -5554,17 +5554,29 @@ static void method_test_WAK_return( > void *private) > { > FWTS_UNUSED(private); > + FWTS_UNUSED(buf); > > - if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) != FWTS_OK) > - return; > - > - if (fwts_method_package_count_equal(fw, name, "_WAK", obj, 2) != FWTS_OK) > - return; > + switch (obj->Type) { > + case ACPI_TYPE_PACKAGE: > + if (fwts_method_package_count_equal(fw, name, "_WAK", obj, 2) != FWTS_OK) > + return; > > - if (fwts_method_package_elements_all_type(fw, name, "_WAK", obj, ACPI_TYPE_INTEGER) != FWTS_OK) > - return; > + if (fwts_method_package_elements_all_type(fw, name, "_WAK", obj, ACPI_TYPE_INTEGER) != FWTS_OK) > + return; > > - fwts_method_passed_sane(fw, name, "package"); > + fwts_method_passed_sane(fw, name, "package"); > + break; > + case ACPI_TYPE_INTEGER: > + fwts_warning(fw, "In ACPI spec, _WAK shall return a package " > + "containing two integers; however, Linux " > + "also accepts an integer for legacy reasons."); > + fwts_method_passed_sane(fw, name, "integer"); > + break; > + default: > + fwts_failed(fw, LOG_LEVEL_CRITICAL, "MethodReturnBadType", > + "%s did not return a package or an integer.", name); > + break; > + } > } > > static int method_test_WAK(fwts_framework *fw) Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index 0df3526..48736af 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -5554,17 +5554,29 @@ static void method_test_WAK_return( void *private) { FWTS_UNUSED(private); + FWTS_UNUSED(buf); - if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) != FWTS_OK) - return; - - if (fwts_method_package_count_equal(fw, name, "_WAK", obj, 2) != FWTS_OK) - return; + switch (obj->Type) { + case ACPI_TYPE_PACKAGE: + if (fwts_method_package_count_equal(fw, name, "_WAK", obj, 2) != FWTS_OK) + return; - if (fwts_method_package_elements_all_type(fw, name, "_WAK", obj, ACPI_TYPE_INTEGER) != FWTS_OK) - return; + if (fwts_method_package_elements_all_type(fw, name, "_WAK", obj, ACPI_TYPE_INTEGER) != FWTS_OK) + return; - fwts_method_passed_sane(fw, name, "package"); + fwts_method_passed_sane(fw, name, "package"); + break; + case ACPI_TYPE_INTEGER: + fwts_warning(fw, "In ACPI spec, _WAK shall return a package " + "containing two integers; however, Linux " + "also accepts an integer for legacy reasons."); + fwts_method_passed_sane(fw, name, "integer"); + break; + default: + fwts_failed(fw, LOG_LEVEL_CRITICAL, "MethodReturnBadType", + "%s did not return a package or an integer.", name); + break; + } } static int method_test_WAK(fwts_framework *fw)
Linux kernel allows _WAK to return an integer, as in acpica/acpredef.h. The reason seems to be that so many system BIOS returns an integer instead of a package defined in ACPI spec, and it becomes a strange standard already. Since operating system allows the integer, it should be appropriate for fwts to relax it as well. Signed-off-by: Alex Hung <alex.hung@canonical.com> --- src/acpi/method/method.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-)