diff mbox series

[1/2] acpi: spcr: update the spcr tests to lastest revision 4

Message ID 20230731073230.80415-1-ivan.hu@canonical.com
State Accepted
Headers show
Series [1/2] acpi: spcr: update the spcr tests to lastest revision 4 | expand

Commit Message

Ivan Hu July 31, 2023, 7:32 a.m. UTC
BugLink: https://bugs.launchpad.net/fwts/+bug/2028929

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/acpi/spcr/spcr.c        | 11 ++++++-----
 src/lib/include/fwts_acpi.h |  8 ++++++--
 2 files changed, 12 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/src/acpi/spcr/spcr.c b/src/acpi/spcr/spcr.c
index fd45eb6c..b58aecd4 100644
--- a/src/acpi/spcr/spcr.c
+++ b/src/acpi/spcr/spcr.c
@@ -92,8 +92,8 @@  static int spcr_test1(fwts_framework *fw)
 	bool passed = true;
 
 	/*
-	 * Assuming revision 2, full list from
-	 * http://go.microsoft.com/fwlink/p/?LinkId=234837)
+	 * Current revision 4, full list from
+	 * https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table
 	 */
 	switch (spcr->interface_type) {
 	case 0x00:
@@ -181,7 +181,7 @@  static int spcr_test1(fwts_framework *fw)
 	reserved1 = spcr->reserved1[0] + (spcr->reserved1[1] << 8) + (spcr->reserved1[2] << 16);
 	fwts_acpi_reserved_zero("SPCR", "Reserved1", reserved1, &passed);
 
-	if (spcr->interrupt_type & 0xf0) {
+	if (spcr->interrupt_type & 0xe0) {
 		passed = false;
 		fwts_failed(fw, LOG_LEVEL_HIGH,
 			"SPCRIllegalReservedInterruptType",
@@ -266,7 +266,7 @@  static int spcr_test1(fwts_framework *fw)
 			" is a reserved terminal type", spcr->terminal_type);
 	}
 
-	fwts_acpi_reserved_zero("SPCR", "Reserved2", spcr->reserved2, &passed);
+	fwts_acpi_reserved_zero("SPCR", "Language", spcr->language, &passed);
 
 	/* According to the spec, these values indicate NOT a PCI device */
 	if ((spcr->pci_device_id == 0xffff) &&
@@ -305,7 +305,8 @@  static int spcr_test1(fwts_framework *fw)
 	}
 
 	fwts_acpi_reserved_bits("SPCR", "PCI Flags", spcr->pci_flags, 1, 31, &passed);
-	fwts_acpi_reserved_zero("SPCR", "Reserved3", spcr->reserved3, &passed);
+	if (spcr->header.revision <= 2)
+		fwts_acpi_reserved_zero("SPCR", "Reserved3", spcr->uart_clock_freq, &passed);
 
 	if (passed)
 		fwts_passed(fw, "No issues found in SPCR table.");
diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
index 8b85fac2..eb958b0e 100644
--- a/src/lib/include/fwts_acpi.h
+++ b/src/lib/include/fwts_acpi.h
@@ -1669,7 +1669,7 @@  typedef struct {
 	uint8_t		stop_bits;
 	uint8_t		flow_control;
 	uint8_t		terminal_type;
-	uint8_t		reserved2;
+	uint8_t		language;
 	uint16_t	pci_device_id;
 	uint16_t	pci_vendor_id;
 	uint8_t		pci_bus_number;
@@ -1677,7 +1677,11 @@  typedef struct {
 	uint8_t		pci_function_number;
 	uint32_t	pci_flags;
 	uint8_t		pci_segment;
-	uint32_t	reserved3;
+	uint32_t	uart_clock_freq;
+	uint32_t	precise_baud_rate;
+	uint16_t	namespace_str_length;
+	uint16_t	namespace_str_offset;
+	char		namespace_str[0];
 } __attribute__ ((packed)) fwts_acpi_table_spcr;
 
 /*