|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH v3 11/24] ARM: fdt: Export and introduce new fdt functions
From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxx>
Introduce new api device_tree_type_matches() to check for
device type. Also export device_tree_get_u32() and
device_tree_node_compatible()
These functions are later used for parsing NUMA information.
Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxx>
---
v3: Export device_tree_node_compatible() instead of
device_tree_node_matches()
---
xen/arch/arm/bootfdt.c | 20 ++++++++++++++++----
xen/include/asm-arm/setup.h | 5 +++++
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
index ea188a0..6e8251b 100644
--- a/xen/arch/arm/bootfdt.c
+++ b/xen/arch/arm/bootfdt.c
@@ -31,8 +31,8 @@ static bool_t __init device_tree_node_matches(const void
*fdt, int node,
&& (name[match_len] == '@' || name[match_len] == '\0');
}
-static bool_t __init device_tree_node_compatible(const void *fdt, int node,
- const char *match)
+bool_t __init device_tree_node_compatible(const void *fdt, int node,
+ const char *match)
{
int len, l;
int mlen;
@@ -62,8 +62,20 @@ static void __init device_tree_get_reg(const __be32 **cell,
u32 address_cells,
*size = dt_next_cell(size_cells, cell);
}
-static u32 __init device_tree_get_u32(const void *fdt, int node,
- const char *prop_name, u32 dflt)
+bool_t __init device_tree_type_matches(const void *fdt, int node,
+ const char *match)
+{
+ const void *prop;
+
+ prop = fdt_getprop(fdt, node, "device_type", NULL);
+ if ( prop == NULL )
+ return 0;
+
+ return strcmp(prop, match) == 0 ? 1 : 0;
+}
+
+u32 __init device_tree_get_u32(const void *fdt, int node,
+ const char *prop_name, u32 dflt)
{
const struct fdt_property *prop;
diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h
index 7ff2c34..fb78478 100644
--- a/xen/include/asm-arm/setup.h
+++ b/xen/include/asm-arm/setup.h
@@ -83,6 +83,11 @@ struct bootmodule *add_boot_module(bootmodule_kind kind,
struct bootmodule *boot_module_find_by_kind(bootmodule_kind kind);
const char * __init boot_module_kind_as_string(bootmodule_kind kind);
+u32 device_tree_get_u32(const void *fdt, int node, const char *prop_name,
+ u32 dflt);
+bool_t device_tree_type_matches(const void *fdt, int node, const char *match);
+bool_t device_tree_node_compatible(const void *fdt, int node,
+ const char *match);
#endif
/*
* Local variables:
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |