From: gaosong <gaosong@loongson.cn>
To: Bibo Mao <maobibo@loongson.cn>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>,
qemu-devel@nongnu.org, "Jason A . Donenfeld" <Jason@zx2c4.com>
Subject: Re: [PATCH] hw/loongarch: Add acpi SPCR table support
Date: Mon, 9 Sep 2024 20:53:12 +0800 [thread overview]
Message-ID: <08e4eacd-bc37-13a7-e5db-a41168f02af0@loongson.cn> (raw)
In-Reply-To: <20240907073037.243353-1-maobibo@loongson.cn>
在 2024/9/7 下午3:30, Bibo Mao 写道:
> Serial port console redirection table can be used for default serial
> port selection, like chosen stdout-path selection with FDT method.
>
> With acpi SPCR table added, early debug console can be parsed from
> SPCR table with simple kernel parameter earlycon rather than
> earlycon=uart,mmio,0x1fe001e0
>
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
> hw/loongarch/acpi-build.c | 40 +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 40 insertions(+)
Reviewed-by: Song Gao <gaosong@loongson.cn>
Thanks
Song Gao
> diff --git a/hw/loongarch/acpi-build.c b/hw/loongarch/acpi-build.c
> index 2638f87434..3912c8d307 100644
> --- a/hw/loongarch/acpi-build.c
> +++ b/hw/loongarch/acpi-build.c
> @@ -241,6 +241,44 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
> acpi_table_end(linker, &table);
> }
>
> +/*
> + * Serial Port Console Redirection Table (SPCR)
> + * https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table
> + */
> +static void
> +spcr_setup(GArray *table_data, BIOSLinker *linker, MachineState *machine)
> +{
> + LoongArchVirtMachineState *lvms;
> + AcpiSpcrData serial = {
> + .interface_type = 0, /* 16550 compatible */
> + .base_addr.id = AML_AS_SYSTEM_MEMORY,
> + .base_addr.width = 32,
> + .base_addr.offset = 0,
> + .base_addr.size = 1,
> + .base_addr.addr = VIRT_UART_BASE,
> + .interrupt_type = 0, /* Interrupt not supported */
> + .pc_interrupt = 0,
> + .interrupt = VIRT_UART_IRQ,
> + .baud_rate = 7, /* 115200 */
> + .parity = 0,
> + .stop_bits = 1,
> + .flow_control = 0,
> + .terminal_type = 3, /* ANSI */
> + .language = 0, /* Language */
> + .pci_device_id = 0xffff, /* not a PCI device*/
> + .pci_vendor_id = 0xffff, /* not a PCI device*/
> + .pci_bus = 0,
> + .pci_device = 0,
> + .pci_function = 0,
> + .pci_flags = 0,
> + .pci_segment = 0,
> + };
> +
> + lvms = LOONGARCH_VIRT_MACHINE(machine);
> + build_spcr(table_data, linker, &serial, 2, lvms->oem_id,
> + lvms->oem_table_id);
> +}
> +
> typedef
> struct AcpiBuildState {
> /* Copy of table in RAM (for patching). */
> @@ -477,6 +515,8 @@ static void acpi_build(AcpiBuildTables *tables, MachineState *machine)
>
> acpi_add_table(table_offsets, tables_blob);
> build_srat(tables_blob, tables->linker, machine);
> + acpi_add_table(table_offsets, tables_blob);
> + spcr_setup(tables_blob, tables->linker, machine);
>
> if (machine->numa_state->num_nodes) {
> if (machine->numa_state->have_numa_distance) {
>
> base-commit: 7b87a25f49a301d3377f3e71e0b4a62540c6f6e4
prev parent reply other threads:[~2024-09-09 12:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-07 7:30 [PATCH] hw/loongarch: Add acpi SPCR table support Bibo Mao
2024-09-09 12:53 ` gaosong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=08e4eacd-bc37-13a7-e5db-a41168f02af0@loongson.cn \
--to=gaosong@loongson.cn \
--cc=Jason@zx2c4.com \
--cc=jiaxun.yang@flygoat.com \
--cc=maobibo@loongson.cn \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).