diff mbox series

hw/loongarch: Add default stdout uart in fdt

Message ID 20221115114923.3372414-1-yangxiaojuan@loongson.cn
State New
Headers show
Series hw/loongarch: Add default stdout uart in fdt | expand

Commit Message

Xiaojuan Yang Nov. 15, 2022, 11:49 a.m. UTC
Add "chosen" subnode into LoongArch fdt, and set it's
"stdout-path" prop to uart node.

Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn>
---
 hw/loongarch/virt.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

gaosong Nov. 22, 2022, 11:06 a.m. UTC | #1
在 2022/11/15 19:49, Xiaojuan Yang 写道:
> Add "chosen" subnode into LoongArch fdt, and set it's
> "stdout-path" prop to uart node.
>
> Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn>
> ---
>   hw/loongarch/virt.c | 2 ++
>   1 file changed, 2 insertions(+)
Reviewed-by: Song Gao <gaosong@loongson.cn>

Thanks.
Song Gao
> diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
> index 5e4c2790bf..b59c07972a 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)
diff mbox series

Patch

diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index 5e4c2790bf..b59c07972a 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)