[U-Boot,v2,10/10] bootstage: Allow SPL to obtain bootstage info from TPL
diff mbox series

Message ID 20191021232652.132164-11-sjg@chromium.org
State Accepted
Commit 31f9f0ea571c12e914eda400b242d4a0a4b39f43
Delegated to: Simon Glass
Headers show
Series
  • bootstage: TPL and SPL improvements
Related show

Commit Message

Simon Glass Oct. 21, 2019, 11:26 p.m. UTC
It is possible to enable bootstage in TPL. TPL can stash the info for SPL.
But at present this information is then lost because SPL does not read
from the stash.

Add support for SPL not being the first phase to enable bootstage.
Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2:
- Adjust SPL logic to avoid failing if TPL does not provide bootstage data
- Add a new patch to support %p without DEBUG in tiny-printf

 common/spl/spl.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Comments

Simon Glass Oct. 29, 2019, 11:21 p.m. UTC | #1
It is possible to enable bootstage in TPL. TPL can stash the info for SPL.
But at present this information is then lost because SPL does not read
from the stash.

Add support for SPL not being the first phase to enable bootstage.
Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2:
- Adjust SPL logic to avoid failing if TPL does not provide bootstage data
- Add a new patch to support %p without DEBUG in tiny-printf

 common/spl/spl.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Applied to u-boot-dm, thanks!

Patch
diff mbox series

diff --git a/common/spl/spl.c b/common/spl/spl.c
index eabb1fbc138..f1ad8dc9dab 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -18,6 +18,7 @@ 
 #include <version.h>
 #include <image.h>
 #include <malloc.h>
+#include <mapmem.h>
 #include <dm/root.h>
 #include <linux/compiler.h>
 #include <fdt_support.h>
@@ -396,12 +397,23 @@  static int spl_common_init(bool setup_malloc)
 		gd->malloc_ptr = 0;
 	}
 #endif
-	ret = bootstage_init(true);
+	ret = bootstage_init(u_boot_first_phase());
 	if (ret) {
 		debug("%s: Failed to set up bootstage: ret=%d\n", __func__,
 		      ret);
 		return ret;
 	}
+#ifdef CONFIG_BOOTSTAGE_STASH
+	if (!u_boot_first_phase()) {
+		const void *stash = map_sysmem(CONFIG_BOOTSTAGE_STASH_ADDR,
+					       CONFIG_BOOTSTAGE_STASH_SIZE);
+
+		ret = bootstage_unstash(stash, CONFIG_BOOTSTAGE_STASH_SIZE);
+		if (ret)
+			debug("%s: Failed to unstash bootstage: ret=%d\n",
+			      __func__, ret);
+	}
+#endif /* CONFIG_BOOTSTAGE_STASH */
 	bootstage_mark_name(spl_phase() == PHASE_TPL ? BOOTSTAGE_ID_START_TPL :
 			    BOOTSTAGE_ID_START_SPL, SPL_TPL_NAME);
 #if CONFIG_IS_ENABLED(LOG)