diff mbox

[2/2] acpi: acpidump: Add ACPI 5.0 GTDT support.

Message ID 1340990059-30259-3-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

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

Adding support to ACPI 5.0 Generic Timer Description Table (GTDT)

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

Comments

Alex Hung July 3, 2012, 7:07 a.m. UTC | #1
On 06/30/2012 01:14 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Adding support to ACPI 5.0 Generic Timer Description Table (GTDT)
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/acpidump/acpidump.c |   28 ++++++++++++++++++++++++++++
>   src/lib/include/fwts_acpi.h  |   14 ++++++++++++++
>   2 files changed, 42 insertions(+)
>
> diff --git a/src/acpi/acpidump/acpidump.c b/src/acpi/acpidump/acpidump.c
> index 9fc5204..2768563 100644
> --- a/src/acpi/acpidump/acpidump.c
> +++ b/src/acpi/acpidump/acpidump.c
> @@ -1460,6 +1460,33 @@ static void acpidump_bgrt(fwts_framework *fw, fwts_acpi_table_info *table)
>   	acpi_dump_table_fields(fw, data, bgrt_fields, length, length);
>   }
>
> +/*
> + *  acpidump_gtdt()
> + *	dump GTDT, see 5.2.24 Generic Timer Description Table (GTDT)
> + *	of version 5.0 ACPI spec.
> + */
> +static void acpidump_gtdt(fwts_framework *fw, fwts_acpi_table_info *table)
> +{
> +	uint8_t *data = (uint8_t *)table->data;
> +	size_t length = table->length;
> +
> +	static fwts_acpidump_field gtdt_fields[] = {
> +		FIELD_UINT("Physical Address", 		fwts_acpi_table_gtdt, phys_addr),
> +		FIELD_UINT("Global Flags", 		fwts_acpi_table_gtdt, global_flags),
> +		FIELD_UINT("Secure PL1 Timer GSIV", 	fwts_acpi_table_gtdt, secure_PL1_timer_GSIV),
> +		FIELD_UINT("Secure PL1 Timer Flags", 	fwts_acpi_table_gtdt, secure_PL1_timer_flags),
> +		FIELD_UINT("Non-Secure PL1 Timer GSIV", fwts_acpi_table_gtdt, non_secure_PL1_timer_GSIV),
> +		FIELD_UINT("Non-Secure PL1 Timer Flags", fwts_acpi_table_gtdt, non_secure_PL1_timer_flags),
> +		FIELD_UINT("Virtual Timer GSIV", 	fwts_acpi_table_gtdt, virtual_timer_GSIV),
> +		FIELD_UINT("Virtual Timer flags", 	fwts_acpi_table_gtdt, virtual_timer_flags),
> +		FIELD_UINT("Non-Secure PL2 Timer GSIV", fwts_acpi_table_gtdt, non_secure_PL2_timer_GSIV),
> +		FIELD_UINT("Non-Secure PL2 Timer Flags", fwts_acpi_table_gtdt, non_secure_PL2_timer_flags),
> +		FIELD_END
> +	};
> +
> +	acpi_dump_table_fields(fw, data, gtdt_fields, length, length);
> +}
> +
>   typedef struct {
>   	char *name;
>   	void (*func)(fwts_framework *fw, fwts_acpi_table_info *table);
> @@ -1485,6 +1512,7 @@ static acpidump_table_vec table_vec[] = {
>   	{ "ERST", 	acpidump_erst, 	1 },
>   	{ "FACP", 	acpidump_fadt, 	1 },
>   	{ "FACS", 	acpidump_facs, 	0 },
> +	{ "GTDT", 	acpidump_gtdt, 	1 },
>   	{ "HEST", 	acpidump_hest, 	1 },
>   	{ "HPET", 	acpidump_hpet, 	1 },
>   	{ "MCFG", 	acpidump_mcfg, 	1 },
> diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
> index 29a506d..bea2982 100644
> --- a/src/lib/include/fwts_acpi.h
> +++ b/src/lib/include/fwts_acpi.h
> @@ -601,6 +601,20 @@ typedef struct {
>   	uint32_t	image_offset_t;
>   } __attribute__ ((packed)) fwts_acpi_table_bgrt;
>
> +/* 5.2.24 Generic Timer Description Table (GTDT) ACPI 5.0 Spec */
> +typedef struct {
> +	uint64_t	phys_addr;
> +	uint32_t	global_flags;
> +	uint32_t	secure_PL1_timer_GSIV;
> +	uint32_t	secure_PL1_timer_flags;
> +	uint32_t	non_secure_PL1_timer_GSIV;
> +	uint32_t	non_secure_PL1_timer_flags;
> +	uint32_t	virtual_timer_GSIV;
> +	uint32_t	virtual_timer_flags;
> +	uint32_t	non_secure_PL2_timer_GSIV;
> +	uint32_t	non_secure_PL2_timer_flags;
> +} __attribute__ ((packed)) fwts_acpi_table_gtdt;
> +
>   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, 7:47 a.m. UTC | #2
On Sat, Jun 30, 2012 at 1:14 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Adding support to ACPI 5.0 Generic Timer Description Table (GTDT)
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/acpidump/acpidump.c |   28 ++++++++++++++++++++++++++++
>  src/lib/include/fwts_acpi.h  |   14 ++++++++++++++
>  2 files changed, 42 insertions(+)
>
> diff --git a/src/acpi/acpidump/acpidump.c b/src/acpi/acpidump/acpidump.c
> index 9fc5204..2768563 100644
> --- a/src/acpi/acpidump/acpidump.c
> +++ b/src/acpi/acpidump/acpidump.c
> @@ -1460,6 +1460,33 @@ static void acpidump_bgrt(fwts_framework *fw, fwts_acpi_table_info *table)
>         acpi_dump_table_fields(fw, data, bgrt_fields, length, length);
>  }
>
> +/*
> + *  acpidump_gtdt()
> + *     dump GTDT, see 5.2.24 Generic Timer Description Table (GTDT)
> + *     of version 5.0 ACPI spec.
> + */
> +static void acpidump_gtdt(fwts_framework *fw, fwts_acpi_table_info *table)
> +{
> +       uint8_t *data = (uint8_t *)table->data;
> +       size_t length = table->length;
> +
> +       static fwts_acpidump_field gtdt_fields[] = {
> +               FIELD_UINT("Physical Address",          fwts_acpi_table_gtdt, phys_addr),
> +               FIELD_UINT("Global Flags",              fwts_acpi_table_gtdt, global_flags),
> +               FIELD_UINT("Secure PL1 Timer GSIV",     fwts_acpi_table_gtdt, secure_PL1_timer_GSIV),
> +               FIELD_UINT("Secure PL1 Timer Flags",    fwts_acpi_table_gtdt, secure_PL1_timer_flags),
> +               FIELD_UINT("Non-Secure PL1 Timer GSIV", fwts_acpi_table_gtdt, non_secure_PL1_timer_GSIV),
> +               FIELD_UINT("Non-Secure PL1 Timer Flags", fwts_acpi_table_gtdt, non_secure_PL1_timer_flags),
> +               FIELD_UINT("Virtual Timer GSIV",        fwts_acpi_table_gtdt, virtual_timer_GSIV),
> +               FIELD_UINT("Virtual Timer flags",       fwts_acpi_table_gtdt, virtual_timer_flags),
> +               FIELD_UINT("Non-Secure PL2 Timer GSIV", fwts_acpi_table_gtdt, non_secure_PL2_timer_GSIV),
> +               FIELD_UINT("Non-Secure PL2 Timer Flags", fwts_acpi_table_gtdt, non_secure_PL2_timer_flags),
> +               FIELD_END
> +       };
> +
> +       acpi_dump_table_fields(fw, data, gtdt_fields, length, length);
> +}
> +
>  typedef struct {
>         char *name;
>         void (*func)(fwts_framework *fw, fwts_acpi_table_info *table);
> @@ -1485,6 +1512,7 @@ static acpidump_table_vec table_vec[] = {
>         { "ERST",       acpidump_erst,  1 },
>         { "FACP",       acpidump_fadt,  1 },
>         { "FACS",       acpidump_facs,  0 },
> +       { "GTDT",       acpidump_gtdt,  1 },
>         { "HEST",       acpidump_hest,  1 },
>         { "HPET",       acpidump_hpet,  1 },
>         { "MCFG",       acpidump_mcfg,  1 },
> diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
> index 29a506d..bea2982 100644
> --- a/src/lib/include/fwts_acpi.h
> +++ b/src/lib/include/fwts_acpi.h
> @@ -601,6 +601,20 @@ typedef struct {
>         uint32_t        image_offset_t;
>  } __attribute__ ((packed)) fwts_acpi_table_bgrt;
>
> +/* 5.2.24 Generic Timer Description Table (GTDT) ACPI 5.0 Spec */
> +typedef struct {
> +       uint64_t        phys_addr;
> +       uint32_t        global_flags;
> +       uint32_t        secure_PL1_timer_GSIV;
> +       uint32_t        secure_PL1_timer_flags;
> +       uint32_t        non_secure_PL1_timer_GSIV;
> +       uint32_t        non_secure_PL1_timer_flags;
> +       uint32_t        virtual_timer_GSIV;
> +       uint32_t        virtual_timer_flags;
> +       uint32_t        non_secure_PL2_timer_GSIV;
> +       uint32_t        non_secure_PL2_timer_flags;
> +} __attribute__ ((packed)) fwts_acpi_table_gtdt;
> +
>  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 9fc5204..2768563 100644
--- a/src/acpi/acpidump/acpidump.c
+++ b/src/acpi/acpidump/acpidump.c
@@ -1460,6 +1460,33 @@  static void acpidump_bgrt(fwts_framework *fw, fwts_acpi_table_info *table)
 	acpi_dump_table_fields(fw, data, bgrt_fields, length, length);
 }
 
+/*
+ *  acpidump_gtdt()
+ *	dump GTDT, see 5.2.24 Generic Timer Description Table (GTDT)
+ *	of version 5.0 ACPI spec.
+ */
+static void acpidump_gtdt(fwts_framework *fw, fwts_acpi_table_info *table)
+{
+	uint8_t *data = (uint8_t *)table->data;
+	size_t length = table->length;
+
+	static fwts_acpidump_field gtdt_fields[] = {
+		FIELD_UINT("Physical Address", 		fwts_acpi_table_gtdt, phys_addr),
+		FIELD_UINT("Global Flags", 		fwts_acpi_table_gtdt, global_flags),
+		FIELD_UINT("Secure PL1 Timer GSIV", 	fwts_acpi_table_gtdt, secure_PL1_timer_GSIV),
+		FIELD_UINT("Secure PL1 Timer Flags", 	fwts_acpi_table_gtdt, secure_PL1_timer_flags),
+		FIELD_UINT("Non-Secure PL1 Timer GSIV", fwts_acpi_table_gtdt, non_secure_PL1_timer_GSIV),
+		FIELD_UINT("Non-Secure PL1 Timer Flags", fwts_acpi_table_gtdt, non_secure_PL1_timer_flags),
+		FIELD_UINT("Virtual Timer GSIV", 	fwts_acpi_table_gtdt, virtual_timer_GSIV),
+		FIELD_UINT("Virtual Timer flags", 	fwts_acpi_table_gtdt, virtual_timer_flags),
+		FIELD_UINT("Non-Secure PL2 Timer GSIV", fwts_acpi_table_gtdt, non_secure_PL2_timer_GSIV),
+		FIELD_UINT("Non-Secure PL2 Timer Flags", fwts_acpi_table_gtdt, non_secure_PL2_timer_flags),
+		FIELD_END
+	};
+
+	acpi_dump_table_fields(fw, data, gtdt_fields, length, length);
+}
+
 typedef struct {
 	char *name;
 	void (*func)(fwts_framework *fw, fwts_acpi_table_info *table);
@@ -1485,6 +1512,7 @@  static acpidump_table_vec table_vec[] = {
 	{ "ERST", 	acpidump_erst, 	1 },
 	{ "FACP", 	acpidump_fadt, 	1 },
 	{ "FACS", 	acpidump_facs, 	0 },
+	{ "GTDT", 	acpidump_gtdt, 	1 },
 	{ "HEST", 	acpidump_hest, 	1 },
 	{ "HPET", 	acpidump_hpet, 	1 },
 	{ "MCFG", 	acpidump_mcfg, 	1 },
diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
index 29a506d..bea2982 100644
--- a/src/lib/include/fwts_acpi.h
+++ b/src/lib/include/fwts_acpi.h
@@ -601,6 +601,20 @@  typedef struct {
 	uint32_t	image_offset_t;
 } __attribute__ ((packed)) fwts_acpi_table_bgrt;
 
+/* 5.2.24 Generic Timer Description Table (GTDT) ACPI 5.0 Spec */
+typedef struct {
+	uint64_t	phys_addr;
+	uint32_t	global_flags;
+	uint32_t	secure_PL1_timer_GSIV;
+	uint32_t	secure_PL1_timer_flags;
+	uint32_t	non_secure_PL1_timer_GSIV;
+	uint32_t	non_secure_PL1_timer_flags;
+	uint32_t	virtual_timer_GSIV;
+	uint32_t	virtual_timer_flags;
+	uint32_t	non_secure_PL2_timer_GSIV;
+	uint32_t	non_secure_PL2_timer_flags;
+} __attribute__ ((packed)) fwts_acpi_table_gtdt;
+
 void fwts_acpi_table_get_header(fwts_acpi_table_header *hdr, uint8_t *data);
 
 #endif