[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 2/3] hw/acpi: Upgrade ACPI SPCR table to support SPCR tabl
From: |
Sunil V L |
Subject: |
Re: [PATCH v3 2/3] hw/acpi: Upgrade ACPI SPCR table to support SPCR table version 4 format |
Date: |
Mon, 19 Aug 2024 09:39:53 +0530 |
Hi Jee Heng,
On Mon, Aug 12, 2024 at 10:22:22PM -0700, Sia Jee Heng wrote:
> Update the SPCR table to accommodate the SPCR Table version 4 [1].
> The SPCR table has been modified to adhere to the version 4 format [2].
>
> [1]:
> https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table
> [2]: https://github.com/acpica/acpica/pull/931
>
> Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
> Acked-by: Alistair Francis <alistair.francis@wdc.com>
> ---
> hw/acpi/aml-build.c | 14 +++++++++++---
> hw/arm/virt-acpi-build.c | 10 ++++++++--
> hw/riscv/virt-acpi-build.c | 12 +++++++++---
> include/hw/acpi/acpi-defs.h | 7 +++++--
> include/hw/acpi/aml-build.h | 2 +-
> 5 files changed, 34 insertions(+), 11 deletions(-)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index 6d4517cfbe..7c43573eef 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -1996,7 +1996,7 @@ static void build_processor_hierarchy_node(GArray *tbl,
> uint32_t flags,
>
> void build_spcr(GArray *table_data, BIOSLinker *linker,
> const AcpiSpcrData *f, const uint8_t rev,
> - const char *oem_id, const char *oem_table_id)
> + const char *oem_id, const char *oem_table_id, const char
> *name)
> {
> AcpiTable table = { .sig = "SPCR", .rev = rev, .oem_id = oem_id,
> .oem_table_id = oem_table_id };
> @@ -2042,8 +2042,16 @@ void build_spcr(GArray *table_data, BIOSLinker *linker,
> build_append_int_noprefix(table_data, f->pci_flags, 4);
> /* PCI Segment */
> build_append_int_noprefix(table_data, f->pci_segment, 1);
> - /* Reserved */
> - build_append_int_noprefix(table_data, 0, 4);
> + /* UartClkFreq */
> + build_append_int_noprefix(table_data, f->uart_clk_freq, 4);
> + /* PreciseBaudrate */
> + build_append_int_noprefix(table_data, f->precise_baudrate, 4);
> + /* NameSpaceStringLength */
> + build_append_int_noprefix(table_data, f->namespace_string_length, 2);
> + /* NameSpaceStringOffset */
> + build_append_int_noprefix(table_data, f->namespace_string_offset, 2);
> + /* NamespaceString[] */
> + g_array_append_vals(table_data, name, f->namespace_string_length);
>
> acpi_table_end(linker, &table);
> }
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index e10cad86dd..ae075dc9fd 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -435,11 +435,12 @@ build_iort(GArray *table_data, BIOSLinker *linker,
> VirtMachineState *vms)
>
> /*
> * Serial Port Console Redirection Table (SPCR)
> - * Rev: 1.07
> + * Rev: 1.10
> */
> static void
> spcr_setup(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
> {
> + const char name[] = ".";
> AcpiSpcrData serial = {
> .interface_type = 3, /* ARM PL011 UART */
> .base_addr.id = AML_AS_SYSTEM_MEMORY,
> @@ -463,9 +464,14 @@ spcr_setup(GArray *table_data, BIOSLinker *linker,
> VirtMachineState *vms)
> .pci_function = 0,
> .pci_flags = 0,
> .pci_segment = 0,
> + .uart_clk_freq = 0,
> + .precise_baudrate = 0,
> + .namespace_string_length = sizeof(name),
> + .namespace_string_offset = 88,
> };
>
> - build_spcr(table_data, linker, &serial, 2, vms->oem_id,
> vms->oem_table_id);
> + build_spcr(table_data, linker, &serial, 4, vms->oem_id,
> vms->oem_table_id,
> + name);
I request the same which I had asked earlier. Please keep SPCR for other
architectures like ARM intact. The latest revision is primarily required
for RISC-V. So, restrict the series only for RISC-V. The common
build_spcr() should create SPCR based on the revision parameter.
Thanks,
Sunil