[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v1 5/5] xen/riscv: map FDT



Except mapping of FDT, it is also printing command line passed by
a DTB and initialize bootinfo from a DTB.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
 xen/arch/riscv/riscv64/head.S |  3 +++
 xen/arch/riscv/setup.c        | 21 +++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S
index 3261e9fce8..22fb36a861 100644
--- a/xen/arch/riscv/riscv64/head.S
+++ b/xen/arch/riscv/riscv64/head.S
@@ -41,6 +41,9 @@ FUNC(start)
 
         jal     setup_initial_pagetables
 
+        mv      a0, s1
+        jal     fdt_map
+
         /* Calculate proper VA after jump from 1:1 mapping */
         la      a0, .L_primary_switched
         sub     a0, a0, s2
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 4f06203b46..b346956e06 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -1,7 +1,9 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#include <xen/bootfdt.h>
 #include <xen/bug.h>
 #include <xen/compile.h>
+#include <xen/device_tree.h>
 #include <xen/init.h>
 #include <xen/mm.h>
 
@@ -33,15 +35,34 @@ static void test_macros_from_bug_h(void)
     printk("WARN is most likely working\n");
 }
 
+void __init fdt_map(paddr_t dtb_addr)
+{
+    device_tree_flattened = early_fdt_map(dtb_addr);
+    if ( !device_tree_flattened )
+    {
+        printk("wrong FDT\n");
+        die();
+    }
+}
+
 void __init noreturn start_xen(unsigned long bootcpu_id,
                                paddr_t dtb_addr)
 {
+    size_t fdt_size;
+    const char *cmdline;
+
     remove_identity_mapping();
 
     trap_init();
 
     test_macros_from_bug_h();
 
+    fdt_size = boot_fdt_info(device_tree_flattened, dtb_addr);
+
+    cmdline = boot_fdt_cmdline(device_tree_flattened);
+    printk("Command line: %s\n", cmdline);
+    cmdline_parse(cmdline);
+
     printk("All set up\n");
 
     for ( ;; )
-- 
2.45.2




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.