On Thu, 22 Oct 2026 15:22:36 +0800
pillow <[email protected]> wrote:
> The UART _DSD clock property contains a typo ("clock-frenquency")
> and has its key/value order reversed. It also specifies a 100 MHz
> clock, which does not match the emulated UART.
>
> QEMU's UART model uses baudbase = 115200, corresponding to a clock
> frequency of 1,843,200 Hz. The Linux 8250 PnP driver uses the same
> frequency by default when no clock is specified.
>
> Since the default already matches the UART model, there is no need
> to provide an explicit clock property. Drop it from _DSD, consistent
> with the existing x86 ISA serial ACPI implementation.
>
> Also remove _CCA because the emulated UART does not support DMA,
> and add _STA = 0x0f to indicate that the device is present,
> enabled, visible, and functioning.
>
> Signed-off-by: pillow <[email protected]>
> Reviewed-by: Bibo Mao <[email protected]>
do not put several different changes together
split it up on several patches
> ---
> hw/loongarch/virt-acpi-build.c | 12 +-----------
> 1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/hw/loongarch/virt-acpi-build.c b/hw/loongarch/virt-acpi-build.c
> index 54965f0..55c7641 100644
> --- a/hw/loongarch/virt-acpi-build.c
> +++ b/hw/loongarch/virt-acpi-build.c
> @@ -314,7 +314,6 @@ static void build_uart_device_aml(Aml *table, int index)
> {
> Aml *dev;
> Aml *crs;
> - Aml *pkg0, *pkg1, *pkg2;
> Aml *scope;
> uint32_t uart_irq;
> uint64_t base;
> @@ -325,7 +324,7 @@ static void build_uart_device_aml(Aml *table, int index)
> dev = aml_device("COM%d", index);
> aml_append(dev, aml_name_decl("_HID", aml_string("PNP0501")));
> aml_append(dev, aml_name_decl("_UID", aml_int(index)));
> - aml_append(dev, aml_name_decl("_CCA", aml_int(1)));
> + aml_append(dev, aml_name_decl("_STA", aml_int(0x0f)));
> crs = aml_resource_template();
> aml_append(crs,
> aml_qword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED,
> @@ -335,15 +334,6 @@ static void build_uart_device_aml(Aml *table, int index)
> aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> AML_SHARED, &uart_irq, 1));
> aml_append(dev, aml_name_decl("_CRS", crs));
> - pkg0 = aml_package(0x2);
> - aml_append(pkg0, aml_int(0x05F5E100));
> - aml_append(pkg0, aml_string("clock-frenquency"));
> - pkg1 = aml_package(0x1);
> - aml_append(pkg1, pkg0);
> - pkg2 = aml_package(0x2);
> - aml_append(pkg2, aml_touuid("DAFFD814-6EBA-4D8C-8A91-BC9BBF4AA301"));
> - aml_append(pkg2, pkg1);
> - aml_append(dev, aml_name_decl("_DSD", pkg2));
> aml_append(scope, dev);
> aml_append(table, scope);
> }