[PATCH 11/13] powerpc: Add DTS file for the Motorola PrPMC2800 platform

Segher Boessenkool segher at kernel.crashing.org
Sun May 13 10:21:31 EST 2007


>>>> +			partition-names = "FW Image A\0FW Config Data\0Kernel 
>>>> Image\0Filesystem\0FW Image B";
>>> dtc now supports the syntax:
>>> 	partition-names = "FW Image A", "FW Config Data", ...
>>> for multi-string properties to make this sort of thing less ugly.
>> Nice!  Can you also concatenate different property
>> encodings that way?  Like,
>> 	slot-names = <5>, "Slot A", "Slot C";
>> or something like that?
>> Segher
>
> Hi Segher,
>
> That doesn't make sense to me.  It would be a bugger to understand the 
> value of "slot-names" since <5> is a number and the rest are strings. 
> How do you know it is a number?  How do you know how big it is?

You know that since it is how that particular property is
defined: it is one integer (i.e., 32-bit big-endian),
followed by a string (zero-terminated) for each set bit
in the integer.

A property is always just an array of bytes; its meaning
is determined by what property in what node this is.
Nowhere in a property is is encoded that some parts are
integers, some parts are strings, some parts are just
blobs.

> If <5> is a single byte, it will look like "\05Slot A\0Slot C" (ASCII 
> <ENQ> as the first character of two concatenated strings).  If it is a 
> 4 or 8 byte integer, it will have preceding "nulls" (big endian) which 
> would be even worse.

Not bad at all -- it is trivial to decode _if_ you know
how it is encoded.  You cannot tell by looking at the
property data only.  What is [44 54 53 00] -- just some
bytes, or the integer 0x44545300, or the string "DTS"?
You cannot tell.

> It seems to me that it would be much better as
>   slot-names = "5", "Slot A", "Slot C";
> and do an atoi() conversion if you detect it is or expect it to be 
> numeric.

Hey, I know!  We could redefine OF to use XML instead!

;-)


Segher




More information about the Linuxppc-dev mailing list