diff mbox series

[02/14] acpi: pptt: check flags based on revision (mantis 1870 for ACPI 6.2b)

Message ID 20190208032314.15215-3-alex.hung@canonical.com
State Accepted
Headers show
Series Updates for ACPI 6.2b and 6.3 | expand

Commit Message

Alex Hung Feb. 8, 2019, 3:23 a.m. UTC
Signed-off-by: Alex Hung <alex.hung@canonical.com>
---
 src/acpi/pptt/pptt.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Comments

Colin Ian King Feb. 8, 2019, 11:36 a.m. UTC | #1
On 08/02/2019 03:23, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/pptt/pptt.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/src/acpi/pptt/pptt.c b/src/acpi/pptt/pptt.c
> index ef1c50e8..e0b7f446 100644
> --- a/src/acpi/pptt/pptt.c
> +++ b/src/acpi/pptt/pptt.c
> @@ -25,6 +25,8 @@
>  
>  static fwts_acpi_table_info *table;
>  
> +static uint8_t table_rev;
> +

instead of making another static for table_rev, why can't it be added as
an extra argument to pptt_processor_test, e.g.

static void pptt_processor_test(
	fwts_framework *fw,
	const fwts_acpi_table_pptt_processor *entry,
	const uint8_t table_rev,
	bool *passed)
{

}

..and called from pptt_test1, e.g.

               if (entry->type == FWTS_ACPI_PPTT_PROCESSOR) {
                        pptt_processor_test(fw,
(fwts_acpi_table_pptt_processor *) entry, pptt->header.revision, &passed);

			...


>  static int pptt_init(fwts_framework *fw)
>  {
>  	if (fwts_acpi_find_table(fw, "PPTT", 0, &table) != FWTS_OK) {
> @@ -65,7 +67,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 (table_rev == 1)
> +		fwts_acpi_reserved_bits_check(fw, "PPTT", "Flags", entry->flags, sizeof(entry->flags), 2, 31, passed);
> +	else if (table_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 +119,13 @@ 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;
> +	table_rev = pptt->header.revision;
>  
>  	entry = (fwts_acpi_table_pptt_header *) (table->data + sizeof(fwts_acpi_table_pptt));
>  	offset = sizeof(fwts_acpi_table_pptt);
>
diff mbox series

Patch

diff --git a/src/acpi/pptt/pptt.c b/src/acpi/pptt/pptt.c
index ef1c50e8..e0b7f446 100644
--- a/src/acpi/pptt/pptt.c
+++ b/src/acpi/pptt/pptt.c
@@ -25,6 +25,8 @@ 
 
 static fwts_acpi_table_info *table;
 
+static uint8_t table_rev;
+
 static int pptt_init(fwts_framework *fw)
 {
 	if (fwts_acpi_find_table(fw, "PPTT", 0, &table) != FWTS_OK) {
@@ -65,7 +67,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 (table_rev == 1)
+		fwts_acpi_reserved_bits_check(fw, "PPTT", "Flags", entry->flags, sizeof(entry->flags), 2, 31, passed);
+	else if (table_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 +119,13 @@  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;
+	table_rev = pptt->header.revision;
 
 	entry = (fwts_acpi_table_pptt_header *) (table->data + sizeof(fwts_acpi_table_pptt));
 	offset = sizeof(fwts_acpi_table_pptt);