diff mbox

[v2] acpi: method: add _PCL control method test (LP:1343070)

Message ID 1405598103-6371-1-git-send-email-alex.hung@canonical.com
State Accepted
Headers show

Commit Message

Alex Hung July 17, 2014, 11:55 a.m. UTC
Signed-off-by: Alex Hung <alex.hung@canonical.com>
---
 src/acpi/method/method.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Comments

Colin Ian King July 17, 2014, 11:58 a.m. UTC | #1
On 17/07/14 12:55, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/method/method.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index 9b789cf..eaa047a 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -138,7 +138,7 @@
>   * _OSI  5.7.2		n/a
>   * _OST  6.3.5		n/a
>   * _PAI  10.4.4		n/a
> - * _PCL  10.3.2		N
> + * _PCL  10.3.2		Y
>   * _PCT  8.4.4.1	Y
>   * _PDC  8.4.1		N
>   * _PDL  8.4.4.6	Y
> @@ -3845,7 +3845,13 @@ static void method_test_PCL_return(fwts_framework *fw,
>  	FWTS_UNUSED(obj);
>  	FWTS_UNUSED(private);
>  
> -	/* FIXME */
> +	if (method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) != FWTS_OK)
> +		return;
> +
> +	if (method_package_elements_all_type(fw, name, "_PCL", obj, ACPI_TYPE_LOCAL_REFERENCE) != FWTS_OK)
> +		return;
> +
> +	fwts_passed(fw,	"%s returned a sane package of %" PRIu32 " references.", name, obj->Package.Count);
>  }
>  
>  static int method_test_PCL(fwts_framework *fw)
> @@ -5043,11 +5049,10 @@ static fwts_framework_minor_test method_tests[] = {
>  	{ method_test_BTP, "Test _BTP (Battery Trip Point)." },
>  	{ method_test_BTM, "Test _BTM (Battery Time)." },
>  	/* { method_test_BLT, "Test _BLT (Battery Level Threshold)." }, */
> -	{ method_test_PCL, "Test _PCL (Power Consumer List)." },
>  
>  	/* Section 10.3 AC Adapters and Power Source Objects */
>  
> -	/* { method_test_PCL, "Test _PCL (Power Consumer List)." }, */
> +	{ method_test_PCL, "Test _PCL (Power Consumer List)." },
>  	{ method_test_PIF, "Test _PIF (Power Source Information)." },
>  	/* { method_test_PRL, "Test _PRL (Power Source Redundancy List)." }, */
>  	{ method_test_PSR, "Test _PSR (Power Source)." },
> 
Acked-by: Colin Ian King <colin.king@canonical.com>
Keng-Yu Lin July 22, 2014, 8:46 a.m. UTC | #2
On Thu, Jul 17, 2014 at 7:55 PM, Alex Hung <alex.hung@canonical.com> wrote:
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/method/method.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index 9b789cf..eaa047a 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -138,7 +138,7 @@
>   * _OSI  5.7.2         n/a
>   * _OST  6.3.5         n/a
>   * _PAI  10.4.4                n/a
> - * _PCL  10.3.2                N
> + * _PCL  10.3.2                Y
>   * _PCT  8.4.4.1       Y
>   * _PDC  8.4.1         N
>   * _PDL  8.4.4.6       Y
> @@ -3845,7 +3845,13 @@ static void method_test_PCL_return(fwts_framework *fw,
>         FWTS_UNUSED(obj);
>         FWTS_UNUSED(private);
>
> -       /* FIXME */
> +       if (method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) != FWTS_OK)
> +               return;
> +
> +       if (method_package_elements_all_type(fw, name, "_PCL", obj, ACPI_TYPE_LOCAL_REFERENCE) != FWTS_OK)
> +               return;
> +
> +       fwts_passed(fw, "%s returned a sane package of %" PRIu32 " references.", name, obj->Package.Count);
>  }
>
>  static int method_test_PCL(fwts_framework *fw)
> @@ -5043,11 +5049,10 @@ static fwts_framework_minor_test method_tests[] = {
>         { method_test_BTP, "Test _BTP (Battery Trip Point)." },
>         { method_test_BTM, "Test _BTM (Battery Time)." },
>         /* { method_test_BLT, "Test _BLT (Battery Level Threshold)." }, */
> -       { method_test_PCL, "Test _PCL (Power Consumer List)." },
>
>         /* Section 10.3 AC Adapters and Power Source Objects */
>
> -       /* { method_test_PCL, "Test _PCL (Power Consumer List)." }, */
> +       { method_test_PCL, "Test _PCL (Power Consumer List)." },
>         { method_test_PIF, "Test _PIF (Power Source Information)." },
>         /* { method_test_PRL, "Test _PRL (Power Source Redundancy List)." }, */
>         { method_test_PSR, "Test _PSR (Power Source)." },
> --
> 1.9.1
>
>

Acked-by: Keng-Yu Lin <kengyu@canonical.com>
diff mbox

Patch

diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
index 9b789cf..eaa047a 100644
--- a/src/acpi/method/method.c
+++ b/src/acpi/method/method.c
@@ -138,7 +138,7 @@ 
  * _OSI  5.7.2		n/a
  * _OST  6.3.5		n/a
  * _PAI  10.4.4		n/a
- * _PCL  10.3.2		N
+ * _PCL  10.3.2		Y
  * _PCT  8.4.4.1	Y
  * _PDC  8.4.1		N
  * _PDL  8.4.4.6	Y
@@ -3845,7 +3845,13 @@  static void method_test_PCL_return(fwts_framework *fw,
 	FWTS_UNUSED(obj);
 	FWTS_UNUSED(private);
 
-	/* FIXME */
+	if (method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) != FWTS_OK)
+		return;
+
+	if (method_package_elements_all_type(fw, name, "_PCL", obj, ACPI_TYPE_LOCAL_REFERENCE) != FWTS_OK)
+		return;
+
+	fwts_passed(fw,	"%s returned a sane package of %" PRIu32 " references.", name, obj->Package.Count);
 }
 
 static int method_test_PCL(fwts_framework *fw)
@@ -5043,11 +5049,10 @@  static fwts_framework_minor_test method_tests[] = {
 	{ method_test_BTP, "Test _BTP (Battery Trip Point)." },
 	{ method_test_BTM, "Test _BTM (Battery Time)." },
 	/* { method_test_BLT, "Test _BLT (Battery Level Threshold)." }, */
-	{ method_test_PCL, "Test _PCL (Power Consumer List)." },
 
 	/* Section 10.3 AC Adapters and Power Source Objects */
 
-	/* { method_test_PCL, "Test _PCL (Power Consumer List)." }, */
+	{ method_test_PCL, "Test _PCL (Power Consumer List)." },
 	{ method_test_PIF, "Test _PIF (Power Source Information)." },
 	/* { method_test_PRL, "Test _PRL (Power Source Redundancy List)." }, */
 	{ method_test_PSR, "Test _PSR (Power Source)." },