diff mbox

[v3] acpi: method: add check for _GTF and _GTM

Message ID 1410399552-31242-1-git-send-email-alex.hung@canonical.com
State Rejected
Headers show

Commit Message

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

Comments

Colin Ian King Sept. 11, 2014, 8:02 a.m. UTC | #1
On 11/09/14 02:39, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/method/method.c | 65 +++++++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 61 insertions(+), 4 deletions(-)
> 
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index b2f83c8..bd107a1 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -109,8 +109,8 @@
>   * _GPE  5.3.1, 12.11	N
>   * _GRT  9.18.3		Y
>   * _GSB  6.2.6		Y
> - * _GTF  9.8.1.1	N
> - * _GTM  9.8.2.1.1	N
> + * _GTF  9.8.1.1	Y
> + * _GTM  9.8.2.1.1	Y
>   * _GTS  7.3.3		deprecated
>   * _GWS  9.18.5		Y
>   * _HID  6.1.5		Y
> @@ -3398,6 +3398,63 @@ static int method_test_LID(fwts_framework *fw)
>  		"_LID", NULL, 0, method_test_LID_return, NULL);
>  }
>  
> +
> +/*
> + * Section 9.8 ATA Controllers
> + */
> +
> +static void method_test_GTF_return(
> +	fwts_framework *fw,
> +	char *name,
> +	ACPI_BUFFER *buf,
> +	ACPI_OBJECT *obj,
> +	void *private)
> +{
> +	FWTS_UNUSED(private);
> +
> +	if (method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
> +		return;
> +
> +	if (obj->Buffer.Length % 7)
> +		fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_GTFBadBufferSize",
> +			"%s should return a buffer with size of multiple of 7.",
> +			name);
> +	else
> +		method_passed_sane(fw, name, "buffer");
> +}
> +
> +static int method_test_GTF(fwts_framework *fw)
> +{
> +	return method_evaluate_method(fw, METHOD_OPTIONAL,
> +		"_GTF", NULL, 0, method_test_GTF_return, NULL);
> +}
> +
> +static void method_test_GTM_return(
> +	fwts_framework *fw,
> +	char *name,
> +	ACPI_BUFFER *buf,
> +	ACPI_OBJECT *obj,
> +	void *private)
> +{
> +	FWTS_UNUSED(private);
> +
> +	if (method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
> +		return;
> +
> +	if (obj->Buffer.Length % (5 * sizeof(uint32_t)))
> +		fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_GTMBadBufferSize",
> +			"%s should return a buffer with size of multiple of 40.",
> +			name);
> +	else
> +		method_passed_sane(fw, name, "buffer");
> +}
> +
> +static int method_test_GTM(fwts_framework *fw)
> +{
> +	return method_evaluate_method(fw, METHOD_OPTIONAL,
> +		"_GTM", NULL, 0, method_test_GTM_return, NULL);
> +}
> +
>  /*
>   * Section 9.16 User Presence Detection Device
>   */
> @@ -5180,8 +5237,8 @@ static fwts_framework_minor_test method_tests[] = {
>  	{ method_test_LID, "Test _LID (Lid Status)." },
>  
>  	/* Section 9.8 ATA Controllers */
> -	/* { method_test_GTF, "Test _GTF (Get Task File)." }, */
> -	/* { method_test_GTM, "Test _GTM (Get Timing Mode)." }, */
> +	{ method_test_GTF, "Test _GTF (Get Task File)." },
> +	{ method_test_GTM, "Test _GTM (Get Timing Mode)." },
>  	/* { method_test_SDD, "Test _SDD (Set Device Data)." }, */
>  	/* { method_test_STM, "Test _STM (Set Timing Mode)." }, */
>  
> 
Thanks Alex,

Acked-by: Colin Ian King <colin.king@canonical.com>
Ivan Hu Sept. 11, 2014, 8:41 a.m. UTC | #2
On 09/11/2014 09:39 AM, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>   src/acpi/method/method.c | 65 +++++++++++++++++++++++++++++++++++++++++++++---
>   1 file changed, 61 insertions(+), 4 deletions(-)
>
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index b2f83c8..bd107a1 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -109,8 +109,8 @@
>    * _GPE  5.3.1, 12.11	N
>    * _GRT  9.18.3		Y
>    * _GSB  6.2.6		Y
> - * _GTF  9.8.1.1	N
> - * _GTM  9.8.2.1.1	N
> + * _GTF  9.8.1.1	Y
> + * _GTM  9.8.2.1.1	Y
>    * _GTS  7.3.3		deprecated
>    * _GWS  9.18.5		Y
>    * _HID  6.1.5		Y
> @@ -3398,6 +3398,63 @@ static int method_test_LID(fwts_framework *fw)
>   		"_LID", NULL, 0, method_test_LID_return, NULL);
>   }
>
> +
> +/*
> + * Section 9.8 ATA Controllers
> + */
> +
> +static void method_test_GTF_return(
> +	fwts_framework *fw,
> +	char *name,
> +	ACPI_BUFFER *buf,
> +	ACPI_OBJECT *obj,
> +	void *private)
> +{
> +	FWTS_UNUSED(private);
> +
> +	if (method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
> +		return;
> +
> +	if (obj->Buffer.Length % 7)
> +		fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_GTFBadBufferSize",
> +			"%s should return a buffer with size of multiple of 7.",
> +			name);
> +	else
> +		method_passed_sane(fw, name, "buffer");
> +}
> +
> +static int method_test_GTF(fwts_framework *fw)
> +{
> +	return method_evaluate_method(fw, METHOD_OPTIONAL,
> +		"_GTF", NULL, 0, method_test_GTF_return, NULL);
> +}
> +
> +static void method_test_GTM_return(
> +	fwts_framework *fw,
> +	char *name,
> +	ACPI_BUFFER *buf,
> +	ACPI_OBJECT *obj,
> +	void *private)
> +{
> +	FWTS_UNUSED(private);
> +
> +	if (method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
> +		return;
> +
> +	if (obj->Buffer.Length % (5 * sizeof(uint32_t)))
> +		fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_GTMBadBufferSize",
> +			"%s should return a buffer with size of multiple of 40.",
checking the Acpi spec the buffer size should be 20 bytes(5 Dwords), 
should not a multiple of 40. Am I mis-understanding the spec 9.8.2.1?


> +			name);
> +	else
> +		method_passed_sane(fw, name, "buffer");
> +}
> +
> +static int method_test_GTM(fwts_framework *fw)
> +{
> +	return method_evaluate_method(fw, METHOD_OPTIONAL,
> +		"_GTM", NULL, 0, method_test_GTM_return, NULL);
> +}
> +
>   /*
>    * Section 9.16 User Presence Detection Device
>    */
> @@ -5180,8 +5237,8 @@ static fwts_framework_minor_test method_tests[] = {
>   	{ method_test_LID, "Test _LID (Lid Status)." },
>
>   	/* Section 9.8 ATA Controllers */
> -	/* { method_test_GTF, "Test _GTF (Get Task File)." }, */
> -	/* { method_test_GTM, "Test _GTM (Get Timing Mode)." }, */
> +	{ method_test_GTF, "Test _GTF (Get Task File)." },
> +	{ method_test_GTM, "Test _GTM (Get Timing Mode)." },
>   	/* { method_test_SDD, "Test _SDD (Set Device Data)." }, */
>   	/* { method_test_STM, "Test _STM (Set Timing Mode)." }, */
>
>
Colin Ian King Sept. 11, 2014, 8:51 a.m. UTC | #3
On 11/09/14 09:41, IvanHu wrote:
> On 09/11/2014 09:39 AM, Alex Hung wrote:
>> Signed-off-by: Alex Hung <alex.hung@canonical.com>
>> ---
>>   src/acpi/method/method.c | 65
>> +++++++++++++++++++++++++++++++++++++++++++++---
>>   1 file changed, 61 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
>> index b2f83c8..bd107a1 100644
>> --- a/src/acpi/method/method.c
>> +++ b/src/acpi/method/method.c
>> @@ -109,8 +109,8 @@
>>    * _GPE  5.3.1, 12.11    N
>>    * _GRT  9.18.3        Y
>>    * _GSB  6.2.6        Y
>> - * _GTF  9.8.1.1    N
>> - * _GTM  9.8.2.1.1    N
>> + * _GTF  9.8.1.1    Y
>> + * _GTM  9.8.2.1.1    Y
>>    * _GTS  7.3.3        deprecated
>>    * _GWS  9.18.5        Y
>>    * _HID  6.1.5        Y
>> @@ -3398,6 +3398,63 @@ static int method_test_LID(fwts_framework *fw)
>>           "_LID", NULL, 0, method_test_LID_return, NULL);
>>   }
>>
>> +
>> +/*
>> + * Section 9.8 ATA Controllers
>> + */
>> +
>> +static void method_test_GTF_return(
>> +    fwts_framework *fw,
>> +    char *name,
>> +    ACPI_BUFFER *buf,
>> +    ACPI_OBJECT *obj,
>> +    void *private)
>> +{
>> +    FWTS_UNUSED(private);
>> +
>> +    if (method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
>> +        return;
>> +
>> +    if (obj->Buffer.Length % 7)
>> +        fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_GTFBadBufferSize",
>> +            "%s should return a buffer with size of multiple of 7.",
>> +            name);
>> +    else
>> +        method_passed_sane(fw, name, "buffer");
>> +}
>> +
>> +static int method_test_GTF(fwts_framework *fw)
>> +{
>> +    return method_evaluate_method(fw, METHOD_OPTIONAL,
>> +        "_GTF", NULL, 0, method_test_GTF_return, NULL);
>> +}
>> +
>> +static void method_test_GTM_return(
>> +    fwts_framework *fw,
>> +    char *name,
>> +    ACPI_BUFFER *buf,
>> +    ACPI_OBJECT *obj,
>> +    void *private)
>> +{
>> +    FWTS_UNUSED(private);
>> +
>> +    if (method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
>> +        return;
>> +
>> +    if (obj->Buffer.Length % (5 * sizeof(uint32_t)))
>> +        fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_GTMBadBufferSize",
>> +            "%s should return a buffer with size of multiple of 40.",
> checking the Acpi spec the buffer size should be 20 bytes(5 Dwords),
> should not a multiple of 40. Am I mis-understanding the spec 9.8.2.1?

word = 2 bytes, dword = 4 bytes, 5 x 4 = 20. I got the 40 wrong in my
original reply to Alex's first patch.

> 
> 
>> +            name);
>> +    else
>> +        method_passed_sane(fw, name, "buffer");
>> +}
>> +
>> +static int method_test_GTM(fwts_framework *fw)
>> +{
>> +    return method_evaluate_method(fw, METHOD_OPTIONAL,
>> +        "_GTM", NULL, 0, method_test_GTM_return, NULL);
>> +}
>> +
>>   /*
>>    * Section 9.16 User Presence Detection Device
>>    */
>> @@ -5180,8 +5237,8 @@ static fwts_framework_minor_test method_tests[] = {
>>       { method_test_LID, "Test _LID (Lid Status)." },
>>
>>       /* Section 9.8 ATA Controllers */
>> -    /* { method_test_GTF, "Test _GTF (Get Task File)." }, */
>> -    /* { method_test_GTM, "Test _GTM (Get Timing Mode)." }, */
>> +    { method_test_GTF, "Test _GTF (Get Task File)." },
>> +    { method_test_GTM, "Test _GTM (Get Timing Mode)." },
>>       /* { method_test_SDD, "Test _SDD (Set Device Data)." }, */
>>       /* { method_test_STM, "Test _STM (Set Timing Mode)." }, */
>>
>>
> 
>
Alex Hung Sept. 11, 2014, 8:56 a.m. UTC | #4
On 09/11/2014 04:51 PM, Colin Ian King wrote:
> On 11/09/14 09:41, IvanHu wrote:
>> On 09/11/2014 09:39 AM, Alex Hung wrote:
>>> Signed-off-by: Alex Hung <alex.hung@canonical.com>
>>> ---
>>>   src/acpi/method/method.c | 65
>>> +++++++++++++++++++++++++++++++++++++++++++++---
>>>   1 file changed, 61 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
>>> index b2f83c8..bd107a1 100644
>>> --- a/src/acpi/method/method.c
>>> +++ b/src/acpi/method/method.c
>>> @@ -109,8 +109,8 @@
>>>    * _GPE  5.3.1, 12.11    N
>>>    * _GRT  9.18.3        Y
>>>    * _GSB  6.2.6        Y
>>> - * _GTF  9.8.1.1    N
>>> - * _GTM  9.8.2.1.1    N
>>> + * _GTF  9.8.1.1    Y
>>> + * _GTM  9.8.2.1.1    Y
>>>    * _GTS  7.3.3        deprecated
>>>    * _GWS  9.18.5        Y
>>>    * _HID  6.1.5        Y
>>> @@ -3398,6 +3398,63 @@ static int method_test_LID(fwts_framework *fw)
>>>           "_LID", NULL, 0, method_test_LID_return, NULL);
>>>   }
>>>
>>> +
>>> +/*
>>> + * Section 9.8 ATA Controllers
>>> + */
>>> +
>>> +static void method_test_GTF_return(
>>> +    fwts_framework *fw,
>>> +    char *name,
>>> +    ACPI_BUFFER *buf,
>>> +    ACPI_OBJECT *obj,
>>> +    void *private)
>>> +{
>>> +    FWTS_UNUSED(private);
>>> +
>>> +    if (method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
>>> +        return;
>>> +
>>> +    if (obj->Buffer.Length % 7)
>>> +        fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_GTFBadBufferSize",
>>> +            "%s should return a buffer with size of multiple of 7.",
>>> +            name);
>>> +    else
>>> +        method_passed_sane(fw, name, "buffer");
>>> +}
>>> +
>>> +static int method_test_GTF(fwts_framework *fw)
>>> +{
>>> +    return method_evaluate_method(fw, METHOD_OPTIONAL,
>>> +        "_GTF", NULL, 0, method_test_GTF_return, NULL);
>>> +}
>>> +
>>> +static void method_test_GTM_return(
>>> +    fwts_framework *fw,
>>> +    char *name,
>>> +    ACPI_BUFFER *buf,
>>> +    ACPI_OBJECT *obj,
>>> +    void *private)
>>> +{
>>> +    FWTS_UNUSED(private);
>>> +
>>> +    if (method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
>>> +        return;
>>> +
>>> +    if (obj->Buffer.Length % (5 * sizeof(uint32_t)))
>>> +        fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_GTMBadBufferSize",
>>> +            "%s should return a buffer with size of multiple of 40.",
>> checking the Acpi spec the buffer size should be 20 bytes(5 Dwords),
>> should not a multiple of 40. Am I mis-understanding the spec 9.8.2.1?
> 
> word = 2 bytes, dword = 4 bytes, 5 x 4 = 20. I got the 40 wrong in my
> original reply to Alex's first patch.
The condition for if-statement is correct but the error message is
wrong. I will send v4.
> 
>>
>>
>>> +            name);
>>> +    else
>>> +        method_passed_sane(fw, name, "buffer");
>>> +}
>>> +
>>> +static int method_test_GTM(fwts_framework *fw)
>>> +{
>>> +    return method_evaluate_method(fw, METHOD_OPTIONAL,
>>> +        "_GTM", NULL, 0, method_test_GTM_return, NULL);
>>> +}
>>> +
>>>   /*
>>>    * Section 9.16 User Presence Detection Device
>>>    */
>>> @@ -5180,8 +5237,8 @@ static fwts_framework_minor_test method_tests[] = {
>>>       { method_test_LID, "Test _LID (Lid Status)." },
>>>
>>>       /* Section 9.8 ATA Controllers */
>>> -    /* { method_test_GTF, "Test _GTF (Get Task File)." }, */
>>> -    /* { method_test_GTM, "Test _GTM (Get Timing Mode)." }, */
>>> +    { method_test_GTF, "Test _GTF (Get Task File)." },
>>> +    { method_test_GTM, "Test _GTM (Get Timing Mode)." },
>>>       /* { method_test_SDD, "Test _SDD (Set Device Data)." }, */
>>>       /* { method_test_STM, "Test _STM (Set Timing Mode)." }, */
>>>
>>>
>>
>>
> 
>
diff mbox

Patch

diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
index b2f83c8..bd107a1 100644
--- a/src/acpi/method/method.c
+++ b/src/acpi/method/method.c
@@ -109,8 +109,8 @@ 
  * _GPE  5.3.1, 12.11	N
  * _GRT  9.18.3		Y
  * _GSB  6.2.6		Y
- * _GTF  9.8.1.1	N
- * _GTM  9.8.2.1.1	N
+ * _GTF  9.8.1.1	Y
+ * _GTM  9.8.2.1.1	Y
  * _GTS  7.3.3		deprecated
  * _GWS  9.18.5		Y
  * _HID  6.1.5		Y
@@ -3398,6 +3398,63 @@  static int method_test_LID(fwts_framework *fw)
 		"_LID", NULL, 0, method_test_LID_return, NULL);
 }
 
+
+/*
+ * Section 9.8 ATA Controllers
+ */
+
+static void method_test_GTF_return(
+	fwts_framework *fw,
+	char *name,
+	ACPI_BUFFER *buf,
+	ACPI_OBJECT *obj,
+	void *private)
+{
+	FWTS_UNUSED(private);
+
+	if (method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
+		return;
+
+	if (obj->Buffer.Length % 7)
+		fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_GTFBadBufferSize",
+			"%s should return a buffer with size of multiple of 7.",
+			name);
+	else
+		method_passed_sane(fw, name, "buffer");
+}
+
+static int method_test_GTF(fwts_framework *fw)
+{
+	return method_evaluate_method(fw, METHOD_OPTIONAL,
+		"_GTF", NULL, 0, method_test_GTF_return, NULL);
+}
+
+static void method_test_GTM_return(
+	fwts_framework *fw,
+	char *name,
+	ACPI_BUFFER *buf,
+	ACPI_OBJECT *obj,
+	void *private)
+{
+	FWTS_UNUSED(private);
+
+	if (method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
+		return;
+
+	if (obj->Buffer.Length % (5 * sizeof(uint32_t)))
+		fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_GTMBadBufferSize",
+			"%s should return a buffer with size of multiple of 40.",
+			name);
+	else
+		method_passed_sane(fw, name, "buffer");
+}
+
+static int method_test_GTM(fwts_framework *fw)
+{
+	return method_evaluate_method(fw, METHOD_OPTIONAL,
+		"_GTM", NULL, 0, method_test_GTM_return, NULL);
+}
+
 /*
  * Section 9.16 User Presence Detection Device
  */
@@ -5180,8 +5237,8 @@  static fwts_framework_minor_test method_tests[] = {
 	{ method_test_LID, "Test _LID (Lid Status)." },
 
 	/* Section 9.8 ATA Controllers */
-	/* { method_test_GTF, "Test _GTF (Get Task File)." }, */
-	/* { method_test_GTM, "Test _GTM (Get Timing Mode)." }, */
+	{ method_test_GTF, "Test _GTF (Get Task File)." },
+	{ method_test_GTM, "Test _GTM (Get Timing Mode)." },
 	/* { method_test_SDD, "Test _SDD (Set Device Data)." }, */
 	/* { method_test_STM, "Test _STM (Set Timing Mode)." }, */