* generating a phandle w/libfdt?
@ 2008-10-24 13:11 Kumar Gala
[not found] ` <4BE3ADDA-362B-43AE-8D05-11260B94CD13-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: Kumar Gala @ 2008-10-24 13:11 UTC (permalink / raw)
To: devicetree-discuss
In some work I'm doing I noticed we don't have any APIs to generate a
phandle via libfdt.
was wondering if anyone had ideas on this.
In first thought it seems we have to scan through the whole blob
looking for the largest phandle id and than +1 it to generate the next
"valid" id. Any other ideas on how to do this more efficiently?
- k
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: generating a phandle w/libfdt?
[not found] ` <4BE3ADDA-362B-43AE-8D05-11260B94CD13-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
@ 2008-10-24 14:18 ` Kumar Gala
[not found] ` <DEE70934-6A37-4439-B27E-FC3ABF75BF24-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2008-10-26 23:44 ` David Gibson
1 sibling, 1 reply; 16+ messages in thread
From: Kumar Gala @ 2008-10-24 14:18 UTC (permalink / raw)
To: devicetree-discuss
On Oct 24, 2008, at 8:11 AM, Kumar Gala wrote:
> In some work I'm doing I noticed we don't have any APIs to generate
> a phandle via libfdt.
>
> was wondering if anyone had ideas on this.
>
> In first thought it seems we have to scan through the whole blob
> looking for the largest phandle id and than +1 it to generate the
> next "valid" id. Any other ideas on how to do this more efficiently?
The other question is there a way today to create a phandle even if
there isn't a reference to it elsewhere in a .dts?
- k
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: generating a phandle w/libfdt?
[not found] ` <DEE70934-6A37-4439-B27E-FC3ABF75BF24-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
@ 2008-10-24 15:15 ` Jimi Xenidis
[not found] ` <2D630F2F-4AA2-4537-89FE-80B2DDFADDEE-aZOuKsOsJu3MbYB6QlFGEg@public.gmane.org>
2008-10-24 16:29 ` Yoder Stuart
1 sibling, 1 reply; 16+ messages in thread
From: Jimi Xenidis @ 2008-10-24 15:15 UTC (permalink / raw)
To: Kumar Gala; +Cc: devicetree-discuss
On Oct 24, 2008, at 9:18 AM, Kumar Gala wrote:
>
> On Oct 24, 2008, at 8:11 AM, Kumar Gala wrote:
>
>> In some work I'm doing I noticed we don't have any APIs to generate
>> a phandle via libfdt.
>>
>> was wondering if anyone had ideas on this.
>>
>> In first thought it seems we have to scan through the whole blob
>> looking for the largest phandle id and than +1 it to generate the
>> next "valid" id. Any other ideas on how to do this more efficiently?
>
> The other question is there a way today to create a phandle even if
> there isn't a reference to it elsewhere in a .dts?
>
Well, then by definition, it is not a phandle, right?
If nothing references it then I'm not sure how you can reconcile the
number when some SW layer builds the next version of it to pass on up.
It sounds like you need a separate numerical space.
Just a shot in that dark to see if your actual problem is similar...
I'm expecting us to hit something like this _hard_ when we try to fit
runtime FW into ePAPR, like IBM's RTAS layer, where the devtree can go
through several generations but we need to hang on to the _original_
phandle for a node from the time that the RTAS was instantiated. In
server we use "ibm,phandle" for this.
-JX
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: generating a phandle w/libfdt?
[not found] ` <DEE70934-6A37-4439-B27E-FC3ABF75BF24-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2008-10-24 15:15 ` Jimi Xenidis
@ 2008-10-24 16:29 ` Yoder Stuart
[not found] ` <9696D7A991D0824DBA8DFAC74A9C5FA3047947A3-ofAVchDyotYzzZk0BCvKg5jmvxFtTJ+o0e7PPNI6Mm0@public.gmane.org>
1 sibling, 1 reply; 16+ messages in thread
From: Yoder Stuart @ 2008-10-24 16:29 UTC (permalink / raw)
To: Kumar Gala, devicetree-discuss
> -----Original Message-----
> From:
> devicetree-discuss-bounces+stuart.yoder=freescale.com@ozlabs.o
> rg
> [mailto:devicetree-discuss-bounces+stuart.yoder=freescale.com@
ozlabs.org] On Behalf Of Kumar Gala
> Sent: Friday, October 24, 2008 9:19 AM
> To: devicetree-discuss
> Subject: Re: generating a phandle w/libfdt?
>
>
> On Oct 24, 2008, at 8:11 AM, Kumar Gala wrote:
>
> > In some work I'm doing I noticed we don't have any APIs to
> generate
> > a phandle via libfdt.
> >
> > was wondering if anyone had ideas on this.
> >
> > In first thought it seems we have to scan through the whole blob
> > looking for the largest phandle id and than +1 it to generate the
> > next "valid" id. Any other ideas on how to do this more
> efficiently?
>
> The other question is there a way today to create a phandle even if
> there isn't a reference to it elsewhere in a .dts?
We had this issue and the 'hack' was to create a phandle property
in the node itself, so it was self-referenced. That caused DTC
to allocate a phandle. We then could reference the node from
dynamically generated nodes.
Stuart
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: generating a phandle w/libfdt?
[not found] ` <9696D7A991D0824DBA8DFAC74A9C5FA3047947A3-ofAVchDyotYzzZk0BCvKg5jmvxFtTJ+o0e7PPNI6Mm0@public.gmane.org>
@ 2008-10-26 23:40 ` David Gibson
[not found] ` <20081026234052.GB22339-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: David Gibson @ 2008-10-26 23:40 UTC (permalink / raw)
To: Yoder Stuart; +Cc: devicetree-discuss
On Fri, Oct 24, 2008 at 09:29:21AM -0700, Yoder Stuart wrote:
>
>
> > -----Original Message-----
> > From:
> > devicetree-discuss-bounces+stuart.yoder=freescale.com@ozlabs.o
> > rg
> > [mailto:devicetree-discuss-bounces+stuart.yoder=freescale.com@
> ozlabs.org] On Behalf Of Kumar Gala
> > Sent: Friday, October 24, 2008 9:19 AM
> > To: devicetree-discuss
> > Subject: Re: generating a phandle w/libfdt?
> >
> >
> > On Oct 24, 2008, at 8:11 AM, Kumar Gala wrote:
> >
> > > In some work I'm doing I noticed we don't have any APIs to
> > generate
> > > a phandle via libfdt.
> > >
> > > was wondering if anyone had ideas on this.
> > >
> > > In first thought it seems we have to scan through the whole blob
> > > looking for the largest phandle id and than +1 it to generate the
> > > next "valid" id. Any other ideas on how to do this more
> > efficiently?
> >
> > The other question is there a way today to create a phandle even if
> > there isn't a reference to it elsewhere in a .dts?
>
> We had this issue and the 'hack' was to create a phandle property
> in the node itself, so it was self-referenced. That caused DTC
> to allocate a phandle. We then could reference the node from
> dynamically generated nodes.
That's nasty. I should add a way to make dtc generate a phandle for a
node, even if it's not referenced from elsewhere. Just need to think
of a decent syntax.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: generating a phandle w/libfdt?
[not found] ` <4BE3ADDA-362B-43AE-8D05-11260B94CD13-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2008-10-24 14:18 ` Kumar Gala
@ 2008-10-26 23:44 ` David Gibson
1 sibling, 0 replies; 16+ messages in thread
From: David Gibson @ 2008-10-26 23:44 UTC (permalink / raw)
To: Kumar Gala; +Cc: devicetree-discuss
On Fri, Oct 24, 2008 at 08:11:33AM -0500, Kumar Gala wrote:
> In some work I'm doing I noticed we don't have any APIs to generate a
> phandle via libfdt.
>
> was wondering if anyone had ideas on this.
>
> In first thought it seems we have to scan through the whole blob looking
> for the largest phandle id and than +1 it to generate the next "valid"
> id. Any other ideas on how to do this more efficiently?
I don't think it can be done more efficiently, without assuming things
about how any existing phandles are allocated, which I don't think is
wise.
Heck, even that's more efficient (theoretically, anyway) than the
method used internally in dtc. There, we have a "next phandle"
counter which starts at one. When we want to allocate a phandle we
try counter values, testing them with find_node_by_phandle() one by
one until we reach an unused one. Of course, because all the phandles
are usually allocated by dtc, in practice that usually only results in
one pass through the tree, although it can be many in principle.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: generating a phandle w/libfdt?
[not found] ` <20081026234052.GB22339-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
@ 2008-10-27 14:15 ` Kumar Gala
[not found] ` <76BF0CED-6848-43B9-8035-FC9C1F1DD981-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2008-10-27 15:14 ` Yoder Stuart
1 sibling, 1 reply; 16+ messages in thread
From: Kumar Gala @ 2008-10-27 14:15 UTC (permalink / raw)
To: David Gibson; +Cc: devicetree-discuss
On Oct 26, 2008, at 6:40 PM, David Gibson wrote:
> On Fri, Oct 24, 2008 at 09:29:21AM -0700, Yoder Stuart wrote:
>>
>>
>>> -----Original Message-----
>>> From:
>>> devicetree-discuss-bounces+stuart.yoder=freescale.com@ozlabs.o
>>> rg
>>> [mailto:devicetree-discuss-bounces+stuart.yoder=freescale.com@
>> ozlabs.org] On Behalf Of Kumar Gala
>>> Sent: Friday, October 24, 2008 9:19 AM
>>> To: devicetree-discuss
>>> Subject: Re: generating a phandle w/libfdt?
>>>
>>>
>>> On Oct 24, 2008, at 8:11 AM, Kumar Gala wrote:
>>>
>>>> In some work I'm doing I noticed we don't have any APIs to
>>> generate
>>>> a phandle via libfdt.
>>>>
>>>> was wondering if anyone had ideas on this.
>>>>
>>>> In first thought it seems we have to scan through the whole blob
>>>> looking for the largest phandle id and than +1 it to generate the
>>>> next "valid" id. Any other ideas on how to do this more
>>> efficiently?
>>>
>>> The other question is there a way today to create a phandle even if
>>> there isn't a reference to it elsewhere in a .dts?
>>
>> We had this issue and the 'hack' was to create a phandle property
>> in the node itself, so it was self-referenced. That caused DTC
>> to allocate a phandle. We then could reference the node from
>> dynamically generated nodes.
>
> That's nasty. I should add a way to make dtc generate a phandle for a
> node, even if it's not referenced from elsewhere. Just need to think
> of a decent syntax.
What if we just have it do that if we have a "linux,phandle" property
w/o a value in the .dts?
- k
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: generating a phandle w/libfdt?
[not found] ` <2D630F2F-4AA2-4537-89FE-80B2DDFADDEE-aZOuKsOsJu3MbYB6QlFGEg@public.gmane.org>
@ 2008-10-27 14:16 ` Kumar Gala
0 siblings, 0 replies; 16+ messages in thread
From: Kumar Gala @ 2008-10-27 14:16 UTC (permalink / raw)
To: Jimi Xenidis; +Cc: devicetree-discuss
On Oct 24, 2008, at 10:15 AM, Jimi Xenidis wrote:
>
> On Oct 24, 2008, at 9:18 AM, Kumar Gala wrote:
>
>>
>> On Oct 24, 2008, at 8:11 AM, Kumar Gala wrote:
>>
>>> In some work I'm doing I noticed we don't have any APIs to
>>> generate a phandle via libfdt.
>>>
>>> was wondering if anyone had ideas on this.
>>>
>>> In first thought it seems we have to scan through the whole blob
>>> looking for the largest phandle id and than +1 it to generate the
>>> next "valid" id. Any other ideas on how to do this more
>>> efficiently?
>>
>> The other question is there a way today to create a phandle even if
>> there isn't a reference to it elsewhere in a .dts?
>>
>
> Well, then by definition, it is not a phandle, right?
> If nothing references it then I'm not sure how you can reconcile the
> number when some SW layer builds the next version of it to pass on up.
>
> It sounds like you need a separate numerical space.
>
> Just a shot in that dark to see if your actual problem is similar...
>
> I'm expecting us to hit something like this _hard_ when we try to
> fit runtime FW into ePAPR, like IBM's RTAS layer, where the devtree
> can go through several generations but we need to hang on to the
> _original_ phandle for a node from the time that the RTAS was
> instantiated. In server we use "ibm,phandle" for this.
Its more because I need firmware to do some fixups after the fact that
need phandles. Its a bit of a pain to "generate" phandles on the fly.
- k
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: generating a phandle w/libfdt?
[not found] ` <20081026234052.GB22339-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
2008-10-27 14:15 ` Kumar Gala
@ 2008-10-27 15:14 ` Yoder Stuart
[not found] ` <9696D7A991D0824DBA8DFAC74A9C5FA3047E53A0-ofAVchDyotYzzZk0BCvKg5jmvxFtTJ+o0e7PPNI6Mm0@public.gmane.org>
1 sibling, 1 reply; 16+ messages in thread
From: Yoder Stuart @ 2008-10-27 15:14 UTC (permalink / raw)
To: David Gibson; +Cc: devicetree-discuss
> -----Original Message-----
> From: David Gibson [mailto:david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org]
> Sent: Sunday, October 26, 2008 6:41 PM
> To: Yoder Stuart-B08248
> Cc: Kumar Gala; devicetree-discuss
> Subject: Re: generating a phandle w/libfdt?
>
> On Fri, Oct 24, 2008 at 09:29:21AM -0700, Yoder Stuart wrote:
> >
> >
> > > -----Original Message-----
> > > From:
> > > devicetree-discuss-bounces+stuart.yoder=freescale.com@ozlabs.o
> > > rg
> > > [mailto:devicetree-discuss-bounces+stuart.yoder=freescale.com@
> > ozlabs.org] On Behalf Of Kumar Gala
> > > Sent: Friday, October 24, 2008 9:19 AM
> > > To: devicetree-discuss
> > > Subject: Re: generating a phandle w/libfdt?
> > >
> > >
> > > On Oct 24, 2008, at 8:11 AM, Kumar Gala wrote:
> > >
> > > > In some work I'm doing I noticed we don't have any APIs to
> > > generate
> > > > a phandle via libfdt.
> > > >
> > > > was wondering if anyone had ideas on this.
> > > >
> > > > In first thought it seems we have to scan through the
> whole blob
> > > > looking for the largest phandle id and than +1 it to
> generate the
> > > > next "valid" id. Any other ideas on how to do this more
> > > efficiently?
> > >
> > > The other question is there a way today to create a
> phandle even if
> > > there isn't a reference to it elsewhere in a .dts?
> >
> > We had this issue and the 'hack' was to create a phandle property
> > in the node itself, so it was self-referenced. That caused DTC
> > to allocate a phandle. We then could reference the node from
> > dynamically generated nodes.
>
> That's nasty. I should add a way to make dtc generate a phandle for a
> node, even if it's not referenced from elsewhere. Just need to think
> of a decent syntax.
We could add a flag to DTC to generate phandles for all
nodes.
Only downside I can see is an additional 4 bytes per node.
Stuart
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: generating a phandle w/libfdt?
[not found] ` <76BF0CED-6848-43B9-8035-FC9C1F1DD981-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
@ 2008-10-28 0:04 ` David Gibson
[not found] ` <20081028000449.GB26424-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: David Gibson @ 2008-10-28 0:04 UTC (permalink / raw)
To: Kumar Gala; +Cc: devicetree-discuss
On Mon, Oct 27, 2008 at 09:15:38AM -0500, Kumar Gala wrote:
>
> On Oct 26, 2008, at 6:40 PM, David Gibson wrote:
>
>> On Fri, Oct 24, 2008 at 09:29:21AM -0700, Yoder Stuart wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From:
>>>> devicetree-discuss-bounces+stuart.yoder=freescale.com@ozlabs.o
>>>> rg
>>>> [mailto:devicetree-discuss-bounces+stuart.yoder=freescale.com@
>>> ozlabs.org] On Behalf Of Kumar Gala
>>>> Sent: Friday, October 24, 2008 9:19 AM
>>>> To: devicetree-discuss
>>>> Subject: Re: generating a phandle w/libfdt?
>>>>
>>>>
>>>> On Oct 24, 2008, at 8:11 AM, Kumar Gala wrote:
>>>>
>>>>> In some work I'm doing I noticed we don't have any APIs to
>>>> generate
>>>>> a phandle via libfdt.
>>>>>
>>>>> was wondering if anyone had ideas on this.
>>>>>
>>>>> In first thought it seems we have to scan through the whole blob
>>>>> looking for the largest phandle id and than +1 it to generate the
>>>>> next "valid" id. Any other ideas on how to do this more
>>>> efficiently?
>>>>
>>>> The other question is there a way today to create a phandle even if
>>>> there isn't a reference to it elsewhere in a .dts?
>>>
>>> We had this issue and the 'hack' was to create a phandle property
>>> in the node itself, so it was self-referenced. That caused DTC
>>> to allocate a phandle. We then could reference the node from
>>> dynamically generated nodes.
>>
>> That's nasty. I should add a way to make dtc generate a phandle for a
>> node, even if it's not referenced from elsewhere. Just need to think
>> of a decent syntax.
>
> What if we just have it do that if we have a "linux,phandle" property
> w/o a value in the .dts?
Hrm. Normally that would create a property named "linux,phandle" with
a zero-length value. I'm disinclined to special case this.
Hrm, it occurs to me that:
foo: node {
linux,phandle = < &foo >;
};
might well work right now, though it's a bit horrible from the
implementation side.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: generating a phandle w/libfdt?
[not found] ` <9696D7A991D0824DBA8DFAC74A9C5FA3047E53A0-ofAVchDyotYzzZk0BCvKg5jmvxFtTJ+o0e7PPNI6Mm0@public.gmane.org>
@ 2008-10-28 0:05 ` David Gibson
0 siblings, 0 replies; 16+ messages in thread
From: David Gibson @ 2008-10-28 0:05 UTC (permalink / raw)
To: Yoder Stuart; +Cc: devicetree-discuss
On Mon, Oct 27, 2008 at 08:14:48AM -0700, Yoder Stuart wrote:
>
>
> > -----Original Message-----
> > From: David Gibson [mailto:david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org]
> > Sent: Sunday, October 26, 2008 6:41 PM
> > To: Yoder Stuart-B08248
> > Cc: Kumar Gala; devicetree-discuss
> > Subject: Re: generating a phandle w/libfdt?
> >
> > On Fri, Oct 24, 2008 at 09:29:21AM -0700, Yoder Stuart wrote:
> > >
> > >
> > > > -----Original Message-----
> > > > From:
> > > > devicetree-discuss-bounces+stuart.yoder=freescale.com@ozlabs.o
> > > > rg
> > > > [mailto:devicetree-discuss-bounces+stuart.yoder=freescale.com@
> > > ozlabs.org] On Behalf Of Kumar Gala
> > > > Sent: Friday, October 24, 2008 9:19 AM
> > > > To: devicetree-discuss
> > > > Subject: Re: generating a phandle w/libfdt?
> > > >
> > > >
> > > > On Oct 24, 2008, at 8:11 AM, Kumar Gala wrote:
> > > >
> > > > > In some work I'm doing I noticed we don't have any APIs to
> > > > generate
> > > > > a phandle via libfdt.
> > > > >
> > > > > was wondering if anyone had ideas on this.
> > > > >
> > > > > In first thought it seems we have to scan through the
> > whole blob
> > > > > looking for the largest phandle id and than +1 it to
> > generate the
> > > > > next "valid" id. Any other ideas on how to do this more
> > > > efficiently?
> > > >
> > > > The other question is there a way today to create a
> > phandle even if
> > > > there isn't a reference to it elsewhere in a .dts?
> > >
> > > We had this issue and the 'hack' was to create a phandle property
> > > in the node itself, so it was self-referenced. That caused DTC
> > > to allocate a phandle. We then could reference the node from
> > > dynamically generated nodes.
> >
> > That's nasty. I should add a way to make dtc generate a phandle for a
> > node, even if it's not referenced from elsewhere. Just need to think
> > of a decent syntax.
>
> We could add a flag to DTC to generate phandles for all
> nodes.
That's probably not a bad idea too, but it would still be nice to
explicitly tag nodes as wanting a phandle.
> Only downside I can see is an additional 4 bytes per node.
Well, 16 bytes, actually (property tag, name offset, length, phandle
value are 4 bytes each).
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: generating a phandle w/libfdt?
[not found] ` <20081028000449.GB26424-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
@ 2008-10-29 3:47 ` Kumar Gala
[not found] ` <33A5285E-F5BE-4109-9C29-59F23E6264A0-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: Kumar Gala @ 2008-10-29 3:47 UTC (permalink / raw)
To: David Gibson; +Cc: devicetree-discuss
On Oct 27, 2008, at 7:04 PM, David Gibson wrote:
> On Mon, Oct 27, 2008 at 09:15:38AM -0500, Kumar Gala wrote:
>>
>> On Oct 26, 2008, at 6:40 PM, David Gibson wrote:
>>
>>> On Fri, Oct 24, 2008 at 09:29:21AM -0700, Yoder Stuart wrote:
>>>>
>>>>
>>>>> -----Original Message-----
>>>>> From:
>>>>> devicetree-discuss-bounces+stuart.yoder=freescale.com@ozlabs.o
>>>>> rg
>>>>> [mailto:devicetree-discuss-bounces+stuart.yoder=freescale.com@
>>>> ozlabs.org] On Behalf Of Kumar Gala
>>>>> Sent: Friday, October 24, 2008 9:19 AM
>>>>> To: devicetree-discuss
>>>>> Subject: Re: generating a phandle w/libfdt?
>>>>>
>>>>>
>>>>> On Oct 24, 2008, at 8:11 AM, Kumar Gala wrote:
>>>>>
>>>>>> In some work I'm doing I noticed we don't have any APIs to
>>>>> generate
>>>>>> a phandle via libfdt.
>>>>>>
>>>>>> was wondering if anyone had ideas on this.
>>>>>>
>>>>>> In first thought it seems we have to scan through the whole blob
>>>>>> looking for the largest phandle id and than +1 it to generate the
>>>>>> next "valid" id. Any other ideas on how to do this more
>>>>> efficiently?
>>>>>
>>>>> The other question is there a way today to create a phandle even
>>>>> if
>>>>> there isn't a reference to it elsewhere in a .dts?
>>>>
>>>> We had this issue and the 'hack' was to create a phandle property
>>>> in the node itself, so it was self-referenced. That caused DTC
>>>> to allocate a phandle. We then could reference the node from
>>>> dynamically generated nodes.
>>>
>>> That's nasty. I should add a way to make dtc generate a phandle
>>> for a
>>> node, even if it's not referenced from elsewhere. Just need to
>>> think
>>> of a decent syntax.
>>
>> What if we just have it do that if we have a "linux,phandle" property
>> w/o a value in the .dts?
>
> Hrm. Normally that would create a property named "linux,phandle" with
> a zero-length value. I'm disinclined to special case this.
Why? linux,phandle is already special. What does it mean if a
linux,phandle has no value?
- k
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: generating a phandle w/libfdt?
[not found] ` <33A5285E-F5BE-4109-9C29-59F23E6264A0-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
@ 2008-11-06 2:10 ` David Gibson
[not found] ` <20081106021040.GJ28465-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: David Gibson @ 2008-11-06 2:10 UTC (permalink / raw)
To: Kumar Gala; +Cc: devicetree-discuss
On Tue, Oct 28, 2008 at 10:47:39PM -0500, Kumar Gala wrote:
> On Oct 27, 2008, at 7:04 PM, David Gibson wrote:
>> On Mon, Oct 27, 2008 at 09:15:38AM -0500, Kumar Gala wrote:
>>> On Oct 26, 2008, at 6:40 PM, David Gibson wrote:
>>>> On Fri, Oct 24, 2008 at 09:29:21AM -0700, Yoder Stuart wrote:
[snip]
>>> What if we just have it do that if we have a "linux,phandle" property
>>> w/o a value in the .dts?
>>
>> Hrm. Normally that would create a property named "linux,phandle" with
>> a zero-length value. I'm disinclined to special case this.
>
> Why? linux,phandle is already special. What does it mean if a
> linux,phandle has no value?
Well, making existing notation mean something different for this
property seems to me a different order of special casing than
auto-creating the property if it's not present to start with.
You know, I am inclined to make:
linux,phandle = < &thisnode >;
the approved way of doing this. I *think* that will already work, but
if not we can fix it. The circular reference is slightly odd, but it
is self-consistent. I suppose we could still come up with a further
shorthand so it's not necessary to make a label for a node to do this
('&.' or something for 'reference-to-containing-node').
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: generating a phandle w/libfdt?
[not found] ` <20081106021040.GJ28465-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
@ 2008-11-06 15:16 ` Yoder Stuart
[not found] ` <9696D7A991D0824DBA8DFAC74A9C5FA304840D5C-ofAVchDyotYzzZk0BCvKg5jmvxFtTJ+o0e7PPNI6Mm0@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: Yoder Stuart @ 2008-11-06 15:16 UTC (permalink / raw)
To: David Gibson, Kumar Gala; +Cc: devicetree-discuss
> -----Original Message-----
> From: David Gibson [mailto:david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org]
> Sent: Wednesday, November 05, 2008 8:11 PM
> To: Kumar Gala
> Cc: Yoder Stuart-B08248; devicetree-discuss
> Subject: Re: generating a phandle w/libfdt?
>
> On Tue, Oct 28, 2008 at 10:47:39PM -0500, Kumar Gala wrote:
> > On Oct 27, 2008, at 7:04 PM, David Gibson wrote:
> >> On Mon, Oct 27, 2008 at 09:15:38AM -0500, Kumar Gala wrote:
> >>> On Oct 26, 2008, at 6:40 PM, David Gibson wrote:
> >>>> On Fri, Oct 24, 2008 at 09:29:21AM -0700, Yoder Stuart wrote:
> [snip]
> >>> What if we just have it do that if we have a
> "linux,phandle" property
> >>> w/o a value in the .dts?
> >>
> >> Hrm. Normally that would create a property named
> "linux,phandle" with
> >> a zero-length value. I'm disinclined to special case this.
> >
> > Why? linux,phandle is already special. What does it mean if a
> > linux,phandle has no value?
>
> Well, making existing notation mean something different for this
> property seems to me a different order of special casing than
> auto-creating the property if it's not present to start with.
>
> You know, I am inclined to make:
> linux,phandle = < &thisnode >;
> the approved way of doing this. I *think* that will already work, but
> if not we can fix it. The circular reference is slightly odd, but it
> is self-consistent. I suppose we could still come up with a further
> shorthand so it's not necessary to make a label for a node to do this
> ('&.' or something for 'reference-to-containing-node').
As I mentioned earlier in this thread, this _does_ work and is
what we did in the DTS to get phandles generated for nodes that were
going to be referenced by nodes dynamically created later.
Stuart
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: generating a phandle w/libfdt?
[not found] ` <9696D7A991D0824DBA8DFAC74A9C5FA304840D5C-ofAVchDyotYzzZk0BCvKg5jmvxFtTJ+o0e7PPNI6Mm0@public.gmane.org>
@ 2008-11-06 23:27 ` Scott Wood
[not found] ` <49137D70.8080009-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: Scott Wood @ 2008-11-06 23:27 UTC (permalink / raw)
To: Yoder Stuart; +Cc: devicetree-discuss
Yoder Stuart wrote:
>> -----Original Message-----
>> From: David Gibson [mailto:david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org]
>> Sent: Wednesday, November 05, 2008 8:11 PM
>> To: Kumar Gala
>> Cc: Yoder Stuart-B08248; devicetree-discuss
>> Subject: Re: generating a phandle w/libfdt?
>>
>> You know, I am inclined to make:
>> linux,phandle = < &thisnode >;
>> the approved way of doing this. I *think* that will already work, but
>> if not we can fix it. The circular reference is slightly odd, but it
>> is self-consistent. I suppose we could still come up with a further
>> shorthand so it's not necessary to make a label for a node to do this
>> ('&.' or something for 'reference-to-containing-node').
>
> As I mentioned earlier in this thread, this _does_ work and is
> what we did in the DTS to get phandles generated for nodes that were
> going to be referenced by nodes dynamically created later.
It works if you call the property something *other* than linux,phandle.
If you explicitly say linux,phandle = <&self> then you get this:
ERROR (explicit_phandles): /chosen has invalid linux,phandle value
0xffffffff
-Scott
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: generating a phandle w/libfdt?
[not found] ` <49137D70.8080009-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
@ 2008-11-07 0:02 ` David Gibson
0 siblings, 0 replies; 16+ messages in thread
From: David Gibson @ 2008-11-07 0:02 UTC (permalink / raw)
To: Scott Wood; +Cc: devicetree-discuss
On Thu, Nov 06, 2008 at 05:27:44PM -0600, Scott Wood wrote:
> Yoder Stuart wrote:
>>> -----Original Message-----
>>> From: David Gibson [mailto:david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org] Sent:
>>> Wednesday, November 05, 2008 8:11 PM
>>> To: Kumar Gala
>>> Cc: Yoder Stuart-B08248; devicetree-discuss
>>> Subject: Re: generating a phandle w/libfdt?
>>>
>>> You know, I am inclined to make:
>>> linux,phandle = < &thisnode >;
>>> the approved way of doing this. I *think* that will already work, but
>>> if not we can fix it. The circular reference is slightly odd, but it
>>> is self-consistent. I suppose we could still come up with a further
>>> shorthand so it's not necessary to make a label for a node to do this
>>> ('&.' or something for 'reference-to-containing-node').
>>
>> As I mentioned earlier in this thread, this _does_ work and is
>> what we did in the DTS to get phandles generated for nodes that were
>> going to be referenced by nodes dynamically created later.
>
> It works if you call the property something *other* than linux,phandle.
>
> If you explicitly say linux,phandle = <&self> then you get this:
> ERROR (explicit_phandles): /chosen has invalid linux,phandle value
> 0xffffffff
Well, I guess I'd better fix that, then.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2008-11-07 0:02 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-24 13:11 generating a phandle w/libfdt? Kumar Gala
[not found] ` <4BE3ADDA-362B-43AE-8D05-11260B94CD13-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2008-10-24 14:18 ` Kumar Gala
[not found] ` <DEE70934-6A37-4439-B27E-FC3ABF75BF24-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2008-10-24 15:15 ` Jimi Xenidis
[not found] ` <2D630F2F-4AA2-4537-89FE-80B2DDFADDEE-aZOuKsOsJu3MbYB6QlFGEg@public.gmane.org>
2008-10-27 14:16 ` Kumar Gala
2008-10-24 16:29 ` Yoder Stuart
[not found] ` <9696D7A991D0824DBA8DFAC74A9C5FA3047947A3-ofAVchDyotYzzZk0BCvKg5jmvxFtTJ+o0e7PPNI6Mm0@public.gmane.org>
2008-10-26 23:40 ` David Gibson
[not found] ` <20081026234052.GB22339-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
2008-10-27 14:15 ` Kumar Gala
[not found] ` <76BF0CED-6848-43B9-8035-FC9C1F1DD981-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2008-10-28 0:04 ` David Gibson
[not found] ` <20081028000449.GB26424-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
2008-10-29 3:47 ` Kumar Gala
[not found] ` <33A5285E-F5BE-4109-9C29-59F23E6264A0-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2008-11-06 2:10 ` David Gibson
[not found] ` <20081106021040.GJ28465-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
2008-11-06 15:16 ` Yoder Stuart
[not found] ` <9696D7A991D0824DBA8DFAC74A9C5FA304840D5C-ofAVchDyotYzzZk0BCvKg5jmvxFtTJ+o0e7PPNI6Mm0@public.gmane.org>
2008-11-06 23:27 ` Scott Wood
[not found] ` <49137D70.8080009-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2008-11-07 0:02 ` David Gibson
2008-10-27 15:14 ` Yoder Stuart
[not found] ` <9696D7A991D0824DBA8DFAC74A9C5FA3047E53A0-ofAVchDyotYzzZk0BCvKg5jmvxFtTJ+o0e7PPNI6Mm0@public.gmane.org>
2008-10-28 0:05 ` David Gibson
2008-10-26 23:44 ` David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox