From 86c372af1abd02f6d81c287159e5d80bb27b8ae4 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 24 Jan 2021 10:06:03 -0700 Subject: x86: spl: Add a function to find the text base It is useful to know the TEXT_BASE value for the image being loaded in TPL/SPL. Add a new spl_get_image_text_base() function to handle this. Make use of this in the x86 SPL handler, instead of having the logic there. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- common/spl/spl.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'common/spl') diff --git a/common/spl/spl.c b/common/spl/spl.c index 8cb6f3d531f..cdd7b05f279 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -144,6 +144,12 @@ ulong spl_get_image_size(void) binman_sym(ulong, u_boot_any, size); } +ulong spl_get_image_text_base(void) +{ + return spl_phase() == PHASE_TPL ? CONFIG_SPL_TEXT_BASE : + CONFIG_SYS_TEXT_BASE; +} + /* * Weak default function for board specific cleanup/preparation before * Linux boot. Some boards/platforms might not need it, so just provide -- cgit v1.2.3