VPL has the same needs as TPL in situations where the stack is at the
top of SRAM. Add an option for this and implement it for arm

Signed-off-by: Simon Glass <s...@chromium.org>
---

 arch/arm/lib/crt0_64.S |  4 +++-
 common/spl/Kconfig.vpl | 13 +++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
index 32401f544a7..122e0217470 100644
--- a/arch/arm/lib/crt0_64.S
+++ b/arch/arm/lib/crt0_64.S
@@ -71,7 +71,9 @@ ENTRY(_main)
  */
 #if defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_NEEDS_SEPARATE_STACK)
        ldr     x0, =(CONFIG_TPL_STACK)
-#elif defined(CONFIG_XPL_BUILD) && defined(CONFIG_SPL_STACK)
+#elif defined(CONFIG_VPL_BUILD) && defined(CONFIG_VPL_NEEDS_SEPARATE_STACK)
+       ldr     x0, =(CONFIG_VPL_STACK)
+#elif defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
        ldr     x0, =(CONFIG_SPL_STACK)
 #elif defined(CONFIG_INIT_SP_RELATIVE)
 #if CONFIG_POSITION_INDEPENDENT
diff --git a/common/spl/Kconfig.vpl b/common/spl/Kconfig.vpl
index cf6b36c8e38..d4d4a00d99f 100644
--- a/common/spl/Kconfig.vpl
+++ b/common/spl/Kconfig.vpl
@@ -252,6 +252,12 @@ config VPL_SYS_MALLOC_SIMPLE
          this will make the VPL binary smaller at the cost of more heap
          usage as the *_simple malloc functions do not re-use free-ed mem.
 
+config VPL_NEEDS_SEPARATE_STACK
+       bool "VPL needs a separate initial stack-pointer"
+       help
+         Enable, if the VPL stage should not inherit its initial
+         stack-pointer from the settings for the TPL stage.
+
 config VPL_TEXT_BASE
        hex "VPL Text Base"
        default 0x0
@@ -266,6 +272,13 @@ config VPL_MAX_SIZE
          The maximum size (in bytes) of the TPL stage. This size is determined
          by the amount of internal SRAM memory.
 
+config VPL_STACK
+       hex "Address of the initial stack-pointer for the TPL stage"
+       depends on VPL_NEEDS_SEPARATE_STACK
+       help
+         The address of the initial stack-pointer for the TPL stage.
+         Usually this will be the (aligned) top-of-stack.
+
 config VPL_BINMAN_SYMBOLS
        bool "Declare binman symbols in VPL"
        depends on VPL_FRAMEWORK && BINMAN
-- 
2.43.0

Reply via email to