Devicetree
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Grant Likely
	<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
	linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.org,
	devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org
Subject: Re: Make the kernel accept ePAPR style phandle information
Date: Wed, 25 Nov 2009 22:46:29 -0700	[thread overview]
Message-ID: <fa686aa40911252146u73a9f9d3y9fb287bfc051503d@mail.gmail.com> (raw)
In-Reply-To: <20091126051641.GB27334@yookeroo>

On Wed, Nov 25, 2009 at 10:16 PM, David Gibson
<david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> wrote:
> Grant, this is based on your test-devicetree branch, if it could be
> merged via there would be great.
>
> Currently when processing flattened device trees, the kernel expects
> the phandle in a property called "linux,phandle".  The ePAPR spec -
> not being Linux specific - instead requires phandles to be encoded in
> a property named simply "phandle".  This patch makes the kernel accept
> either form when unflattening the device tree.
>
> Signed-off-by: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>

Looks okay to me.

g.

>
> Index: working-2.6/drivers/of/fdt.c
> ===================================================================
> --- working-2.6.orig/drivers/of/fdt.c   2009-11-26 09:58:06.052792325 +1100
> +++ working-2.6/drivers/of/fdt.c        2009-11-26 10:00:08.309570256 +1100
> @@ -314,10 +314,19 @@ unsigned long __init unflatten_dt_node(u
>                pp = unflatten_dt_alloc(&mem, sizeof(struct property),
>                                        __alignof__(struct property));
>                if (allnextpp) {
> -                       if (strcmp(pname, "linux,phandle") == 0) {
> +                       /* We accept flattened tree phandles either in
> +                        * ePAPR-style "phandle" properties, or the
> +                        * legacy "linux,phandle" properties.  If both
> +                        * appear and have different values, things
> +                        * will get weird.  Don't do that. */
> +                       if ((strcmp(pname, "phandle") == 0)
> +                           || (strcmp(pname, "linux,phandle") == 0)) {
>                                if (np->phandle == 0)
>                                        np->phandle = *((u32 *)*p);
>                        }
> +                       /* And we process the "ibm,phandle" property
> +                        * used in pSeries dynamic device tree
> +                        * stuff */
>                        if (strcmp(pname, "ibm,phandle") == 0)
>                                np->phandle = *((u32 *)*p);
>                        pp->name = pname;
>
>
> --
> 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
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

      reply	other threads:[~2009-11-26  5:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-26  5:16 Make the kernel accept ePAPR style phandle information David Gibson
2009-11-26  5:46 ` Grant Likely [this message]

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=fa686aa40911252146u73a9f9d3y9fb287bfc051503d@mail.gmail.com \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org \
    --cc=linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@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