[U-Boot] [RFC PATCH 03/11] SPL: FIT: factor out spl_load_fit_image()
Lokesh Vutla
lokeshvutla at ti.com
Mon Jan 23 14:31:38 CET 2017
Tom,
On Monday 23 January 2017 06:28 PM, Tom Rini wrote:
> On Mon, Jan 23, 2017 at 02:23:40PM +0530, Lokesh Vutla wrote:
>>
>>
>> On Friday 20 January 2017 07:23 AM, Andre Przywara wrote:
>>> At the moment we load two images from a FIT image: the actual U-Boot
>>> image and the DTB. Both times we have very similar code to deal with
>>> alignment requirement the media we load from imposes upon us.
>>> Factor out this code into a new function, which we just call twice.
>>>
>>> Signed-off-by: Andre Przywara <andre.przywara at arm.com>
>>> ---
>>> common/spl/spl_fit.c | 122 +++++++++++++++++++++------------------------------
>>> 1 file changed, 51 insertions(+), 71 deletions(-)
>>>
>>> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
>>> index 381ed1f..d4149c5 100644
>>> --- a/common/spl/spl_fit.c
>>> +++ b/common/spl/spl_fit.c
>>> @@ -138,19 +138,58 @@ static int get_aligned_image_size(struct spl_load_info *info, int data_size,
>>> return (data_size + info->bl_len - 1) / info->bl_len;
>>> }
>>>
>>> +static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
>>> + void *fit, ulong base_offset, int node,
>>> + struct spl_image_info *image_info)
>>> +{
>>> + ulong offset;
>>> + size_t length;
>>> + ulong load, entry;
>>> + void *src;
>>> + ulong overhead;
>>> + int nr_sectors;
>>> +
>>> + offset = fdt_getprop_u32(fit, node, "data-offset") + base_offset;
>>> + length = fdt_getprop_u32(fit, node, "data-size");
>>> + load = fdt_getprop_u32(fit, node, "load");
>>> + if (load == -1U && image_info)
>>> + load = image_info->load_addr;
>>
>> What if load_addr is not aligned with ARCH_DMA_MINALIGN like in case of
>> DT loading (u-boot's load_addr + size cannot be always aligned with
>> DMA). I keep getting this error when loading DT: "FAT: Misaligned buffer
>> address (808675a0)."
>
> My immediate concern here is that we've found another way we're going to
> run into the same old problems of 'large kernel BSS stomps on DT (or
> initrd) on ARM32 (arm64 won't because the Image format includes end of
> BSS as a field). If your FDT isn't at base+128MiB (and you have >
> 128MiB DDR), something is wrong :)
I guess the problem here is FDT for u-boot, which is loaded at the end
of u-boot which depends on u-boot's load address and size. I agree that
for kernel the DTB is loaded at base + 128MB. or am I missing something?
Thanks and regards,
Lokesh
More information about the U-Boot
mailing list