From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Mon, 23 Jan 2017 08:50:58 -0500 Subject: [U-Boot] [RFC PATCH 03/11] SPL: FIT: factor out spl_load_fit_image() In-Reply-To: <1f609d8a-4786-f44f-9a23-efb81cc7fa17@ti.com> References: <1484877211-19332-1-git-send-email-andre.przywara@arm.com> <1484877211-19332-4-git-send-email-andre.przywara@arm.com> <20170123125805.GG10853@bill-the-cat> <1f609d8a-4786-f44f-9a23-efb81cc7fa17@ti.com> Message-ID: <20170123135058.GJ10853@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Mon, Jan 23, 2017 at 07:01:38PM +0530, Lokesh Vutla wrote: > 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 > >>> --- > >>> 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? Ah, sorry. misread, nevermind. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: