[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 07/25] dt: add helper for phandle allocation
From: |
Scott Wood |
Subject: |
Re: [Qemu-devel] [PATCH 07/25] dt: add helper for phandle allocation |
Date: |
Thu, 31 May 2012 17:28:39 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
On 05/30/2012 06:00 AM, Alexander Graf wrote:
> 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 d4f1f0a..317bdd0 100644
> --- a/device_tree.c
> +++ b/device_tree.c
> @@ -220,6 +220,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++;
> +}
An external configuration tool may want to use dumpdtb/dtb to merge in
nodes from other sources (e.g. the host device tree), which may have
unchangeable phandles that conflict with these.
It would be nice if the starting point could be overridden on the
command line. This can be a TODO for later, of course.
-Scott
- Re: [Qemu-devel] [PATCH 15/25] PPC: e500: dt: create /soc8544 node dynamically, (continued)
[Qemu-devel] [PATCH 07/25] dt: add helper for phandle allocation, Alexander Graf, 2012/05/30
- Re: [Qemu-devel] [PATCH 07/25] dt: add helper for phandle allocation,
Scott Wood <=
[Qemu-devel] [PATCH 18/25] PPC: e500: dt: create global-utils node dynamically, Alexander Graf, 2012/05/30
[Qemu-devel] [PATCH 11/25] PPC: e500: dt: create /cpus node dynamically, Alexander Graf, 2012/05/30
[Qemu-devel] [PATCH 13/25] PPC: e500: dt: create / node dynamically, Alexander Graf, 2012/05/30
[Qemu-devel] [PATCH 14/25] PPC: e500: dt: create /chosen node dynamically, Alexander Graf, 2012/05/30
[Qemu-devel] [PATCH 22/25] PPC: e500: dt: use 64bit cell helper, Alexander Graf, 2012/05/30
[Qemu-devel] [PATCH 06/25] dt: add helper for empty dt creation, Alexander Graf, 2012/05/30