Patchwork [1/4] acpi: acpidump: correctly dump out MCFG configuration

login
register
mail settings
Submitter Colin King
Date Oct. 20, 2012, 7:53 p.m.
Message ID <1350762841-5702-2-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/192945/
State Accepted
Headers show

Comments

Colin King - Oct. 20, 2012, 7:53 p.m.
From: Colin Ian King <colin.king@canonical.com>

The acpidump MCFG configurarion was not being dumped correctly
and in fact dumping data offset from the wrong place.  Fix this
up as well as use up to date MCFG table descriptions.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/acpidump/acpidump.c |   20 ++++++++++----------
 src/lib/include/fwts_acpi.h  |    6 ++----
 2 files changed, 12 insertions(+), 14 deletions(-)
Alex Hung - Oct. 25, 2012, 2:43 a.m.
On 10/21/2012 03:53 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The acpidump MCFG configurarion was not being dumped correctly
> and in fact dumping data offset from the wrong place.  Fix this
> up as well as use up to date MCFG table descriptions.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/acpidump/acpidump.c |   20 ++++++++++----------
>   src/lib/include/fwts_acpi.h  |    6 ++----
>   2 files changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/src/acpi/acpidump/acpidump.c b/src/acpi/acpidump/acpidump.c
> index 5f91457..d6b4333 100644
> --- a/src/acpi/acpidump/acpidump.c
> +++ b/src/acpi/acpidump/acpidump.c
> @@ -970,8 +970,7 @@ static void acpidump_mcfg(fwts_framework *fw, fwts_acpi_table_info *table)
>   	size_t i;
>
>   	static fwts_acpidump_field fields[] = {
> -		FIELD_UINT("Base Address", 	fwts_acpi_table_mcfg, 	base_address),
> -		FIELD_UINT("Base Reserved", 	fwts_acpi_table_mcfg,	base_reserved),
> +		FIELD_UINT("Reserved", 	fwts_acpi_table_mcfg,	reserved),
>   		FIELD_END
>   	};
>
> @@ -980,16 +979,17 @@ static void acpidump_mcfg(fwts_framework *fw, fwts_acpi_table_info *table)
>   	n = length - sizeof(fwts_acpi_table_mcfg);
>   	fwts_acpi_mcfg_configuration *config = mcfg->configuration;
>
> -	for (i=0; i<n/sizeof(fwts_acpi_mcfg_configuration); i++) {
> -		fwts_acpidump_field fields_config[] = {
> -			FIELD_UINT("  Base Address", 	fwts_acpi_table_mcfg,	configuration[i].base_address),
> -			FIELD_UINT("  Base Address", 	fwts_acpi_table_mcfg,	configuration[i].base_address),
> -			FIELD_UINT("  Base Reserved", 	fwts_acpi_table_mcfg,	configuration[i].base_reserved),
> -			FIELD_UINT("  PCI Seg Grp Num", fwts_acpi_table_mcfg,	configuration[i].pci_segment_group_number),
> -			FIELD_UINT("  Start Bus Num", 	fwts_acpi_table_mcfg,	configuration[i].start_bus_number),
> -			FIELD_UINT("  End Bus Num", 	fwts_acpi_table_mcfg,	configuration[i].end_bus_number),
> +	for (i = 0; i < n / sizeof(fwts_acpi_mcfg_configuration); i++) {
> +		static fwts_acpidump_field fields_config[] = {
> +			FIELD_UINT("  Base Address", 	fwts_acpi_mcfg_configuration,	base_address),
> +			FIELD_UINT("  PCI Seg Grp Num", fwts_acpi_mcfg_configuration,	pci_segment_group_number),
> +			FIELD_UINT("  Start Bus Num", 	fwts_acpi_mcfg_configuration,	start_bus_number),
> +			FIELD_UINT("  End Bus Num", 	fwts_acpi_mcfg_configuration,	end_bus_number),
> +			FIELD_UINT("  Reserved", 	fwts_acpi_mcfg_configuration,	reserved),
>   			FIELD_END
>   		};
> +
> +		fwts_log_nl(fw);
>   		fwts_log_info_verbatum(fw, "Configuration #%zd:", i+1);
>   		acpi_dump_table_fields(fw, (uint8_t*)config, fields_config, 0, length);
>   		config++;
> diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
> index e99d0a7..25bb609 100644
> --- a/src/lib/include/fwts_acpi.h
> +++ b/src/lib/include/fwts_acpi.h
> @@ -220,8 +220,7 @@ typedef struct {
>   } __attribute__ ((packed)) fwts_acpi_table_fadt;
>
>   typedef struct {
> -	uint32_t	base_address;
> -	uint32_t	base_reserved;
> +	uint64_t	base_address;
>   	uint16_t	pci_segment_group_number;
>   	uint8_t		start_bus_number;
>   	uint8_t		end_bus_number;
> @@ -230,8 +229,7 @@ typedef struct {
>
>   typedef struct {
>   	fwts_acpi_table_header	header;
> -	uint32_t	base_address;
> -	uint32_t	base_reserved;
> +	uint64_t	reserved;
>   	fwts_acpi_mcfg_configuration configuration[0];
>   } __attribute__ ((packed)) fwts_acpi_table_mcfg;
>
>

Acked-by: Alex Hung <alex.hung@canonical.com>
Keng-Yu Lin - Oct. 25, 2012, 7:56 a.m.
On Sun, Oct 21, 2012 at 3:53 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The acpidump MCFG configurarion was not being dumped correctly
> and in fact dumping data offset from the wrong place.  Fix this
> up as well as use up to date MCFG table descriptions.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/acpidump/acpidump.c |   20 ++++++++++----------
>  src/lib/include/fwts_acpi.h  |    6 ++----
>  2 files changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/src/acpi/acpidump/acpidump.c b/src/acpi/acpidump/acpidump.c
> index 5f91457..d6b4333 100644
> --- a/src/acpi/acpidump/acpidump.c
> +++ b/src/acpi/acpidump/acpidump.c
> @@ -970,8 +970,7 @@ static void acpidump_mcfg(fwts_framework *fw, fwts_acpi_table_info *table)
>         size_t i;
>
>         static fwts_acpidump_field fields[] = {
> -               FIELD_UINT("Base Address",      fwts_acpi_table_mcfg,   base_address),
> -               FIELD_UINT("Base Reserved",     fwts_acpi_table_mcfg,   base_reserved),
> +               FIELD_UINT("Reserved",  fwts_acpi_table_mcfg,   reserved),
>                 FIELD_END
>         };
>
> @@ -980,16 +979,17 @@ static void acpidump_mcfg(fwts_framework *fw, fwts_acpi_table_info *table)
>         n = length - sizeof(fwts_acpi_table_mcfg);
>         fwts_acpi_mcfg_configuration *config = mcfg->configuration;
>
> -       for (i=0; i<n/sizeof(fwts_acpi_mcfg_configuration); i++) {
> -               fwts_acpidump_field fields_config[] = {
> -                       FIELD_UINT("  Base Address",    fwts_acpi_table_mcfg,   configuration[i].base_address),
> -                       FIELD_UINT("  Base Address",    fwts_acpi_table_mcfg,   configuration[i].base_address),
> -                       FIELD_UINT("  Base Reserved",   fwts_acpi_table_mcfg,   configuration[i].base_reserved),
> -                       FIELD_UINT("  PCI Seg Grp Num", fwts_acpi_table_mcfg,   configuration[i].pci_segment_group_number),
> -                       FIELD_UINT("  Start Bus Num",   fwts_acpi_table_mcfg,   configuration[i].start_bus_number),
> -                       FIELD_UINT("  End Bus Num",     fwts_acpi_table_mcfg,   configuration[i].end_bus_number),
> +       for (i = 0; i < n / sizeof(fwts_acpi_mcfg_configuration); i++) {
> +               static fwts_acpidump_field fields_config[] = {
> +                       FIELD_UINT("  Base Address",    fwts_acpi_mcfg_configuration,   base_address),
> +                       FIELD_UINT("  PCI Seg Grp Num", fwts_acpi_mcfg_configuration,   pci_segment_group_number),
> +                       FIELD_UINT("  Start Bus Num",   fwts_acpi_mcfg_configuration,   start_bus_number),
> +                       FIELD_UINT("  End Bus Num",     fwts_acpi_mcfg_configuration,   end_bus_number),
> +                       FIELD_UINT("  Reserved",        fwts_acpi_mcfg_configuration,   reserved),
>                         FIELD_END
>                 };
> +
> +               fwts_log_nl(fw);
>                 fwts_log_info_verbatum(fw, "Configuration #%zd:", i+1);
>                 acpi_dump_table_fields(fw, (uint8_t*)config, fields_config, 0, length);
>                 config++;
> diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
> index e99d0a7..25bb609 100644
> --- a/src/lib/include/fwts_acpi.h
> +++ b/src/lib/include/fwts_acpi.h
> @@ -220,8 +220,7 @@ typedef struct {
>  } __attribute__ ((packed)) fwts_acpi_table_fadt;
>
>  typedef struct {
> -       uint32_t        base_address;
> -       uint32_t        base_reserved;
> +       uint64_t        base_address;
>         uint16_t        pci_segment_group_number;
>         uint8_t         start_bus_number;
>         uint8_t         end_bus_number;
> @@ -230,8 +229,7 @@ typedef struct {
>
>  typedef struct {
>         fwts_acpi_table_header  header;
> -       uint32_t        base_address;
> -       uint32_t        base_reserved;
> +       uint64_t        reserved;
>         fwts_acpi_mcfg_configuration configuration[0];
>  } __attribute__ ((packed)) fwts_acpi_table_mcfg;
>
> --
> 1.7.10.4
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>

Patch

diff --git a/src/acpi/acpidump/acpidump.c b/src/acpi/acpidump/acpidump.c
index 5f91457..d6b4333 100644
--- a/src/acpi/acpidump/acpidump.c
+++ b/src/acpi/acpidump/acpidump.c
@@ -970,8 +970,7 @@  static void acpidump_mcfg(fwts_framework *fw, fwts_acpi_table_info *table)
 	size_t i;
 
 	static fwts_acpidump_field fields[] = {
-		FIELD_UINT("Base Address", 	fwts_acpi_table_mcfg, 	base_address),
-		FIELD_UINT("Base Reserved", 	fwts_acpi_table_mcfg,	base_reserved),
+		FIELD_UINT("Reserved", 	fwts_acpi_table_mcfg,	reserved),
 		FIELD_END
 	};
 
@@ -980,16 +979,17 @@  static void acpidump_mcfg(fwts_framework *fw, fwts_acpi_table_info *table)
 	n = length - sizeof(fwts_acpi_table_mcfg);
 	fwts_acpi_mcfg_configuration *config = mcfg->configuration;
 
-	for (i=0; i<n/sizeof(fwts_acpi_mcfg_configuration); i++) {
-		fwts_acpidump_field fields_config[] = {
-			FIELD_UINT("  Base Address", 	fwts_acpi_table_mcfg,	configuration[i].base_address),
-			FIELD_UINT("  Base Address", 	fwts_acpi_table_mcfg,	configuration[i].base_address),
-			FIELD_UINT("  Base Reserved", 	fwts_acpi_table_mcfg,	configuration[i].base_reserved),
-			FIELD_UINT("  PCI Seg Grp Num", fwts_acpi_table_mcfg,	configuration[i].pci_segment_group_number),
-			FIELD_UINT("  Start Bus Num", 	fwts_acpi_table_mcfg,	configuration[i].start_bus_number),
-			FIELD_UINT("  End Bus Num", 	fwts_acpi_table_mcfg,	configuration[i].end_bus_number),
+	for (i = 0; i < n / sizeof(fwts_acpi_mcfg_configuration); i++) {
+		static fwts_acpidump_field fields_config[] = {
+			FIELD_UINT("  Base Address", 	fwts_acpi_mcfg_configuration,	base_address),
+			FIELD_UINT("  PCI Seg Grp Num", fwts_acpi_mcfg_configuration,	pci_segment_group_number),
+			FIELD_UINT("  Start Bus Num", 	fwts_acpi_mcfg_configuration,	start_bus_number),
+			FIELD_UINT("  End Bus Num", 	fwts_acpi_mcfg_configuration,	end_bus_number),
+			FIELD_UINT("  Reserved", 	fwts_acpi_mcfg_configuration,	reserved),
 			FIELD_END
 		};
+
+		fwts_log_nl(fw);
 		fwts_log_info_verbatum(fw, "Configuration #%zd:", i+1);
 		acpi_dump_table_fields(fw, (uint8_t*)config, fields_config, 0, length);
 		config++;
diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
index e99d0a7..25bb609 100644
--- a/src/lib/include/fwts_acpi.h
+++ b/src/lib/include/fwts_acpi.h
@@ -220,8 +220,7 @@  typedef struct {
 } __attribute__ ((packed)) fwts_acpi_table_fadt;
 
 typedef struct {
-	uint32_t	base_address;
-	uint32_t	base_reserved;
+	uint64_t	base_address;
 	uint16_t	pci_segment_group_number;
 	uint8_t		start_bus_number;
 	uint8_t		end_bus_number;
@@ -230,8 +229,7 @@  typedef struct {
 
 typedef struct {
 	fwts_acpi_table_header	header;
-	uint32_t	base_address;
-	uint32_t	base_reserved;
+	uint64_t	reserved;
 	fwts_acpi_mcfg_configuration configuration[0];
 } __attribute__ ((packed)) fwts_acpi_table_mcfg;