xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ARM/multiboot: use more flexible node naming
@ 2013-09-11 14:06 Andre Przywara
  2013-09-17 14:53 ` Ian Campbell
  0 siblings, 1 reply; 7+ messages in thread
From: Andre Przywara @ 2013-09-11 14:06 UTC (permalink / raw)
  To: julien.grall, Ian.Campbell; +Cc: stefano.stabellini, xen-devel

For the current "multiboot" on ARM support we look for a compatible
string of "xen,multiboot-module" in the device tree, and then
use "xen,linux-zimage" and "xen,linux-initrd" to differentiate
between the two supported module types.
To meet the more generic multiboot proposal in the device tree [1],
allow Xen to be more flexible in the compatible naming and also use
the new generic base name "boot,module".
The mapping to either Dom0 kernel or RAM disk works by providing a
more specific name ("xen,dom0-kernel" and "xen,ramdisk", preferably).
For compatibility reasons the older names above are still recognized.

Changes from v1:
* whitespace / coding style fixes (sorry for that mess!)
* removed module enumeration by using module@address
  (this violates the EPAPR device tree spec).
* added __initconst to names array

[1] http://lists.xen.org/archives/html/xen-devel/2013-09/msg00083.html

Signed-off-by: Andre Przywara <andre.przywara@linaro.org>
---
 xen/common/device_tree.c | 44 +++++++++++++++++++++++++++++++++++++-------
 1 file changed, 37 insertions(+), 7 deletions(-)

diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
index eed77ce..3ae593f 100644
--- a/xen/common/device_tree.c
+++ b/xen/common/device_tree.c
@@ -433,22 +433,50 @@ static void __init process_cpu_node(const void *fdt, int node,
     cpumask_set_cpu(start, &cpu_possible_map);
 }
 
+static const char * const __initconst kernel_module_names[] = {
+    "xen,linux-zimage",
+    "xen,dom0-kernel",
+    "boot,kernel",
+    NULL
+};
+
+static const char * const __initconst initrd_module_names[] = {
+    "xen,linux-initrd",
+    "xen,ramdisk",
+    "boot,ramdisk",
+    NULL
+};
+
 static void __init process_multiboot_node(const void *fdt, int node,
                                           const char *name,
                                           u32 address_cells, u32 size_cells)
 {
     const struct fdt_property *prop;
     const u32 *cell;
-    int nr;
+    int nr = -1;
     struct dt_mb_module *mod;
     int len;
+    const char* const * name_list;
 
-    if ( fdt_node_check_compatible(fdt, node, "xen,linux-zimage") == 0 )
-        nr = MOD_KERNEL;
-    else if ( fdt_node_check_compatible(fdt, node, "xen,linux-initrd") == 0)
-        nr = MOD_INITRD;
-    else
-        early_panic("%s not a known xen multiboot type\n", name);
+    for ( name_list = kernel_module_names; *name_list != NULL; name_list++ )
+        if ( fdt_node_check_compatible(fdt, node, *name_list) == 0 )
+        {
+            nr = MOD_KERNEL;
+            break;
+        }
+
+    for ( name_list = initrd_module_names; *name_list != NULL; name_list++ )
+        if ( fdt_node_check_compatible(fdt, node, *name_list) == 0 )
+        {
+            nr = MOD_INITRD;
+            break;
+        }
+
+    if ( nr == -1 )
+    {
+        early_printk("warning: %s not a known module type, ignoring\n", name);
+        return;
+    }
 
     mod = &early_info.modules.module[nr];
 
@@ -486,6 +514,8 @@ static int __init early_scan_node(const void *fdt,
         process_cpu_node(fdt, node, name, address_cells, size_cells);
     else if ( device_tree_node_compatible(fdt, node, "xen,multiboot-module" ) )
         process_multiboot_node(fdt, node, name, address_cells, size_cells);
+    else if ( device_tree_node_compatible(fdt, node, "boot,module" ) )
+        process_multiboot_node(fdt, node, name, address_cells, size_cells);
 
     return 0;
 }
-- 
1.7.12.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-09-18  9:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-11 14:06 [PATCH v2] ARM/multiboot: use more flexible node naming Andre Przywara
2013-09-17 14:53 ` Ian Campbell
2013-09-17 15:06   ` Julien Grall
2013-09-17 15:09     ` Ian Campbell
2013-09-17 21:12   ` Andre Przywara
2013-09-17 22:12     ` Ian Campbell
2013-09-18  9:36       ` Egger, Christoph

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).