From 0208ba74c59cc9d4508689c9642efb010989eea8 Mon Sep 17 00:00:00 2001 From: Xiaojuan Yang Date: Thu, 10 Nov 2022 14:14:40 +0800 Subject: [PATCH 1/3] hw/loongarch: Add default stdout uart in fdt Add "chosen" subnode into LoongArch fdt, and set it's "stdout-path" prop to uart node. Signed-off-by: Xiaojuan Yang Reviewed-by: Song Gao Message-Id: <20221115114923.3372414-1-yangxiaojuan@loongson.cn> Signed-off-by: Song Gao --- hw/loongarch/virt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index 5136940b0b..b9c18ee517 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -69,6 +69,7 @@ static void fdt_add_uart_node(LoongArchMachineState *lams) qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", "ns16550a"); qemu_fdt_setprop_cells(ms->fdt, nodename, "reg", 0x0, base, 0x0, size); qemu_fdt_setprop_cell(ms->fdt, nodename, "clock-frequency", 100000000); + qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path", nodename); g_free(nodename); } @@ -87,6 +88,7 @@ static void create_fdt(LoongArchMachineState *lams) "linux,dummy-loongson3"); qemu_fdt_setprop_cell(ms->fdt, "/", "#address-cells", 0x2); qemu_fdt_setprop_cell(ms->fdt, "/", "#size-cells", 0x2); + qemu_fdt_add_subnode(ms->fdt, "/chosen"); } static void fdt_add_cpu_nodes(const LoongArchMachineState *lams) From e8c8203e55765a73a1d51c99406777b6eb45b2e9 Mon Sep 17 00:00:00 2001 From: Xiaojuan Yang Date: Wed, 16 Nov 2022 11:49:35 +0800 Subject: [PATCH 2/3] hw/loongarch: Fix setprop_sized method in fdt rtc node. Fix setprop_sized method in fdt rtc node. Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Reviewed-by: Song Gao Message-Id: <20221116040300.3459818-1-yangxiaojuan@loongson.cn> Signed-off-by: Song Gao --- hw/loongarch/virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index b9c18ee517..958be74fa1 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -53,7 +53,7 @@ static void fdt_add_rtc_node(LoongArchMachineState *lams) nodename = g_strdup_printf("/rtc@%" PRIx64, base); qemu_fdt_add_subnode(ms->fdt, nodename); qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", "loongson,ls7a-rtc"); - qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", 0x0, base, size); + qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", 2, base, 2, size); g_free(nodename); } From 4451cc4653babf90b1808597f3f1dc71e1f63def Mon Sep 17 00:00:00 2001 From: Xiaojuan Yang Date: Thu, 10 Nov 2022 14:54:16 +0800 Subject: [PATCH 3/3] hw/loongarch: Replace the value of uart info with macro Using macro to replace the value of uart info such as addr, size in acpi_build method. Signed-off-by: Xiaojuan Yang Reviewed-by: Song Gao Message-Id: <20221115115008.3372489-1-yangxiaojuan@loongson.cn> Signed-off-by: Song Gao --- hw/loongarch/acpi-build.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/loongarch/acpi-build.c b/hw/loongarch/acpi-build.c index 68dfb9f88a..7d5f5a757d 100644 --- a/hw/loongarch/acpi-build.c +++ b/hw/loongarch/acpi-build.c @@ -226,7 +226,8 @@ static void build_uart_device_aml(Aml *table) aml_append(crs, aml_qword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, AML_NON_CACHEABLE, AML_READ_WRITE, - 0, 0x1FE001E0, 0x1FE001E7, 0, 0x8)); + 0, VIRT_UART_BASE, VIRT_UART_BASE + VIRT_UART_SIZE - 1, + 0, VIRT_UART_SIZE)); 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));