summaryrefslogtreecommitdiff
path: root/common/board_f.c
diff options
context:
space:
mode:
authorPatrice Chotard <patrice.chotard@st.com>2020-03-10 10:15:02 +0100
committerTom Rini <trini@konsulko.com>2020-04-16 23:06:54 -0400
commita6651086a74f82f7b5c4455c47f579e90dd566fe (patch)
tree4577c34b863f1d20f654c8b2b784e929415695ea /common/board_f.c
parent9d82cbd39a75f4388f3705efa99832b9376f3df5 (diff)
downloadu-boot-a6651086a74f82f7b5c4455c47f579e90dd566fe.tar.gz
u-boot-a6651086a74f82f7b5c4455c47f579e90dd566fe.tar.bz2
u-boot-a6651086a74f82f7b5c4455c47f579e90dd566fe.zip
board_f.c: Ensure gd->new_bootstage alignment
In reserve_bootstage(), in case size is odd, gd->new_bootstage is not aligned. In bootstage_relocate(), the platform hangs when getting access to data->record[i].name. To avoid this issue, make gd->new_bootstage 16 byte aligned. To ensure that new_bootstage is 16 byte aligned (at least needed for x86_64 and ARMv8) and new_bootstage starts down to get enough space, ALIGN_DOWN macro is used. Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm") Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com> Tested-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Diffstat (limited to 'common/board_f.c')
-rw-r--r--common/board_f.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/board_f.c b/common/board_f.c
index 82a164752a..0427b7b096 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -564,6 +564,11 @@ static int reserve_bootstage(void)
int size = bootstage_get_size();
gd->start_addr_sp -= size;
+ /*
+ * Ensure that start_addr_sp is aligned down to reserve enough
+ * space for new_bootstage
+ */
+ gd->start_addr_sp = ALIGN_DOWN(gd->start_addr_sp, 16);
gd->new_bootstage = map_sysmem(gd->start_addr_sp, size);
debug("Reserving %#x Bytes for bootstage at: %08lx\n", size,
gd->start_addr_sp);