[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 07/31] dt: add helper for phandle allocation
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 07/31] dt: add helper for phandle allocation |
Date: |
Tue, 19 Jun 2012 21:15:00 +0200 |
Phandle references work by having 2 pieces:
- a "phandle" 1-cell property in the device tree node
- a reference to the same value in a property we want to point
to the other node
To generate the 1-cell property, we need an allocation mechanism that
gives us a unique number space. This patch adds an allocator for these
properties.
Signed-off-by: Alexander Graf <address@hidden>
---
device_tree.c | 7 +++++++
device_tree.h | 1 +
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/device_tree.c b/device_tree.c
index d037896..7541274 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -191,6 +191,13 @@ int qemu_devtree_setprop_phandle(void *fdt, const char
*node_path,
return qemu_devtree_setprop_cell(fdt, node_path, property, phandle);
}
+uint32_t qemu_devtree_alloc_phandle(void *fdt)
+{
+ static int phandle = 0x8000;
+
+ return phandle++;
+}
+
int qemu_devtree_nop_node(void *fdt, const char *node_path)
{
int r;
diff --git a/device_tree.h b/device_tree.h
index 5f76f40..97af345 100644
--- a/device_tree.h
+++ b/device_tree.h
@@ -27,6 +27,7 @@ int qemu_devtree_setprop_phandle(void *fdt, const char
*node_path,
const char *property,
const char *target_node_path);
uint32_t qemu_devtree_get_phandle(void *fdt, const char *path);
+uint32_t qemu_devtree_alloc_phandle(void *fdt);
int qemu_devtree_nop_node(void *fdt, const char *node_path);
int qemu_devtree_add_subnode(void *fdt, const char *name);
--
1.6.0.2
- [Qemu-ppc] [PATCH 06/31] dt: add helper for empty dt creation, (continued)
- [Qemu-ppc] [PATCH 06/31] dt: add helper for empty dt creation, Alexander Graf, 2012/06/19
- [Qemu-ppc] [PATCH 09/31] PPC: e500: require libfdt, Alexander Graf, 2012/06/19
- [Qemu-ppc] [PATCH 03/31] dt: add helper for phandle references, Alexander Graf, 2012/06/19
- [Qemu-ppc] [PATCH 05/31] dt: add helper for phandle enumeration, Alexander Graf, 2012/06/19
- [Qemu-ppc] [PATCH 02/31] dt: add helpers for multi-cell adds, Alexander Graf, 2012/06/19
- [Qemu-ppc] [PATCH 15/31] PPC: e500: dt: create /soc8544 node dynamically, Alexander Graf, 2012/06/19
- [Qemu-ppc] [PATCH 12/31] PPC: e500: dt: create /hypervisor node dynamically, Alexander Graf, 2012/06/19
- [Qemu-ppc] [PATCH 04/31] dt: temporarily disable subtree creation failure check, Alexander Graf, 2012/06/19
- [Qemu-ppc] [PATCH 22/31] PPC: e500: dt: use 64bit cell helper, Alexander Graf, 2012/06/19
- [Qemu-ppc] [PATCH 18/31] PPC: e500: dt: create global-utils node dynamically, Alexander Graf, 2012/06/19
- [Qemu-ppc] [PATCH 07/31] dt: add helper for phandle allocation,
Alexander Graf <=
- [Qemu-ppc] [PATCH 01/31] dt: allow add_subnode to create root subnodes, Alexander Graf, 2012/06/19
- [Qemu-ppc] [PATCH 21/31] dt: Add -machine dumpdtb option to dump the current dtb, Alexander Graf, 2012/06/19
- [Qemu-ppc] [PATCH 17/31] PPC: e500: dt: create mpic node dynamically, Alexander Graf, 2012/06/19
- [Qemu-ppc] [PATCH 13/31] PPC: e500: dt: create / node dynamically, Alexander Graf, 2012/06/19
- [Qemu-ppc] [PATCH 11/31] PPC: e500: dt: create /cpus node dynamically, Alexander Graf, 2012/06/19
- [Qemu-ppc] [PATCH 23/31] PPC: e500: dt: use target_phys_addr_t for ramsize, Alexander Graf, 2012/06/19
- [Qemu-ppc] [PATCH 20/31] PPC: e500: dt: start with empty device tree, Alexander Graf, 2012/06/19
- [Qemu-ppc] [PATCH 25/31] Revert "dt: temporarily disable subtree creation failure check", Alexander Graf, 2012/06/19