Patchwork [1/3] acpi: acpidump: add SPCR table (LP: #1260351)

login
register
mail settings
Submitter Colin King
Date Dec. 12, 2013, 2:57 p.m.
Message ID <1386860225-1666-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/300677/
State Accepted
Headers show

Comments

Colin King - Dec. 12, 2013, 2:57 p.m.
From: Colin Ian King <colin.king@canonical.com>

Add support for the Serial Port Console Redirection Table

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/acpidump/acpidump.c | 35 +++++++++++++++++++++++++++++++++++
 src/lib/include/fwts_acpi.h  | 24 ++++++++++++++++++++++++
 2 files changed, 59 insertions(+)
Ivan Hu - Dec. 16, 2013, 1:46 a.m.
On 12/12/2013 10:57 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Add support for the Serial Port Console Redirection Table
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/acpidump/acpidump.c | 35 +++++++++++++++++++++++++++++++++++
>   src/lib/include/fwts_acpi.h  | 24 ++++++++++++++++++++++++
>   2 files changed, 59 insertions(+)
>
> diff --git a/src/acpi/acpidump/acpidump.c b/src/acpi/acpidump/acpidump.c
> index 240f6a9..2114134 100644
> --- a/src/acpi/acpidump/acpidump.c
> +++ b/src/acpi/acpidump/acpidump.c
> @@ -1679,6 +1679,40 @@ static void acpidump_pcct(fwts_framework *fw, const fwts_acpi_table_info *table)
>   	}
>   }
>
> +/*
> + *  acpidump_spcr()
> + *	dump spcr, Serial Port Console Redirection Table
> + */
> +static void acpidump_spcr(fwts_framework *fw, const fwts_acpi_table_info *table)
> +{
> +	static const fwts_acpidump_field spcr_fields[] = {
> +		FIELD_UINT("Interface Type", 		fwts_acpi_table_spcr, interface_type),
> +		FIELD_UINT("Reserved", 			fwts_acpi_table_spcr, reserved1),
> +		FIELD_GAS ("Base Address", 		fwts_acpi_table_spcr, base_address),
> +		FIELD_UINT("Interrupt Type", 		fwts_acpi_table_spcr, interrupt_type),
> +		FIELD_UINT("IRQ", 			fwts_acpi_table_spcr, irq),
> +		FIELD_UINT("Global System Interrupt", 	fwts_acpi_table_spcr, gsi),
> +		FIELD_UINT("Baud Rate", 		fwts_acpi_table_spcr, baud_rate),
> +		FIELD_UINT("Parity", 			fwts_acpi_table_spcr, parity),
> +		FIELD_UINT("Stop Bits", 		fwts_acpi_table_spcr, stop_bits),
> +		FIELD_UINT("Flow Control", 		fwts_acpi_table_spcr, flow_control),
> +		FIELD_UINT("Terminal Type", 		fwts_acpi_table_spcr, terminal_type),
> +		FIELD_UINT("Reserved", 			fwts_acpi_table_spcr, reserved2),
> +		FIELD_UINT("PCI Device ID", 		fwts_acpi_table_spcr, pci_device_id),
> +		FIELD_UINT("PCI Vendor ID", 		fwts_acpi_table_spcr, pci_vendor_id),
> +		FIELD_UINT("PCI Bus Number", 		fwts_acpi_table_spcr, pci_bus_number),
> +		FIELD_UINT("PCI Device Number", 	fwts_acpi_table_spcr, pci_device_number),
> +		FIELD_UINT("PCI Function Number", 	fwts_acpi_table_spcr, pci_function_number),
> +		FIELD_UINT("PCI Flags", 		fwts_acpi_table_spcr, pci_flags),
> +		FIELD_UINT("PCI Segment", 		fwts_acpi_table_spcr, pci_segment),
> +		FIELD_UINT("Reserved", 			fwts_acpi_table_spcr, reserved3),
> +		FIELD_END
> +	};
> +
> +	acpi_dump_table_fields(fw, table->data, spcr_fields, 0, table->length);
> +}
> +
> +
>   typedef struct {
>   	const char *name;
>   	void (*func)(fwts_framework *fw, const fwts_acpi_table_info *table);
> @@ -1718,6 +1752,7 @@ static const acpidump_table_vec table_vec[] = {
>   	{ "RSDT", 	acpidump_rsdt, 	1 },
>   	{ "RSD PTR ", 	acpidump_rsdp, 	0 },
>   	{ "SBST", 	acpidump_sbst,  1 },
> +	{ "SPCR",	acpidump_spcr,  1 },
>   	{ "SSDT", 	acpidump_amlcode, 1 },
>   	{ "SLIT", 	acpidump_slit,  1 },
>   	{ "SLIC", 	acpidump_slic,  1 },
> diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
> index d466d32..171bdc4 100644
> --- a/src/lib/include/fwts_acpi.h
> +++ b/src/lib/include/fwts_acpi.h
> @@ -681,6 +681,30 @@ typedef struct {
>   	uint16_t	min_request_turnaround_time;
>   } __attribute__ ((packed)) fwts_acpi_table_pcct_subspace_type_0;
>
> +typedef struct {
> +	fwts_acpi_table_header	header;
> +	uint8_t		interface_type;
> +	uint8_t		reserved1[3];
> +	fwts_acpi_gas	base_address;
> +	uint8_t		interrupt_type;
> +	uint8_t		irq;
> +	uint32_t	gsi;
> +	uint8_t		baud_rate;
> +	uint8_t		parity;
> +	uint8_t		stop_bits;
> +	uint8_t		flow_control;
> +	uint8_t		terminal_type;
> +	uint8_t		reserved2;
> +	uint16_t	pci_device_id;
> +	uint16_t	pci_vendor_id;
> +	uint8_t		pci_bus_number;
> +	uint8_t		pci_device_number;
> +	uint8_t		pci_function_number;
> +	uint32_t	pci_flags;
> +	uint8_t		pci_segment;
> +	uint32_t	reserved3;
> +} __attribute__ ((packed)) fwts_acpi_table_spcr;
> +
>   void fwts_acpi_table_get_header(fwts_acpi_table_header *hdr, uint8_t *data);
>
>   #endif
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>
Keng-Yu Lin - Dec. 20, 2013, 9:10 a.m.
On Mon, Dec 16, 2013 at 9:46 AM, IvanHu <ivan.hu@canonical.com> wrote:
> On 12/12/2013 10:57 PM, Colin King wrote:
>>
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> Add support for the Serial Port Console Redirection Table
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>   src/acpi/acpidump/acpidump.c | 35 +++++++++++++++++++++++++++++++++++
>>   src/lib/include/fwts_acpi.h  | 24 ++++++++++++++++++++++++
>>   2 files changed, 59 insertions(+)
>>
>> diff --git a/src/acpi/acpidump/acpidump.c b/src/acpi/acpidump/acpidump.c
>> index 240f6a9..2114134 100644
>> --- a/src/acpi/acpidump/acpidump.c
>> +++ b/src/acpi/acpidump/acpidump.c
>> @@ -1679,6 +1679,40 @@ static void acpidump_pcct(fwts_framework *fw, const
>> fwts_acpi_table_info *table)
>>         }
>>   }
>>
>> +/*
>> + *  acpidump_spcr()
>> + *     dump spcr, Serial Port Console Redirection Table
>> + */
>> +static void acpidump_spcr(fwts_framework *fw, const fwts_acpi_table_info
>> *table)
>> +{
>> +       static const fwts_acpidump_field spcr_fields[] = {
>> +               FIELD_UINT("Interface Type",
>> fwts_acpi_table_spcr, interface_type),
>> +               FIELD_UINT("Reserved",
>> fwts_acpi_table_spcr, reserved1),
>> +               FIELD_GAS ("Base Address",
>> fwts_acpi_table_spcr, base_address),
>> +               FIELD_UINT("Interrupt Type",
>> fwts_acpi_table_spcr, interrupt_type),
>> +               FIELD_UINT("IRQ",
>> fwts_acpi_table_spcr, irq),
>> +               FIELD_UINT("Global System Interrupt",
>> fwts_acpi_table_spcr, gsi),
>> +               FIELD_UINT("Baud Rate",
>> fwts_acpi_table_spcr, baud_rate),
>> +               FIELD_UINT("Parity",
>> fwts_acpi_table_spcr, parity),
>> +               FIELD_UINT("Stop Bits",
>> fwts_acpi_table_spcr, stop_bits),
>> +               FIELD_UINT("Flow Control",
>> fwts_acpi_table_spcr, flow_control),
>> +               FIELD_UINT("Terminal Type",
>> fwts_acpi_table_spcr, terminal_type),
>> +               FIELD_UINT("Reserved",
>> fwts_acpi_table_spcr, reserved2),
>> +               FIELD_UINT("PCI Device ID",
>> fwts_acpi_table_spcr, pci_device_id),
>> +               FIELD_UINT("PCI Vendor ID",
>> fwts_acpi_table_spcr, pci_vendor_id),
>> +               FIELD_UINT("PCI Bus Number",
>> fwts_acpi_table_spcr, pci_bus_number),
>> +               FIELD_UINT("PCI Device Number",
>> fwts_acpi_table_spcr, pci_device_number),
>> +               FIELD_UINT("PCI Function Number",
>> fwts_acpi_table_spcr, pci_function_number),
>> +               FIELD_UINT("PCI Flags",
>> fwts_acpi_table_spcr, pci_flags),
>> +               FIELD_UINT("PCI Segment",
>> fwts_acpi_table_spcr, pci_segment),
>> +               FIELD_UINT("Reserved",
>> fwts_acpi_table_spcr, reserved3),
>> +               FIELD_END
>> +       };
>> +
>> +       acpi_dump_table_fields(fw, table->data, spcr_fields, 0,
>> table->length);
>> +}
>> +
>> +
>>   typedef struct {
>>         const char *name;
>>         void (*func)(fwts_framework *fw, const fwts_acpi_table_info
>> *table);
>> @@ -1718,6 +1752,7 @@ static const acpidump_table_vec table_vec[] = {
>>         { "RSDT",       acpidump_rsdt,  1 },
>>         { "RSD PTR ",   acpidump_rsdp,  0 },
>>         { "SBST",       acpidump_sbst,  1 },
>> +       { "SPCR",       acpidump_spcr,  1 },
>>         { "SSDT",       acpidump_amlcode, 1 },
>>         { "SLIT",       acpidump_slit,  1 },
>>         { "SLIC",       acpidump_slic,  1 },
>> diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
>> index d466d32..171bdc4 100644
>> --- a/src/lib/include/fwts_acpi.h
>> +++ b/src/lib/include/fwts_acpi.h
>> @@ -681,6 +681,30 @@ typedef struct {
>>         uint16_t        min_request_turnaround_time;
>>   } __attribute__ ((packed)) fwts_acpi_table_pcct_subspace_type_0;
>>
>> +typedef struct {
>> +       fwts_acpi_table_header  header;
>> +       uint8_t         interface_type;
>> +       uint8_t         reserved1[3];
>> +       fwts_acpi_gas   base_address;
>> +       uint8_t         interrupt_type;
>> +       uint8_t         irq;
>> +       uint32_t        gsi;
>> +       uint8_t         baud_rate;
>> +       uint8_t         parity;
>> +       uint8_t         stop_bits;
>> +       uint8_t         flow_control;
>> +       uint8_t         terminal_type;
>> +       uint8_t         reserved2;
>> +       uint16_t        pci_device_id;
>> +       uint16_t        pci_vendor_id;
>> +       uint8_t         pci_bus_number;
>> +       uint8_t         pci_device_number;
>> +       uint8_t         pci_function_number;
>> +       uint32_t        pci_flags;
>> +       uint8_t         pci_segment;
>> +       uint32_t        reserved3;
>> +} __attribute__ ((packed)) fwts_acpi_table_spcr;
>> +
>>   void fwts_acpi_table_get_header(fwts_acpi_table_header *hdr, uint8_t
>> *data);
>>
>>   #endif
>>
>
> Acked-by: Ivan Hu <ivan.hu@canonical.com>
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Keng-Yu Lin - Dec. 20, 2013, 9:11 a.m.
On Thu, Dec 12, 2013 at 10:57 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Add support for the Serial Port Console Redirection Table
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/acpidump/acpidump.c | 35 +++++++++++++++++++++++++++++++++++
>  src/lib/include/fwts_acpi.h  | 24 ++++++++++++++++++++++++
>  2 files changed, 59 insertions(+)
>
> diff --git a/src/acpi/acpidump/acpidump.c b/src/acpi/acpidump/acpidump.c
> index 240f6a9..2114134 100644
> --- a/src/acpi/acpidump/acpidump.c
> +++ b/src/acpi/acpidump/acpidump.c
> @@ -1679,6 +1679,40 @@ static void acpidump_pcct(fwts_framework *fw, const fwts_acpi_table_info *table)
>         }
>  }
>
> +/*
> + *  acpidump_spcr()
> + *     dump spcr, Serial Port Console Redirection Table
> + */
> +static void acpidump_spcr(fwts_framework *fw, const fwts_acpi_table_info *table)
> +{
> +       static const fwts_acpidump_field spcr_fields[] = {
> +               FIELD_UINT("Interface Type",            fwts_acpi_table_spcr, interface_type),
> +               FIELD_UINT("Reserved",                  fwts_acpi_table_spcr, reserved1),
> +               FIELD_GAS ("Base Address",              fwts_acpi_table_spcr, base_address),
> +               FIELD_UINT("Interrupt Type",            fwts_acpi_table_spcr, interrupt_type),
> +               FIELD_UINT("IRQ",                       fwts_acpi_table_spcr, irq),
> +               FIELD_UINT("Global System Interrupt",   fwts_acpi_table_spcr, gsi),
> +               FIELD_UINT("Baud Rate",                 fwts_acpi_table_spcr, baud_rate),
> +               FIELD_UINT("Parity",                    fwts_acpi_table_spcr, parity),
> +               FIELD_UINT("Stop Bits",                 fwts_acpi_table_spcr, stop_bits),
> +               FIELD_UINT("Flow Control",              fwts_acpi_table_spcr, flow_control),
> +               FIELD_UINT("Terminal Type",             fwts_acpi_table_spcr, terminal_type),
> +               FIELD_UINT("Reserved",                  fwts_acpi_table_spcr, reserved2),
> +               FIELD_UINT("PCI Device ID",             fwts_acpi_table_spcr, pci_device_id),
> +               FIELD_UINT("PCI Vendor ID",             fwts_acpi_table_spcr, pci_vendor_id),
> +               FIELD_UINT("PCI Bus Number",            fwts_acpi_table_spcr, pci_bus_number),
> +               FIELD_UINT("PCI Device Number",         fwts_acpi_table_spcr, pci_device_number),
> +               FIELD_UINT("PCI Function Number",       fwts_acpi_table_spcr, pci_function_number),
> +               FIELD_UINT("PCI Flags",                 fwts_acpi_table_spcr, pci_flags),
> +               FIELD_UINT("PCI Segment",               fwts_acpi_table_spcr, pci_segment),
> +               FIELD_UINT("Reserved",                  fwts_acpi_table_spcr, reserved3),
> +               FIELD_END
> +       };
> +
> +       acpi_dump_table_fields(fw, table->data, spcr_fields, 0, table->length);
> +}
> +
> +
>  typedef struct {
>         const char *name;
>         void (*func)(fwts_framework *fw, const fwts_acpi_table_info *table);
> @@ -1718,6 +1752,7 @@ static const acpidump_table_vec table_vec[] = {
>         { "RSDT",       acpidump_rsdt,  1 },
>         { "RSD PTR ",   acpidump_rsdp,  0 },
>         { "SBST",       acpidump_sbst,  1 },
> +       { "SPCR",       acpidump_spcr,  1 },
>         { "SSDT",       acpidump_amlcode, 1 },
>         { "SLIT",       acpidump_slit,  1 },
>         { "SLIC",       acpidump_slic,  1 },
> diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
> index d466d32..171bdc4 100644
> --- a/src/lib/include/fwts_acpi.h
> +++ b/src/lib/include/fwts_acpi.h
> @@ -681,6 +681,30 @@ typedef struct {
>         uint16_t        min_request_turnaround_time;
>  } __attribute__ ((packed)) fwts_acpi_table_pcct_subspace_type_0;
>
> +typedef struct {
> +       fwts_acpi_table_header  header;
> +       uint8_t         interface_type;
> +       uint8_t         reserved1[3];
> +       fwts_acpi_gas   base_address;
> +       uint8_t         interrupt_type;
> +       uint8_t         irq;
> +       uint32_t        gsi;
> +       uint8_t         baud_rate;
> +       uint8_t         parity;
> +       uint8_t         stop_bits;
> +       uint8_t         flow_control;
> +       uint8_t         terminal_type;
> +       uint8_t         reserved2;
> +       uint16_t        pci_device_id;
> +       uint16_t        pci_vendor_id;
> +       uint8_t         pci_bus_number;
> +       uint8_t         pci_device_number;
> +       uint8_t         pci_function_number;
> +       uint32_t        pci_flags;
> +       uint8_t         pci_segment;
> +       uint32_t        reserved3;
> +} __attribute__ ((packed)) fwts_acpi_table_spcr;
> +
>  void fwts_acpi_table_get_header(fwts_acpi_table_header *hdr, uint8_t *data);
>
>  #endif
> --
> 1.8.5.1
>
>

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

Patch

diff --git a/src/acpi/acpidump/acpidump.c b/src/acpi/acpidump/acpidump.c
index 240f6a9..2114134 100644
--- a/src/acpi/acpidump/acpidump.c
+++ b/src/acpi/acpidump/acpidump.c
@@ -1679,6 +1679,40 @@  static void acpidump_pcct(fwts_framework *fw, const fwts_acpi_table_info *table)
 	}
 }
 
+/*
+ *  acpidump_spcr()
+ *	dump spcr, Serial Port Console Redirection Table
+ */
+static void acpidump_spcr(fwts_framework *fw, const fwts_acpi_table_info *table)
+{
+	static const fwts_acpidump_field spcr_fields[] = {
+		FIELD_UINT("Interface Type", 		fwts_acpi_table_spcr, interface_type),
+		FIELD_UINT("Reserved", 			fwts_acpi_table_spcr, reserved1),
+		FIELD_GAS ("Base Address", 		fwts_acpi_table_spcr, base_address),
+		FIELD_UINT("Interrupt Type", 		fwts_acpi_table_spcr, interrupt_type),
+		FIELD_UINT("IRQ", 			fwts_acpi_table_spcr, irq),
+		FIELD_UINT("Global System Interrupt", 	fwts_acpi_table_spcr, gsi),
+		FIELD_UINT("Baud Rate", 		fwts_acpi_table_spcr, baud_rate),
+		FIELD_UINT("Parity", 			fwts_acpi_table_spcr, parity),
+		FIELD_UINT("Stop Bits", 		fwts_acpi_table_spcr, stop_bits),
+		FIELD_UINT("Flow Control", 		fwts_acpi_table_spcr, flow_control),
+		FIELD_UINT("Terminal Type", 		fwts_acpi_table_spcr, terminal_type),
+		FIELD_UINT("Reserved", 			fwts_acpi_table_spcr, reserved2),
+		FIELD_UINT("PCI Device ID", 		fwts_acpi_table_spcr, pci_device_id),
+		FIELD_UINT("PCI Vendor ID", 		fwts_acpi_table_spcr, pci_vendor_id),
+		FIELD_UINT("PCI Bus Number", 		fwts_acpi_table_spcr, pci_bus_number),
+		FIELD_UINT("PCI Device Number", 	fwts_acpi_table_spcr, pci_device_number),
+		FIELD_UINT("PCI Function Number", 	fwts_acpi_table_spcr, pci_function_number),
+		FIELD_UINT("PCI Flags", 		fwts_acpi_table_spcr, pci_flags),
+		FIELD_UINT("PCI Segment", 		fwts_acpi_table_spcr, pci_segment),
+		FIELD_UINT("Reserved", 			fwts_acpi_table_spcr, reserved3),
+		FIELD_END
+	};
+
+	acpi_dump_table_fields(fw, table->data, spcr_fields, 0, table->length);
+}
+
+
 typedef struct {
 	const char *name;
 	void (*func)(fwts_framework *fw, const fwts_acpi_table_info *table);
@@ -1718,6 +1752,7 @@  static const acpidump_table_vec table_vec[] = {
 	{ "RSDT", 	acpidump_rsdt, 	1 },
 	{ "RSD PTR ", 	acpidump_rsdp, 	0 },
 	{ "SBST", 	acpidump_sbst,  1 },
+	{ "SPCR",	acpidump_spcr,  1 },
 	{ "SSDT", 	acpidump_amlcode, 1 },
 	{ "SLIT", 	acpidump_slit,  1 },
 	{ "SLIC", 	acpidump_slic,  1 },
diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
index d466d32..171bdc4 100644
--- a/src/lib/include/fwts_acpi.h
+++ b/src/lib/include/fwts_acpi.h
@@ -681,6 +681,30 @@  typedef struct {
 	uint16_t	min_request_turnaround_time;
 } __attribute__ ((packed)) fwts_acpi_table_pcct_subspace_type_0;
 
+typedef struct {
+	fwts_acpi_table_header	header;
+	uint8_t		interface_type;
+	uint8_t		reserved1[3];
+	fwts_acpi_gas	base_address;
+	uint8_t		interrupt_type;
+	uint8_t		irq;
+	uint32_t	gsi;
+	uint8_t		baud_rate;
+	uint8_t		parity;
+	uint8_t		stop_bits;
+	uint8_t		flow_control;
+	uint8_t		terminal_type;
+	uint8_t		reserved2;
+	uint16_t	pci_device_id;
+	uint16_t	pci_vendor_id;
+	uint8_t		pci_bus_number;
+	uint8_t		pci_device_number;
+	uint8_t		pci_function_number;
+	uint32_t	pci_flags;
+	uint8_t		pci_segment;
+	uint32_t	reserved3;
+} __attribute__ ((packed)) fwts_acpi_table_spcr;
+
 void fwts_acpi_table_get_header(fwts_acpi_table_header *hdr, uint8_t *data);
 
 #endif