]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
bootstage: Allow SPL to obtain bootstage info from TPL
authorSimon Glass <sjg@chromium.org>
Mon, 21 Oct 2019 23:26:52 +0000 (17:26 -0600)
committerSimon Glass <sjg@chromium.org>
Sun, 27 Oct 2019 16:56:51 +0000 (10:56 -0600)
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>
common/spl/spl.c

index eabb1fbc1383863eb5909196a04ce06cefdc58fd..f1ad8dc9dabf668d750ed2f3e725ab71d26976a9 100644 (file)
@@ -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)