[2/2] Add ACPI 1.0 RSDP test to make sure RSDT field isn't null

Message ID 1510634864-678-2-git-send-email-alex.hung@canonical.com
State Accepted
Headers show
Series
  • [1/2] Remove length test for ACPI 1.0 RSDPs, fix checks against revision field
Related show

Commit Message

Alex Hung Nov. 14, 2017, 4:47 a.m.
From: Chris Goldsworthy <goldswo@amazon.com>

Given that a RSDP follows ACPI 1.0, perform a test to ensure that
the RSDT address field is not null.  The addition of this test
ensures that there are tests for each RSDP field for any ACPI
specification.

Signed-off-by: Christopher Goldsworthy <goldswo@amazon.de>
---
 src/acpi/rsdp/rsdp.c |  21 +++++--
 test.patch           | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 17 insertions(+), 4 deletions(-)

Comments

ivanhu Nov. 15, 2017, 9:44 a.m. | #1
On 11/14/2017 12:47 PM, Alex Hung wrote:
> From: Chris Goldsworthy <goldswo@amazon.com>
> 
> Given that a RSDP follows ACPI 1.0, perform a test to ensure that
> the RSDT address field is not null.  The addition of this test
> ensures that there are tests for each RSDP field for any ACPI
> specification.
> 
> Signed-off-by: Christopher Goldsworthy <goldswo@amazon.de>
> ---
>   src/acpi/rsdp/rsdp.c |  21 +++++--
>   test.patch           | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/src/acpi/rsdp/rsdp.c b/src/acpi/rsdp/rsdp.c
> index 2f537be..0fcb430 100644
> --- a/src/acpi/rsdp/rsdp.c
> +++ b/src/acpi/rsdp/rsdp.c
> @@ -115,11 +115,24 @@ static int rsdp_test1(fwts_framework *fw)
>   			"RSDP: revision is %" PRIu8 ", expected "
>   			"value to be 0 or 2.", rsdp->revision);
>   
> -	/* all proceeding tests involve fields which are only
> -	 * defined in ACPI specifications 2.0 and greater, skip
> -	 * if ACPI version is 1.0 */
> -	if (rsdp->revision == 0)
> +	/* check if RSDP follows ACPI 1.0 - if so, make sure rsdt_address
> +	 * is not null. */
> +	if (rsdp->revision == 0) {
> +		if (rsdp->rsdt_address != 0)
> +			fwts_passed(fw,
> +					"RSDP: RSDP follows ACPI 1.0 "
> +					"and RsdtAddress is set.");
> +		else
> +			fwts_failed(fw, LOG_LEVEL_MEDIUM,
> +					"RSDPNullRSDTPointer",
> +					"RSDP: RSDP follows ACPI 1.0, but "
> +					"RsdtAddress isn't set.");
> +
> +		/* all proceeding tests involve fields which are only
> +		 * defined in ACPI specifications 2.0 and greater, skip
> +		 * if ACPI version is 1.0 */
>   		return FWTS_OK;
> +	}
>   
>   	/* whether RSDT or XSDT depends arch */
>   	if (rsdp->rsdt_address == 0 && rsdp->xsdt_address == 0)
> 

Acked-by: Ivan Hu <ivan.hu@canonical.com>
Colin King Nov. 16, 2017, 12:02 p.m. | #2
On 14/11/17 04:47, Alex Hung wrote:
> From: Chris Goldsworthy <goldswo@amazon.com>
> 
> Given that a RSDP follows ACPI 1.0, perform a test to ensure that
> the RSDT address field is not null.  The addition of this test
> ensures that there are tests for each RSDP field for any ACPI
> specification.
> 
> Signed-off-by: Christopher Goldsworthy <goldswo@amazon.de>
> ---
>  src/acpi/rsdp/rsdp.c |  21 +++++--
>  test.patch           | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/src/acpi/rsdp/rsdp.c b/src/acpi/rsdp/rsdp.c
> index 2f537be..0fcb430 100644
> --- a/src/acpi/rsdp/rsdp.c
> +++ b/src/acpi/rsdp/rsdp.c
> @@ -115,11 +115,24 @@ static int rsdp_test1(fwts_framework *fw)
>  			"RSDP: revision is %" PRIu8 ", expected "
>  			"value to be 0 or 2.", rsdp->revision);
>  
> -	/* all proceeding tests involve fields which are only
> -	 * defined in ACPI specifications 2.0 and greater, skip
> -	 * if ACPI version is 1.0 */
> -	if (rsdp->revision == 0)
> +	/* check if RSDP follows ACPI 1.0 - if so, make sure rsdt_address
> +	 * is not null. */
> +	if (rsdp->revision == 0) {
> +		if (rsdp->rsdt_address != 0)
> +			fwts_passed(fw,
> +					"RSDP: RSDP follows ACPI 1.0 "
> +					"and RsdtAddress is set.");
> +		else
> +			fwts_failed(fw, LOG_LEVEL_MEDIUM,
> +					"RSDPNullRSDTPointer",
> +					"RSDP: RSDP follows ACPI 1.0, but "
> +					"RsdtAddress isn't set.");
> +
> +		/* all proceeding tests involve fields which are only
> +		 * defined in ACPI specifications 2.0 and greater, skip
> +		 * if ACPI version is 1.0 */
>  		return FWTS_OK;
> +	}
>  
>  	/* whether RSDT or XSDT depends arch */
>  	if (rsdp->rsdt_address == 0 && rsdp->xsdt_address == 0)
> 
Acked-by: Colin Ian King <colin.king@canonical.com>

Patch

diff --git a/src/acpi/rsdp/rsdp.c b/src/acpi/rsdp/rsdp.c
index 2f537be..0fcb430 100644
--- a/src/acpi/rsdp/rsdp.c
+++ b/src/acpi/rsdp/rsdp.c
@@ -115,11 +115,24 @@  static int rsdp_test1(fwts_framework *fw)
 			"RSDP: revision is %" PRIu8 ", expected "
 			"value to be 0 or 2.", rsdp->revision);
 
-	/* all proceeding tests involve fields which are only
-	 * defined in ACPI specifications 2.0 and greater, skip
-	 * if ACPI version is 1.0 */
-	if (rsdp->revision == 0)
+	/* check if RSDP follows ACPI 1.0 - if so, make sure rsdt_address
+	 * is not null. */
+	if (rsdp->revision == 0) {
+		if (rsdp->rsdt_address != 0)
+			fwts_passed(fw,
+					"RSDP: RSDP follows ACPI 1.0 "
+					"and RsdtAddress is set.");
+		else
+			fwts_failed(fw, LOG_LEVEL_MEDIUM,
+					"RSDPNullRSDTPointer",
+					"RSDP: RSDP follows ACPI 1.0, but "
+					"RsdtAddress isn't set.");
+
+		/* all proceeding tests involve fields which are only
+		 * defined in ACPI specifications 2.0 and greater, skip
+		 * if ACPI version is 1.0 */
 		return FWTS_OK;
+	}
 
 	/* whether RSDT or XSDT depends arch */
 	if (rsdp->rsdt_address == 0 && rsdp->xsdt_address == 0)