[PATCH 03/17] bootwrapper: Add xlate_reg(), and use it to find serial registers.

Segher Boessenkool segher at kernel.crashing.org
Thu Mar 22 06:11:59 EST 2007


>> I didn't look at the actual code but it should be really
>> small; I hope it doesn't copy the Linux code with its
>> millions of workarounds for broken device trees -- we
>> should insist on correct trees, or even just fix them
>> if they *are* broken ;-)
>
> It's around 1700 bytes.  Most of the complexity is for dealing with
> different #address-cells and #size-cells -- if we could assume a max 
> of 2
> for each, then it could be simplified quite a bit by using u64 instead 
> of
> arrays.  However, that wouldn't work with PCI, which has 3 address 
> cells.

It is quite safe to assume a max of 3 for #a and a
max of 2 for #s.

One way to simplify the code (when writing it in C)
is to always store any address as the maximum supported
number of 32-bit integers (padding it with zeroes perhaps).
No need to micro-optimise this stuff, just make the code
real generic and simple, that'll buy you more in the end.


Segher




More information about the Linuxppc-dev mailing list