Devicetree
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Yoder Stuart <stuart.yoder-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Cc: devicetree-discuss
	<devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org>
Subject: Re: generating a phandle w/libfdt?
Date: Tue, 28 Oct 2008 11:05:55 +1100	[thread overview]
Message-ID: <20081028000555.GC26424@yookeroo.seuss> (raw)
In-Reply-To: <9696D7A991D0824DBA8DFAC74A9C5FA3047E53A0-ofAVchDyotYzzZk0BCvKg5jmvxFtTJ+o0e7PPNI6Mm0@public.gmane.org>

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

  parent reply	other threads:[~2008-10-28  0:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2008-10-26 23:44   ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081028000555.GC26424@yookeroo.seuss \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org \
    --cc=stuart.yoder-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox