[U-Boot-Users] [PATCH][FDT][UPDATE] Add common memory fixup function
Kumar Gala
galak at kernel.crashing.org
Thu Nov 29 00:12:05 CET 2007
On Nov 28, 2007, at 5:04 PM, Scott Wood wrote:
> Kumar Gala wrote:
>> On Nov 28, 2007, at 4:38 PM, Scott Wood wrote:
>>> Kumar Gala wrote:
>>>> I don't see how to use them w/o going through an additional memcpy.
>>>> If you can provide a better solution I'm all for it. But I don't
>>>> see any reason to hold up the patch at this point.
>>>
>>> union {
>>> uint8_t tmp[8];
>>> uint64_t mem64;
>>> uint32_t mem32;
>>> }
>>>
>>> int len;
>>>
>>> if (addrcell && *addrcell == 2) {
>>> mem64 = cpu_to_fdt64(memsize);
>>> len = 8;
>>> } else {
>>> mem32 = cpu_to_fdt32(memsize);
>>> len = 4;
>>> }
>> This gets more complicated with finishing off the rest of temp
>> since you have to use len to figure out an index.
>
> OK, so make mem64/mem32 arrays. :-P
>
>> I'm keeping the code as is since its the simplest version.
>
> Fine, if you don't mind making people's eyes bleed...
:)
> Maybe a generic function that takes a buffer pointer, a uint64_t,
> and a numcells? This is hardly going to be the only place that
> needs to write out a quantity that might be one or two cells.
Agreed, but I leave that as an exercise for the reader... when we get
the second case of this we can figure out a better helper.
- k
More information about the U-Boot
mailing list