summaryrefslogtreecommitdiff
path: root/arch/riscv
diff options
context:
space:
mode:
authorVitaly Wool <vitaly.wool@konsulko.com>2021-04-06 10:50:16 +0300
committerLeo Yu-Chi Liang <ycliang@andestech.com>2021-07-21 16:38:26 +0800
commit6ba8eeb6f17c08a7a7fd97683161330d01a8ef2e (patch)
treee72b79a066ba984d541b17b7ec03e437cbf1c747 /arch/riscv
parent66a21be6744bf2926c8bc30100662caeb0fd3667 (diff)
riscv: booti: do not force relocation if force_reloc is not set
If force_reloc flag is not set and booti is called for an address ouside RAM (i. e. QSPI NOR flash), we should honor that and not try to force relocation in a bogus fashion. Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Diffstat (limited to 'arch/riscv')
-rw-r--r--arch/riscv/lib/image.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/riscv/lib/image.c b/arch/riscv/lib/image.c
index 47f2edcf7f..a65a5b8d17 100644
--- a/arch/riscv/lib/image.c
+++ b/arch/riscv/lib/image.c
@@ -50,7 +50,12 @@ int booti_setup(ulong image, ulong *relocated_addr, ulong *size,
return -EINVAL;
}
*size = lhdr->image_size;
- *relocated_addr = gd->ram_base + lhdr->text_offset;
+ if (force_reloc ||
+ (gd->ram_base <= image && image < gd->ram_base + gd->ram_size)) {
+ *relocated_addr = gd->ram_base + lhdr->text_offset;
+ } else {
+ *relocated_addr = image;
+ }
unmap_sysmem(lhdr);