Devicetree
 help / color / mirror / Atom feed
From: Andres Salomon <dilinger-pFFUokh25LWsTnJN9+BGXg@public.gmane.org>
To: Segher Boessenkool
	<segher-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
Cc: devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org
Subject: Re: olpc ofw question
Date: Wed, 11 Aug 2010 17:20:45 -0400	[thread overview]
Message-ID: <20100811172045.77cda7a0@dev.queued.net> (raw)
In-Reply-To: <55307.84.105.60.153.1281559723.squirrel-JorI+TVEvZrY24RiXHRV3ti2O/JbrIOy@public.gmane.org>

On Wed, 11 Aug 2010 22:48:43 +0200 (CEST)
"Segher Boessenkool" <segher-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org> wrote:

> > I've run a comparison between OLPC's old OFW code (which mounts the
> > device-tree at /ofw, and makes use of the sparc code) versus the
> > code which I'm planning to send upstream (which mounts the
> > device-tree at /proc/device-tree, and makes use of PROC_DEVTREE).
> > The results are here:
> 
> [unit addresses are missing]
> 
> > Any insight into the reasoning for this mangling?
> 
> It sounds to me like you're not putting the (textual representation
> of the) unit address in the device_node->full_name field.  How do
> you fill that field?

Ah, that could very well be it.  Note that the *old* OLPC code used the
'path_component_name' of device_node.  The new code uses just 'name' in
pdt_build_full_name(), as path_component_name is #ifdef'd out
for !SPARC.  I guess I'm not entirely sure why sparc used
path_component_name in the first place..


The code that fills in full_name:

                dp->full_name = pdt_build_full_name(dp);


static char * __init pdt_build_full_name(struct device_node *dp)
{
        int len, ourlen, plen;
        char *n;

        plen = strlen(dp->parent->full_name);
        ourlen = strlen(fetch_node_name(dp));
        len = ourlen + plen + 2;

        n = prom_early_alloc(len);
        strcpy(n, dp->parent->full_name);
        if (!of_is_root_node(dp->parent)) {
                strcpy(n + plen, "/");
                plen++;
        }
        strcpy(n + plen, fetch_node_name(dp));

        return n;
}

#if defined(CONFIG_SPARC)
static inline const char *fetch_node_name(struct device_node *dp)
{
        return dp->path_component_name;
}
#else
static inline const char *fetch_node_name(struct device_node *dp)
{
        return dp->name;
}
#endif

  parent reply	other threads:[~2010-08-11 21:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-11  0:40 olpc ofw question Andres Salomon
     [not found] ` <20100810204010.134618fb-ztAUm9HJea/EueBKFXcDjA@public.gmane.org>
2010-08-11 20:48   ` Segher Boessenkool
     [not found]     ` <55307.84.105.60.153.1281559723.squirrel-JorI+TVEvZrY24RiXHRV3ti2O/JbrIOy@public.gmane.org>
2010-08-11 21:20       ` Andres Salomon [this message]
     [not found]         ` <20100811172045.77cda7a0-ztAUm9HJea/EueBKFXcDjA@public.gmane.org>
2010-08-12  1:53           ` Mitch Bradley
     [not found]             ` <4C635428.9010009-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2010-08-15  0:35               ` Andres Salomon
2010-08-15  1:52                 ` Mitch Bradley

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=20100811172045.77cda7a0@dev.queued.net \
    --to=dilinger-pffuokh25lwstnjn9+bgxg@public.gmane.org \
    --cc=devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org \
    --cc=segher-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@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