Devicetree
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: David VomLehn <dvomlehn-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
Cc: Device Tree Mailing List
	<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>
Subject: Re: Alignment of mixed-data type items in properties
Date: Tue, 9 Nov 2010 12:28:45 +1100	[thread overview]
Message-ID: <20101109012845.GC30378@yookeroo> (raw)
In-Reply-To: <20101109010709.GA10639-ZEW99E7oL/EiWxQNNj96ibh/4TqKg8J2XqFh9Ls21Oc@public.gmane.org>

On Mon, Nov 08, 2010 at 05:07:09PM -0800, David VomLehn wrote:
> I have a property that seems most simply expressed as:
> 
> 	prop = "abc",<0x12345678 0x87654321>;
> 
> It looks like the u32 values are not aligned on four-byte
> boundaries.

Well, actually, in this case it will be 4-byte aligned, because "abc"
is 4 bytes in length ('a', 'b', 'c', '\0').  But in general, that's
right, u32 values will not be aligned if they follow something of
unaligned length.

> Given the effort elsewhere in the device tree to make
> things aligned,

That's in the tree structure, not the contents.  The property values
are just bytestrings as far as the dtb format is concerned.

> this was a bit of a surprise. It's easy enough to
> handle; I'm just wondering whether this was the intent.

Yes, it's the intent.  Early on we did align u32 values, but we
realised that was a bad idea.  It doesn't really correspond to how OF
did encode property values, and it gets confusing in more complex
examples (including some possible future syntax).  Consider for
example
	&label, <0x1234>
We wouldn't know how much alignment to insert until the label is
expanded.  It gets much worse if we support expressions in future.

-- 
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:[~2010-11-09  1:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-09  1:07 Alignment of mixed-data type items in properties David VomLehn
     [not found] ` <20101109010709.GA10639-ZEW99E7oL/EiWxQNNj96ibh/4TqKg8J2XqFh9Ls21Oc@public.gmane.org>
2010-11-09  1:28   ` David Gibson [this message]
2010-11-09  5:09     ` 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=20101109012845.GC30378@yookeroo \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=dvomlehn-FYB4Gu1CFyUAvxtiuMwx3w@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