summaryrefslogtreecommitdiff
path: root/cmd/elf.c
diff options
context:
space:
mode:
authorNeil Stainton <nstainton@asl-control.co.uk>2018-08-20 15:46:19 +0000
committerTom Rini <trini@konsulko.com>2018-08-24 15:59:33 -0400
commit8744d6c5048f41b2ae3a42696af2ea3b09c17e4b (patch)
tree01bb6839252db0dad1bbfdec342dd38d64680372 /cmd/elf.c
parent144c4e37db2adb1c296ab36467288a97885aff5a (diff)
u-boot: align cache flushes in load_elf_image_shdr to line boundaries
Prevent cache warning messages when using the 'bootelf' command on an Arm target. Round down each section start address and round up the respective section end to the nearest cache line. Currently when using bootelf to load an image on Arm, several warnings such as the following appear in the console: CACHE: Misaligned operation at range [87800000, 8783c5e0] CACHE: Misaligned operation at range [8783c5e0, 8784b3e0] Signed-off-by: Neil Stainton <nstainton@asl-control.co.uk> [trini: Reword commit message to include the info after the --- which included the Signed-off-by line, and change ' at ' to '@'] Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'cmd/elf.c')
-rw-r--r--cmd/elf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd/elf.c b/cmd/elf.c
index 22cba58c68..c8e6e7424c 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -115,7 +115,10 @@ static unsigned long load_elf64_image_shdr(unsigned long addr)
memcpy((void *)(uintptr_t)shdr->sh_addr,
(const void *)image, shdr->sh_size);
}
- flush_cache((ulong)shdr->sh_addr, shdr->sh_size);
+ flush_cache(rounddown(shdr->sh_addr, ARCH_DMA_MINALIGN),
+ roundup((shdr->sh_addr + shdr->sh_size),
+ ARCH_DMA_MINALIGN) -
+ rounddown(shdr->sh_addr, ARCH_DMA_MINALIGN));
}
if (ehdr->e_machine == EM_PPC64 && (ehdr->e_flags &