Skip to contentSkip to conversation

hw/acpi: Fix Terminal Type and Language field order in SPCR table

PATCH Superseded Xiang W 2 participants 2 messages May 28 RISC-V

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Xiang W

author
#0 lore raw

PATCH 1/1 hw/acpi: Fix Terminal Type and Language field order in SPCR table

According to the ACPI Serial Port Console Redirection Table (SPCR) specification, the field order after Flow Control is:

- Terminal Type (offset 62, 1 byte)
- Language (offset 63, 1 byte)

Previously they were swapped in both:
- The table generation code (aml-build.c)
- The golden reference blobs

This fixes:
- hw/acpi/aml-build.c
- tests/data/acpi/riscv64/virt/SPCR
- tests/data/acpi/loongarch64/virt/SPCR

Reference:
https://learn.microsoft.com/en-us/windows-hardware/drivers/bringup/serial-port-console-redirection-table

---
 hw/acpi/aml-build.c                   |   4 ++--
 tests/data/acpi/loongarch64/virt/SPCR | Bin 80 -> 80 bytes
 tests/data/acpi/riscv64/virt/SPCR     | Bin 90 -> 90 bytes
 3 files changed, 2 insertions(+), 2 deletions(-)
hw/acpi/aml-build.c +2 -2
index 7edc8aed42..2adf2810c3 100644
@@ -2116,10 +2116,10 @@ void build_spcr(GArray *table_data, BIOSLinker *linker,
     build_append_int_noprefix(table_data, f->stop_bits, 1);
     /* Flow Control */
     build_append_int_noprefix(table_data, f->flow_control, 1);
-    /* Language */
-    build_append_int_noprefix(table_data, f->language, 1);
     /* Terminal Type */
     build_append_int_noprefix(table_data, f->terminal_type, 1);
+    /* Language */
+    build_append_int_noprefix(table_data, f->language, 1);
     /* PCI Device ID  */
     build_append_int_noprefix(table_data, f->pci_device_id, 2);
     /* PCI Vendor ID */
tests/data/acpi/loongarch64/virt/SPCR binary +0 -0
index 3cc9bbcfb8051e632592d9db0fe3dba0af53ed8d..7bb819cd0d2ad20269e40e4a738709a45260cbb2 100644
GIT binary patch
tests/data/acpi/riscv64/virt/SPCR binary +0 -0
index 09617f8793a6f7b1f08172f735b58aa748671540..59d2c8f7f215a604612cbd0294c18bc6301e208a 100644
GIT binary patch
Signature · 1 line
2.47.3
#1 lore raw
Quoted 19 lines · Xiang W

According to the ACPI Serial Port Console Redirection Table (SPCR) specification, the field order after Flow Control is:

- Terminal Type (offset 62, 1 byte)
- Language (offset 63, 1 byte)

Previously they were swapped in both:
- The table generation code (aml-build.c)
- The golden reference blobs

This fixes:
- hw/acpi/aml-build.c
- tests/data/acpi/riscv64/virt/SPCR
- tests/data/acpi/loongarch64/virt/SPCR

Reference:
https://learn.microsoft.com/en-us/windows-hardware/drivers/bringup/serial-port-console-redirection-table

Quoted 6 lines
---
 hw/acpi/aml-build.c                   |   4 ++--
 tests/data/acpi/loongarch64/virt/SPCR | Bin 80 -> 80 bytes
 tests/data/acpi/riscv64/virt/SPCR     | Bin 90 -> 90 bytes
 3 files changed, 2 insertions(+), 2 deletions(-)

The comment at the top of tests/qtest/bios-tables-test.c describes how to structure changes that affect the ACPI tables. You should have a multi-patch series that first disables the affected tests, then makes the changes, and finally updates the golden reference blobs, not a single patch that changes code and test blobs at once.

thanks
-- PMM