[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 26/64] device tree: add add_subnode command
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 26/64] device tree: add add_subnode command |
Date: |
Thu, 6 Oct 2011 10:05:28 +0200 |
We want to be able to create subnodes in our device tree, so export it through
the qemu device tree abstraction framework.
Signed-off-by: Alexander Graf <address@hidden>
---
device_tree.c | 24 ++++++++++++++++++++++++
device_tree.h | 1 +
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/device_tree.c b/device_tree.c
index 23e89e3..f4a78c8 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -118,3 +118,27 @@ int qemu_devtree_nop_node(void *fdt, const char *node_path)
return fdt_nop_node(fdt, offset);
}
+
+int qemu_devtree_add_subnode(void *fdt, const char *name)
+{
+ int offset;
+ char *dupname = g_strdup(name);
+ char *basename = strrchr(dupname, '/');
+ int retval;
+
+ if (!basename) {
+ return -1;
+ }
+
+ basename[0] = '\0';
+ basename++;
+
+ offset = fdt_path_offset(fdt, dupname);
+ if (offset < 0) {
+ return offset;
+ }
+
+ retval = fdt_add_subnode(fdt, offset, basename);
+ g_free(dupname);
+ return retval;
+}
diff --git a/device_tree.h b/device_tree.h
index 76fce5f..4378685 100644
--- a/device_tree.h
+++ b/device_tree.h
@@ -23,5 +23,6 @@ int qemu_devtree_setprop_cell(void *fdt, const char
*node_path,
int qemu_devtree_setprop_string(void *fdt, const char *node_path,
const char *property, const char *string);
int qemu_devtree_nop_node(void *fdt, const char *node_path);
+int qemu_devtree_add_subnode(void *fdt, const char *name);
#endif /* __DEVICE_TREE_H__ */
--
1.6.0.2
- [Qemu-ppc] [PATCH 62/64] pseries: Refactor spapr irq allocation, (continued)
- [Qemu-ppc] [PATCH 62/64] pseries: Refactor spapr irq allocation, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 22/64] PPC: E500: Update freqs for all CPUs, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 48/64] pseries: Implement hcall-bulk hypervisor interface, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 42/64] pseries: use macro for firmware filename, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 20/64] PPC: KVM: Remove kvmppc_read_host_property, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 32/64] PPC: Add new target config for pseries, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 61/64] PPC: Clean up BookE timer code, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 58/64] KVM: Update kernel headers, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 21/64] PPC: KVM: Add stubs for kvm helper functions, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 52/64] openpic: Unfold read_IRQreg, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 26/64] device tree: add add_subnode command,
Alexander Graf <=
- [Qemu-ppc] [PATCH 60/64] PPC: booke timers, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 23/64] PPC: E500: Remove unneeded CPU nodes, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 24/64] PPC: E500: Add PV spinning code, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 53/64] openpic: Unfold write_IRQreg, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 35/64] PPC: SPAPR: Use KVM function for time info, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 39/64] pseries: More complete WIMG validation in H_ENTER code, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 43/64] KVM: Update kernel headers, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 51/64] ppc405: use RAM_ADDR_FMT instead of %08lx, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 15/64] PPC: bamboo: Move host fdt copy to target, Alexander Graf, 2011/10/06
- [Qemu-ppc] [PATCH 57/64] KVM: Update kernel headers, Alexander Graf, 2011/10/06