From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Wed, 26 Sep 2018 15:55:02 -0600 Subject: [U-Boot] [PATCH 04/22] spl: Set up the bloblist in SPL In-Reply-To: <20180926215520.87168-1-sjg@chromium.org> References: <20180926215520.87168-1-sjg@chromium.org> Message-ID: <20180926215520.87168-5-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de The bloblist is normally set up in SPL ready for use by U-Boot. Add a simple implementation of this to the common SPL code. Signed-off-by: Simon Glass --- common/spl/spl.c | 18 ++++++++++++++++-- include/spl.h | 27 +++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/common/spl/spl.c b/common/spl/spl.c index 933d290c87e..ea86f0353cd 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -340,6 +341,14 @@ static int spl_common_init(bool setup_malloc) return ret; } #endif + if (CONFIG_IS_ENABLED(BLOBLIST)) { + ret = bloblist_init(); + if (ret) { + debug("%s: Failed to set up bloblist: ret=%d\n", + __func__, ret); + return ret; + } + } if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) { ret = fdtdec_setup(); if (ret) { @@ -478,6 +487,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) BOOT_DEVICE_NONE, }; struct spl_image_info spl_image; + int ret; debug(">>spl:board_init_r()\n"); @@ -524,6 +534,12 @@ void board_init_r(gd_t *dummy1, ulong dummy2) } spl_perform_fixups(&spl_image); + if (CONFIG_IS_ENABLED(BLOBLIST)) { + ret = bloblist_finish(); + if (ret) + printf("Warning: Failed to finish bloblist (ret=%d)\n", + ret); + } #ifdef CONFIG_CPU_V7M spl_image.entry_point |= 0x1; @@ -553,8 +569,6 @@ void board_init_r(gd_t *dummy1, ulong dummy2) gd->malloc_ptr / 1024); #endif #ifdef CONFIG_BOOTSTAGE_STASH - int ret; - bootstage_mark_name(BOOTSTAGE_ID_END_SPL, "end_spl"); ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR, CONFIG_BOOTSTAGE_STASH_SIZE); diff --git a/include/spl.h b/include/spl.h index 7fad62c043e..9d3ba3486d6 100644 --- a/include/spl.h +++ b/include/spl.h @@ -21,6 +21,33 @@ #define MMCSD_MODE_FS 2 #define MMCSD_MODE_EMMCBOOT 3 +/* + * u_boot_first_phase() - check if this is the first U-Boot phase + * + * U-Boot has up to three phases: TPL, SPL and U-Boot proper. Depending on the + * build flags we can determine whether the current build is for the first + * phase of U-Boot or not. If there is no SPL, then this is U-Boot proper. If + * there is SPL but no TPL, the the first phase is SPL. If there is TPL, then + * it is the first phase. + * + * @returns true if this is the first phase of U-Boot + * + */ +static inline bool u_boot_first_phase(void) +{ + if (IS_ENABLED(CONFIG_TPL)) { + if (IS_ENABLED(CONFIG_TPL_BUILD)) + return true; + } else if (IS_ENABLED(CONFIG_SPL)) { + if (IS_ENABLED(CONFIG_SPL_BUILD)) + return true; + } else { + return true; + } + + return false; +} + struct spl_image_info { const char *name; u8 os; -- 2.19.0.605.g01d371f741-goog