Patchwork [5/6] acpi: method: handle ACPICA slack mode gracefully

login
register
mail settings
Submitter Colin King
Date July 9, 2013, 10:03 a.m.
Message ID <1373364197-14442-6-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/257689/
State Accepted
Headers show

Comments

Colin King - July 9, 2013, 10:03 a.m.
From: Colin Ian King <colin.king@canonical.com>

In ACPICA slack mode we should be less pedandtic about
forced integer returns on controls that normally return
nothing.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/method/method.c | 16 ++++++++++++++++
 src/acpica/fwts_acpica.c |  9 +++++++++
 2 files changed, 25 insertions(+)
Keng-Yu Lin - July 11, 2013, 9:54 a.m.
On Tue, Jul 9, 2013 at 6:03 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> In ACPICA slack mode we should be less pedandtic about
> forced integer returns on controls that normally return
> nothing.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/method/method.c | 16 ++++++++++++++++
>  src/acpica/fwts_acpica.c |  9 +++++++++
>  2 files changed, 25 insertions(+)
>
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index 6afa864..628ead6 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -665,6 +665,22 @@ static void method_test_NULL_return(
>  {
>         FWTS_UNUSED(private);
>
> +       /*
> +        *  In ACPICA SLACK mode null returns can be actually
> +        *  forced to return ACPI integers. Blame an errata
> +        *  and Windows compatability for this mess.
> +        */
> +       if (fw->acpica_mode & FWTS_ACPICA_MODE_SLACK) {
> +               if ((buf != NULL) && (buf->Pointer != NULL)) {
> +                       ACPI_OBJECT *obj = buf->Pointer;
> +                       if (obj->Type == ACPI_TYPE_INTEGER) {
> +                               fwts_passed(fw, "%s returned an ACPI_TYPE_INTEGER as expected in slack mode.",
> +                                       name);
> +                               return;
> +                       }
> +               }
> +       }
> +
>         if (buf->Length && buf->Pointer) {
>                 fwts_failed(fw, LOG_LEVEL_MEDIUM, "MethodShouldReturnNothing", "%s returned values, but was expected to return nothing.", name);
>                 fwts_tag_failed(fw, FWTS_TAG_ACPI_METHOD_RETURN);
> diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c
> index ac76e6e..ec85115 100644
> --- a/src/acpica/fwts_acpica.c
> +++ b/src/acpica/fwts_acpica.c
> @@ -209,6 +209,15 @@ static ACPI_STATUS fwts_exception_handler(
>                         "ACPICA Exception %s during execution at module level (table load)",
>                         exception);
>
> +       if (AcpiGbl_IgnoreErrors) {
> +               if (AmlStatus != AE_OK) {
> +                       fwts_log_info(fwts_acpica_fw,
> +                               "ACPICA Exception override, forcing AE_OK for execption %s",
> +                               exception);
> +                       AmlStatus = AE_OK;
> +               }
> +       }
> +
>         return AmlStatus;
>  }
>
> --
> 1.8.1.2
>

Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Alex Hung - July 12, 2013, 2:43 a.m.
On 07/09/2013 06:03 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> In ACPICA slack mode we should be less pedandtic about
> forced integer returns on controls that normally return
> nothing.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/method/method.c | 16 ++++++++++++++++
>   src/acpica/fwts_acpica.c |  9 +++++++++
>   2 files changed, 25 insertions(+)
>
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index 6afa864..628ead6 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -665,6 +665,22 @@ static void method_test_NULL_return(
>   {
>   	FWTS_UNUSED(private);
>
> +	/*
> +	 *  In ACPICA SLACK mode null returns can be actually
> +	 *  forced to return ACPI integers. Blame an errata
> +	 *  and Windows compatability for this mess.
> +	 */
> +	if (fw->acpica_mode & FWTS_ACPICA_MODE_SLACK) {
> +		if ((buf != NULL) && (buf->Pointer != NULL)) {
> +			ACPI_OBJECT *obj = buf->Pointer;
> +			if (obj->Type == ACPI_TYPE_INTEGER) {
> +				fwts_passed(fw, "%s returned an ACPI_TYPE_INTEGER as expected in slack mode.",
> +					name);
> +				return;
> +			}
> +		}
> +	}
> +
>   	if (buf->Length && buf->Pointer) {
>   		fwts_failed(fw, LOG_LEVEL_MEDIUM, "MethodShouldReturnNothing", "%s returned values, but was expected to return nothing.", name);
>   		fwts_tag_failed(fw, FWTS_TAG_ACPI_METHOD_RETURN);
> diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c
> index ac76e6e..ec85115 100644
> --- a/src/acpica/fwts_acpica.c
> +++ b/src/acpica/fwts_acpica.c
> @@ -209,6 +209,15 @@ static ACPI_STATUS fwts_exception_handler(
>   			"ACPICA Exception %s during execution at module level (table load)",
>   			exception);
>
> +	if (AcpiGbl_IgnoreErrors) {
> +		if (AmlStatus != AE_OK) {
> +			fwts_log_info(fwts_acpica_fw,
> +				"ACPICA Exception override, forcing AE_OK for execption %s",
> +				exception);
> +			AmlStatus = AE_OK;
> +		}
> +	}
> +
>   	return AmlStatus;
>   }
>
>
Acked-by: Alex Hung <alex.hung@canonical.com>

Patch

diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
index 6afa864..628ead6 100644
--- a/src/acpi/method/method.c
+++ b/src/acpi/method/method.c
@@ -665,6 +665,22 @@  static void method_test_NULL_return(
 {
 	FWTS_UNUSED(private);
 
+	/*
+	 *  In ACPICA SLACK mode null returns can be actually
+	 *  forced to return ACPI integers. Blame an errata
+	 *  and Windows compatability for this mess.
+	 */
+	if (fw->acpica_mode & FWTS_ACPICA_MODE_SLACK) {
+		if ((buf != NULL) && (buf->Pointer != NULL)) {
+			ACPI_OBJECT *obj = buf->Pointer;
+			if (obj->Type == ACPI_TYPE_INTEGER) {
+				fwts_passed(fw, "%s returned an ACPI_TYPE_INTEGER as expected in slack mode.",
+					name);
+				return;
+			}
+		}
+	}
+
 	if (buf->Length && buf->Pointer) {
 		fwts_failed(fw, LOG_LEVEL_MEDIUM, "MethodShouldReturnNothing", "%s returned values, but was expected to return nothing.", name);
 		fwts_tag_failed(fw, FWTS_TAG_ACPI_METHOD_RETURN);
diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c
index ac76e6e..ec85115 100644
--- a/src/acpica/fwts_acpica.c
+++ b/src/acpica/fwts_acpica.c
@@ -209,6 +209,15 @@  static ACPI_STATUS fwts_exception_handler(
 			"ACPICA Exception %s during execution at module level (table load)",
 			exception);
 
+	if (AcpiGbl_IgnoreErrors) {
+		if (AmlStatus != AE_OK) {
+			fwts_log_info(fwts_acpica_fw,
+				"ACPICA Exception override, forcing AE_OK for execption %s",
+				exception);
+			AmlStatus = AE_OK;
+		}
+	}
+
 	return AmlStatus;
 }