On 09/26/2013 09:26 AM, Mischa Jonker wrote:
> Vipin wrote:
>> I have also faced this problem before. May be a better solution is to
>> place all the struct and buffer declarations at the very start of
>> dw_eth_dev structure (off-course with a comment that these should not
>> be moved). It may avoid the problem in later modifications
>
> I think that's why Alexey added the alignment to the struct dmamacdescr 
> declaration, to make sure that it always aligned on a boundary of 16 bytes 
> (so even 128-bit busses don't face this issue).
>
> I don't know though whether the __aligned attribute should be at the type 
> definition of the struct or at the declaration of the "struct dmamacdescr" 
> inside "struct dw_eth_dev". I'm guessing the declaration inside "struct 
> dw_eth_dev" will inherit the alignment requirements of the type def though, 
> but not sure.

At least from what I see during my trials "__aligned" in definition of 
BD structure works as well. Both arrays of buffer descriptors were 
properly aligned compared to "dw_eth_dev" base address.
And since "dw_eth_dev" structure is already aligned (it is allocated 
with "memalign") both BD arrays are also properly aligned.

Initially I thought about move of BD arrays on top of the mother 
structure but then decided to go with "__aligned" specifiers. IMHO it is 
safe enough while still very clear - no need to worry about order of 
structure members and no need to add any comments on how to keep members 
in order.

-Alexey
_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to