[V2] acpi/pptt: check flags by revision (mantis 1870 for ACPI 6.2b)

Message ID 20190212015104.18842-1-alex.hung@canonical.com
State Accepted
Headers show
Series
  • [V2] acpi/pptt: check flags by revision (mantis 1870 for ACPI 6.2b)
Related show

Commit Message

Alex Hung Feb. 12, 2019, 1:51 a.m.
Signed-off-by: Alex Hung <alex.hung@canonical.com>
---
 src/acpi/pptt/pptt.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

Comments

Colin Ian King Feb. 12, 2019, 9:05 a.m. | #1
On 12/02/2019 01:51, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/pptt/pptt.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/src/acpi/pptt/pptt.c b/src/acpi/pptt/pptt.c
> index ef1c50e8..2a399522 100644
> --- a/src/acpi/pptt/pptt.c
> +++ b/src/acpi/pptt/pptt.c
> @@ -39,7 +39,7 @@ static int pptt_init(fwts_framework *fw)
>  	return FWTS_OK;
>  }
>  
> -static void pptt_processor_test(fwts_framework *fw, const fwts_acpi_table_pptt_processor *entry, bool *passed)
> +static void pptt_processor_test(fwts_framework *fw, const fwts_acpi_table_pptt_processor *entry, uint8_t rev, bool *passed)
>  {
>  	fwts_log_info_verbatim(fw, "  Processor hierarchy node structure (Type 0):");
>  	fwts_log_info_verbatim(fw, "    Type:                           0x%2.2" PRIx8, entry->header.type);
> @@ -65,7 +65,12 @@ static void pptt_processor_test(fwts_framework *fw, const fwts_acpi_table_pptt_p
>  	}
>  
>  	fwts_acpi_reserved_zero_check(fw, "PPTT", "Reserved", entry->reserved, sizeof(entry->reserved), passed);
> -	fwts_acpi_reserved_bits_check(fw, "PPTT", "Flags", entry->flags, sizeof(entry->flags), 2, 31, passed);
> +
> +	if (rev == 1)
> +		fwts_acpi_reserved_bits_check(fw, "PPTT", "Flags", entry->flags, sizeof(entry->flags), 2, 31, passed);
> +	else if (rev == 2)
> +		fwts_acpi_reserved_bits_check(fw, "PPTT", "Flags", entry->flags, sizeof(entry->flags), 5, 31, passed);
> +
>  }
>  
>  static void pptt_cache_test(fwts_framework *fw, const fwts_acpi_table_pptt_cache *entry, bool *passed)
> @@ -112,10 +117,12 @@ static void pptt_id_test(fwts_framework *fw, const fwts_acpi_table_pptt_id *entr
>  static int pptt_test1(fwts_framework *fw)
>  {
>  	fwts_acpi_table_pptt_header *entry;
> -	uint32_t offset;
> +	fwts_acpi_table_pptt *pptt;
>  	bool passed = true;
> +	uint32_t offset;
>  
>  	fwts_log_info_verbatim(fw, "PPTT Processor Properties Topology Table:");
> +	pptt = (fwts_acpi_table_pptt *) table->data;
>  
>  	entry = (fwts_acpi_table_pptt_header *) (table->data + sizeof(fwts_acpi_table_pptt));
>  	offset = sizeof(fwts_acpi_table_pptt);
> @@ -131,7 +138,7 @@ static int pptt_test1(fwts_framework *fw)
>  		}
>  
>  		if (entry->type == FWTS_ACPI_PPTT_PROCESSOR) {
> -			pptt_processor_test(fw, (fwts_acpi_table_pptt_processor *) entry, &passed);
> +			pptt_processor_test(fw, (fwts_acpi_table_pptt_processor *) entry, pptt->header.revision, &passed);
>  			type_length = sizeof(fwts_acpi_table_pptt_processor) +
>  				      ((fwts_acpi_table_pptt_processor *) entry)->number_priv_resources * 4;
>  		} else if (entry->type == FWTS_ACPI_PPTT_CACHE) {
> 

Acked-by: Colin Ian King <colin.king@canonical.com>
ivanhu Feb. 18, 2019, 10:24 a.m. | #2
On 2/12/19 9:51 AM, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/pptt/pptt.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/src/acpi/pptt/pptt.c b/src/acpi/pptt/pptt.c
> index ef1c50e8..2a399522 100644
> --- a/src/acpi/pptt/pptt.c
> +++ b/src/acpi/pptt/pptt.c
> @@ -39,7 +39,7 @@ static int pptt_init(fwts_framework *fw)
>  	return FWTS_OK;
>  }
>  
> -static void pptt_processor_test(fwts_framework *fw, const fwts_acpi_table_pptt_processor *entry, bool *passed)
> +static void pptt_processor_test(fwts_framework *fw, const fwts_acpi_table_pptt_processor *entry, uint8_t rev, bool *passed)
>  {
>  	fwts_log_info_verbatim(fw, "  Processor hierarchy node structure (Type 0):");
>  	fwts_log_info_verbatim(fw, "    Type:                           0x%2.2" PRIx8, entry->header.type);
> @@ -65,7 +65,12 @@ static void pptt_processor_test(fwts_framework *fw, const fwts_acpi_table_pptt_p
>  	}
>  
>  	fwts_acpi_reserved_zero_check(fw, "PPTT", "Reserved", entry->reserved, sizeof(entry->reserved), passed);
> -	fwts_acpi_reserved_bits_check(fw, "PPTT", "Flags", entry->flags, sizeof(entry->flags), 2, 31, passed);
> +
> +	if (rev == 1)
> +		fwts_acpi_reserved_bits_check(fw, "PPTT", "Flags", entry->flags, sizeof(entry->flags), 2, 31, passed);
> +	else if (rev == 2)
> +		fwts_acpi_reserved_bits_check(fw, "PPTT", "Flags", entry->flags, sizeof(entry->flags), 5, 31, passed);
> +
>  }
>  
>  static void pptt_cache_test(fwts_framework *fw, const fwts_acpi_table_pptt_cache *entry, bool *passed)
> @@ -112,10 +117,12 @@ static void pptt_id_test(fwts_framework *fw, const fwts_acpi_table_pptt_id *entr
>  static int pptt_test1(fwts_framework *fw)
>  {
>  	fwts_acpi_table_pptt_header *entry;
> -	uint32_t offset;
> +	fwts_acpi_table_pptt *pptt;
>  	bool passed = true;
> +	uint32_t offset;
>  
>  	fwts_log_info_verbatim(fw, "PPTT Processor Properties Topology Table:");
> +	pptt = (fwts_acpi_table_pptt *) table->data;
>  
>  	entry = (fwts_acpi_table_pptt_header *) (table->data + sizeof(fwts_acpi_table_pptt));
>  	offset = sizeof(fwts_acpi_table_pptt);
> @@ -131,7 +138,7 @@ static int pptt_test1(fwts_framework *fw)
>  		}
>  
>  		if (entry->type == FWTS_ACPI_PPTT_PROCESSOR) {
> -			pptt_processor_test(fw, (fwts_acpi_table_pptt_processor *) entry, &passed);
> +			pptt_processor_test(fw, (fwts_acpi_table_pptt_processor *) entry, pptt->header.revision, &passed);
>  			type_length = sizeof(fwts_acpi_table_pptt_processor) +
>  				      ((fwts_acpi_table_pptt_processor *) entry)->number_priv_resources * 4;
>  		} else if (entry->type == FWTS_ACPI_PPTT_CACHE) {


Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch

diff --git a/src/acpi/pptt/pptt.c b/src/acpi/pptt/pptt.c
index ef1c50e8..2a399522 100644
--- a/src/acpi/pptt/pptt.c
+++ b/src/acpi/pptt/pptt.c
@@ -39,7 +39,7 @@  static int pptt_init(fwts_framework *fw)
 	return FWTS_OK;
 }
 
-static void pptt_processor_test(fwts_framework *fw, const fwts_acpi_table_pptt_processor *entry, bool *passed)
+static void pptt_processor_test(fwts_framework *fw, const fwts_acpi_table_pptt_processor *entry, uint8_t rev, bool *passed)
 {
 	fwts_log_info_verbatim(fw, "  Processor hierarchy node structure (Type 0):");
 	fwts_log_info_verbatim(fw, "    Type:                           0x%2.2" PRIx8, entry->header.type);
@@ -65,7 +65,12 @@  static void pptt_processor_test(fwts_framework *fw, const fwts_acpi_table_pptt_p
 	}
 
 	fwts_acpi_reserved_zero_check(fw, "PPTT", "Reserved", entry->reserved, sizeof(entry->reserved), passed);
-	fwts_acpi_reserved_bits_check(fw, "PPTT", "Flags", entry->flags, sizeof(entry->flags), 2, 31, passed);
+
+	if (rev == 1)
+		fwts_acpi_reserved_bits_check(fw, "PPTT", "Flags", entry->flags, sizeof(entry->flags), 2, 31, passed);
+	else if (rev == 2)
+		fwts_acpi_reserved_bits_check(fw, "PPTT", "Flags", entry->flags, sizeof(entry->flags), 5, 31, passed);
+
 }
 
 static void pptt_cache_test(fwts_framework *fw, const fwts_acpi_table_pptt_cache *entry, bool *passed)
@@ -112,10 +117,12 @@  static void pptt_id_test(fwts_framework *fw, const fwts_acpi_table_pptt_id *entr
 static int pptt_test1(fwts_framework *fw)
 {
 	fwts_acpi_table_pptt_header *entry;
-	uint32_t offset;
+	fwts_acpi_table_pptt *pptt;
 	bool passed = true;
+	uint32_t offset;
 
 	fwts_log_info_verbatim(fw, "PPTT Processor Properties Topology Table:");
+	pptt = (fwts_acpi_table_pptt *) table->data;
 
 	entry = (fwts_acpi_table_pptt_header *) (table->data + sizeof(fwts_acpi_table_pptt));
 	offset = sizeof(fwts_acpi_table_pptt);
@@ -131,7 +138,7 @@  static int pptt_test1(fwts_framework *fw)
 		}
 
 		if (entry->type == FWTS_ACPI_PPTT_PROCESSOR) {
-			pptt_processor_test(fw, (fwts_acpi_table_pptt_processor *) entry, &passed);
+			pptt_processor_test(fw, (fwts_acpi_table_pptt_processor *) entry, pptt->header.revision, &passed);
 			type_length = sizeof(fwts_acpi_table_pptt_processor) +
 				      ((fwts_acpi_table_pptt_processor *) entry)->number_priv_resources * 4;
 		} else if (entry->type == FWTS_ACPI_PPTT_CACHE) {