]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
x86: spl: Add a function to find the text base
authorSimon Glass <sjg@chromium.org>
Sun, 24 Jan 2021 17:06:03 +0000 (10:06 -0700)
committerBin Meng <bmeng.cn@gmail.com>
Mon, 1 Feb 2021 07:11:41 +0000 (15:11 +0800)
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 <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
common/spl/spl.c
include/spl.h

index 8cb6f3d531f6e05e087efb86152ebd3077553662..cdd7b05f279ed4c78d6295ecaddf7d2ead57b5f9 100644 (file)
@@ -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
index faffeb519ac5d8c82bc6a0badf03a45b248b5155..e172500b5f8dc42291b77c4647218d5c012a2b5e 100644 (file)
@@ -254,6 +254,16 @@ ulong spl_get_image_pos(void);
  */
 ulong spl_get_image_size(void);
 
+/**
+ * spl_get_image_text_base() - get the text base of the next phase
+ *
+ * This returns the address that the next stage is linked to run at, i.e.
+ * CONFIG_SPL_TEXT_BASE or CONFIG_SYS_TEXT_BASE
+ *
+ * @return text-base address
+ */
+ulong spl_get_image_text_base(void);
+
 /**
  * spl_load_simple_fit_skip_processing() - Hook to allow skipping the FIT
  *     image processing during spl_load_simple_fit().