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

Xiang W posted 1 patch 2 days, 7 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260528094352.177947-1-wangxiang@iscas.ac.cn
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <anisinha@redhat.com>
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(-)
[PATCH] hw/acpi: Fix Terminal Type and Language field order in SPCR table
Posted by Xiang W 2 days, 7 hours ago
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

Signed-off-by: Xiang W <wangxiang@iscas.ac.cn>
---
 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(-)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 7edc8aed42..2adf2810c3 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -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 */
diff --git a/tests/data/acpi/loongarch64/virt/SPCR b/tests/data/acpi/loongarch64/virt/SPCR
index 3cc9bbcfb8051e632592d9db0fe3dba0af53ed8d..7bb819cd0d2ad20269e40e4a738709a45260cbb2 100644
GIT binary patch
delta 23
TcmWFtm|!Qw%<vxw7?1z}S|J61

delta 23
TcmWFtm|!Qw!2BNw7?1z}S{?;}

diff --git a/tests/data/acpi/riscv64/virt/SPCR b/tests/data/acpi/riscv64/virt/SPCR
index 09617f8793a6f7b1f08172f735b58aa748671540..59d2c8f7f215a604612cbd0294c18bc6301e208a 100644
GIT binary patch
delta 10
Rcma!wnqbGo%rMbG3IGpM0&@TW

delta 10
Rcma!wnqbGoz&z1G3IGpJ0&@TW

-- 
2.47.3