diff mbox

[1/5] acpi: acpidump: Add dump of TCPA

Message ID 1340975467-23977-2-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King June 29, 2012, 1:11 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

This is a fairly easy table to dump out, so lets add it to
the acpidump'ing tool.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/acpidump/acpidump.c |   16 +++++++++++++++-
 src/lib/include/fwts_acpi.h  |    9 +++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

Comments

Alex Hung July 2, 2012, 5:14 a.m. UTC | #1
On 06/29/2012 09:11 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> This is a fairly easy table to dump out, so lets add it to
> the acpidump'ing tool.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/acpidump/acpidump.c |   16 +++++++++++++++-
>   src/lib/include/fwts_acpi.h  |    9 +++++++++
>   2 files changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/src/acpi/acpidump/acpidump.c b/src/acpi/acpidump/acpidump.c
> index fa71535..3b4b2d0 100644
> --- a/src/acpi/acpidump/acpidump.c
> +++ b/src/acpi/acpidump/acpidump.c
> @@ -1025,6 +1025,20 @@ static void acpidump_srat(fwts_framework *fw, fwts_acpi_table_info *table)
>   	}
>   }
>
> +static void acpidump_tcpa(fwts_framework *fw, fwts_acpi_table_info *table)
> +{
> +	uint8_t *data = (uint8_t *)table->data;
> +	size_t length = table->length;
> +
> +	fwts_acpidump_field fields[] = {
> +		FIELD_UINT("Reserved", 		fwts_acpi_table_tcpa, reserved),
> +		FIELD_UINT("Log Zone Length", 	fwts_acpi_table_tcpa, log_zone_length),
> +		FIELD_UINT("Log Zone Address", 	fwts_acpi_table_tcpa, log_zone_addr),
> +		FIELD_END
> +	};
> +
> +	acpi_dump_table_fields(fw, data, fields, length, length);
> +}
>
>   typedef struct {
>   	char *name;
> @@ -1059,6 +1073,7 @@ static acpidump_table_vec table_vec[] = {
>   	{ "SSDT", 	acpidump_amlcode, 1 },
>   	{ "SLIT", 	acpidump_slit,  1 },
>   	{ "SRAT", 	acpidump_srat,  1 },
> +	{ "TCPA",	acpidump_tcpa,	1 },
>   	{ "XSDT", 	acpidump_xsdt, 	1 },
>   	{ NULL,		NULL,		0 },
>   };
> @@ -1107,7 +1122,6 @@ static int acpidump_test1(fwts_framework *fw)
>   	return FWTS_OK;
>   }
>
> -
>   static fwts_framework_minor_test acpidump_tests[] = {
>   	{ acpidump_test1, "Dump ACPI tables." },
>   	{ NULL, NULL }
> diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
> index 180a83e..c5fe9d5 100644
> --- a/src/lib/include/fwts_acpi.h
> +++ b/src/lib/include/fwts_acpi.h
> @@ -419,6 +419,15 @@ typedef struct {
>   	uint8_t		reserved[3];
>   } __attribute__ ((packed)) fwts_acpi_madt_local_x2apic_nmi;
>
> +/* From http://www.kuro5hin.org/story/2002/10/27/16622/530,
> +   and also http://www.cl.cam.ac.uk/~rja14/tcpa-faq.html */
> +typedef struct {
> +	fwts_acpi_table_header	header;	
> +	uint16_t	reserved;
> +	uint32_t	log_zone_length;
> +	uint64_t	log_zone_addr;
> +}  __attribute__ ((packed)) fwts_acpi_table_tcpa;
> +
>   void fwts_acpi_table_get_header(fwts_acpi_table_header *hdr, uint8_t *data);
>
>   #endif
>
Acked-by: Alex Hung <alex.hung@canonical.com>
Keng-Yu Lin July 3, 2012, 6:47 a.m. UTC | #2
On Fri, Jun 29, 2012 at 9:11 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> This is a fairly easy table to dump out, so lets add it to
> the acpidump'ing tool.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/acpidump/acpidump.c |   16 +++++++++++++++-
>  src/lib/include/fwts_acpi.h  |    9 +++++++++
>  2 files changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/src/acpi/acpidump/acpidump.c b/src/acpi/acpidump/acpidump.c
> index fa71535..3b4b2d0 100644
> --- a/src/acpi/acpidump/acpidump.c
> +++ b/src/acpi/acpidump/acpidump.c
> @@ -1025,6 +1025,20 @@ static void acpidump_srat(fwts_framework *fw, fwts_acpi_table_info *table)
>         }
>  }
>
> +static void acpidump_tcpa(fwts_framework *fw, fwts_acpi_table_info *table)
> +{
> +       uint8_t *data = (uint8_t *)table->data;
> +       size_t length = table->length;
> +
> +       fwts_acpidump_field fields[] = {
> +               FIELD_UINT("Reserved",          fwts_acpi_table_tcpa, reserved),
> +               FIELD_UINT("Log Zone Length",   fwts_acpi_table_tcpa, log_zone_length),
> +               FIELD_UINT("Log Zone Address",  fwts_acpi_table_tcpa, log_zone_addr),
> +               FIELD_END
> +       };
> +
> +       acpi_dump_table_fields(fw, data, fields, length, length);
> +}
>
>  typedef struct {
>         char *name;
> @@ -1059,6 +1073,7 @@ static acpidump_table_vec table_vec[] = {
>         { "SSDT",       acpidump_amlcode, 1 },
>         { "SLIT",       acpidump_slit,  1 },
>         { "SRAT",       acpidump_srat,  1 },
> +       { "TCPA",       acpidump_tcpa,  1 },
>         { "XSDT",       acpidump_xsdt,  1 },
>         { NULL,         NULL,           0 },
>  };
> @@ -1107,7 +1122,6 @@ static int acpidump_test1(fwts_framework *fw)
>         return FWTS_OK;
>  }
>
> -
>  static fwts_framework_minor_test acpidump_tests[] = {
>         { acpidump_test1, "Dump ACPI tables." },
>         { NULL, NULL }
> diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
> index 180a83e..c5fe9d5 100644
> --- a/src/lib/include/fwts_acpi.h
> +++ b/src/lib/include/fwts_acpi.h
> @@ -419,6 +419,15 @@ typedef struct {
>         uint8_t         reserved[3];
>  } __attribute__ ((packed)) fwts_acpi_madt_local_x2apic_nmi;
>
> +/* From http://www.kuro5hin.org/story/2002/10/27/16622/530,
> +   and also http://www.cl.cam.ac.uk/~rja14/tcpa-faq.html */
> +typedef struct {
> +       fwts_acpi_table_header  header;
> +       uint16_t        reserved;
> +       uint32_t        log_zone_length;
> +       uint64_t        log_zone_addr;
> +}  __attribute__ ((packed)) fwts_acpi_table_tcpa;
> +
>  void fwts_acpi_table_get_header(fwts_acpi_table_header *hdr, uint8_t *data);
>
>  #endif
> --
> 1.7.10.4
>

Acked-by: Keng-Yu Lin <kengyu@canonical.com>
diff mbox

Patch

diff --git a/src/acpi/acpidump/acpidump.c b/src/acpi/acpidump/acpidump.c
index fa71535..3b4b2d0 100644
--- a/src/acpi/acpidump/acpidump.c
+++ b/src/acpi/acpidump/acpidump.c
@@ -1025,6 +1025,20 @@  static void acpidump_srat(fwts_framework *fw, fwts_acpi_table_info *table)
 	}
 }
 
+static void acpidump_tcpa(fwts_framework *fw, fwts_acpi_table_info *table)
+{
+	uint8_t *data = (uint8_t *)table->data;
+	size_t length = table->length;
+
+	fwts_acpidump_field fields[] = {
+		FIELD_UINT("Reserved", 		fwts_acpi_table_tcpa, reserved),
+		FIELD_UINT("Log Zone Length", 	fwts_acpi_table_tcpa, log_zone_length),
+		FIELD_UINT("Log Zone Address", 	fwts_acpi_table_tcpa, log_zone_addr),
+		FIELD_END
+	};
+
+	acpi_dump_table_fields(fw, data, fields, length, length);
+}
 
 typedef struct {
 	char *name;
@@ -1059,6 +1073,7 @@  static acpidump_table_vec table_vec[] = {
 	{ "SSDT", 	acpidump_amlcode, 1 },
 	{ "SLIT", 	acpidump_slit,  1 },
 	{ "SRAT", 	acpidump_srat,  1 },
+	{ "TCPA",	acpidump_tcpa,	1 },
 	{ "XSDT", 	acpidump_xsdt, 	1 },
 	{ NULL,		NULL,		0 },
 };
@@ -1107,7 +1122,6 @@  static int acpidump_test1(fwts_framework *fw)
 	return FWTS_OK;
 }
 
-
 static fwts_framework_minor_test acpidump_tests[] = {
 	{ acpidump_test1, "Dump ACPI tables." },
 	{ NULL, NULL }
diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
index 180a83e..c5fe9d5 100644
--- a/src/lib/include/fwts_acpi.h
+++ b/src/lib/include/fwts_acpi.h
@@ -419,6 +419,15 @@  typedef struct {
 	uint8_t		reserved[3];
 } __attribute__ ((packed)) fwts_acpi_madt_local_x2apic_nmi;
 
+/* From http://www.kuro5hin.org/story/2002/10/27/16622/530,
+   and also http://www.cl.cam.ac.uk/~rja14/tcpa-faq.html */
+typedef struct {
+	fwts_acpi_table_header	header;	
+	uint16_t	reserved;
+	uint32_t	log_zone_length;
+	uint64_t	log_zone_addr;
+}  __attribute__ ((packed)) fwts_acpi_table_tcpa;
+
 void fwts_acpi_table_get_header(fwts_acpi_table_header *hdr, uint8_t *data);
 
 #endif