mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
xen/dt: Extract helper to map nodes to module kinds
This will be required later by x86 code in order to do early identification of boot modules when booting off a DTB. Not a functional change. Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
1 parent
7fa7cb95dc
commit
ae96841fff
3 files changed
+26
-15
No files matched your search
@@ -5,6 +5,24 @@
|
||||
#include <xen/libfdt/libfdt.h>
|
||||
#include <xen/unaligned.h>
|
||||
|
||||
boot_module_kind __init fdt_node_to_kind(const void *fdt, int node)
|
||||
{
|
||||
if ( fdt_node_check_compatible(fdt, node, "xen,linux-zimage") == 0 ||
|
||||
fdt_node_check_compatible(fdt, node, "multiboot,kernel") == 0 )
|
||||
return BOOTMOD_KERNEL;
|
||||
if ( fdt_node_check_compatible(fdt, node, "xen,linux-initrd") == 0 ||
|
||||
fdt_node_check_compatible(fdt, node, "multiboot,ramdisk") == 0 )
|
||||
return BOOTMOD_RAMDISK;
|
||||
if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") == 0 )
|
||||
return BOOTMOD_XSM_POLICY;
|
||||
if ( fdt_node_check_compatible(fdt, node, "multiboot,device-tree") == 0 )
|
||||
return BOOTMOD_GUEST_DTB;
|
||||
if ( fdt_node_check_compatible(fdt, node, "multiboot,microcode") == 0 )
|
||||
return BOOTMOD_MICROCODE;
|
||||
|
||||
return BOOTMOD_UNKNOWN;
|
||||
}
|
||||
|
||||
void __init device_tree_get_reg(const __be32 **cell, uint32_t address_cells,
|
||||
uint32_t size_cells, paddr_t *start,
|
||||
paddr_t *size)
|
||||
|
||||
@@ -237,21 +237,7 @@ static void __init process_multiboot_node(const void *fdt, int node,
|
||||
|
||||
cell = (const __be32 *)prop->data;
|
||||
device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
|
||||
|
||||
if ( fdt_node_check_compatible(fdt, node, "xen,linux-zimage") == 0 ||
|
||||
fdt_node_check_compatible(fdt, node, "multiboot,kernel") == 0 )
|
||||
kind = BOOTMOD_KERNEL;
|
||||
else if ( fdt_node_check_compatible(fdt, node, "xen,linux-initrd") == 0 ||
|
||||
fdt_node_check_compatible(fdt, node, "multiboot,ramdisk") == 0 )
|
||||
kind = BOOTMOD_RAMDISK;
|
||||
else if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") == 0 )
|
||||
kind = BOOTMOD_XSM_POLICY;
|
||||
else if ( fdt_node_check_compatible(fdt, node, "multiboot,device-tree") == 0 )
|
||||
kind = BOOTMOD_GUEST_DTB;
|
||||
else if ( fdt_node_check_compatible(fdt, node, "multiboot,microcode") == 0 )
|
||||
kind = BOOTMOD_MICROCODE;
|
||||
else
|
||||
kind = BOOTMOD_UNKNOWN;
|
||||
kind = fdt_node_to_kind(fdt, node);
|
||||
|
||||
/**
|
||||
* Guess the kind of these first two unknowns respectively:
|
||||
|
||||
@@ -157,4 +157,11 @@ u32 device_tree_get_u32(const void *fdt, int node,
|
||||
void device_tree_get_reg(const __be32 **cell, uint32_t address_cells,
|
||||
uint32_t size_cells, paddr_t *start, paddr_t *size);
|
||||
|
||||
/*
|
||||
* Probe an FDT node thought to be a boot module to identify its kind.
|
||||
*
|
||||
* If correctly identified, returns the detected kind, otherwise BOOTMOD_UNKNOWN
|
||||
*/
|
||||
boot_module_kind fdt_node_to_kind(const void *fdt, int node);
|
||||
|
||||
#endif /* XEN_BOOTFDT_H */
|
||||