Add an option which indicates that the devicetree comes from the bloblist. After discussions with Tom, it seems we are comfortable with introducing this option, ensuring of course that the transfer list is properly supported.
Signed-off-by: Simon Glass <s...@chromium.org> --- doc/develop/devicetree/control.rst | 3 ++ dts/Kconfig | 8 ++++ lib/fdtdec.c | 66 ++++++++++++------------------ 3 files changed, 38 insertions(+), 39 deletions(-) diff --git a/doc/develop/devicetree/control.rst b/doc/develop/devicetree/control.rst index 0233945f8b6..d80f4d420a9 100644 --- a/doc/develop/devicetree/control.rst +++ b/doc/develop/devicetree/control.rst @@ -137,6 +137,9 @@ If `OF_BOARD` is selected by Kconfig, a board-specific routine will provide the devicetree at runtime, for example if an earlier bootloader stage creates it and passes it to U-Boot. +If `OF_BLOBLIST` is defined, the devicetree comes from a bloblist passed +from a previous stage. + If `BLOBLIST` is selected by Kconfig, the devicetree may come from a bloblist passed from a previous stage, if present. diff --git a/dts/Kconfig b/dts/Kconfig index 6a5141b56e9..04359a4d7b2 100644 --- a/dts/Kconfig +++ b/dts/Kconfig @@ -167,6 +167,14 @@ config OF_INITIAL_DTB_READONLY If initial DTB for DT control is read-only (e.g. points to memory-mapped flash memory), then set this option. +config OF_BLOBLIST + bool "DTB is provided by a bloblist" + help + Select this to read the devicetree from the bloblist. This allows + using a bloblist to transfer the devicetree between U-Boot phases. + The devicetree is stored in the bloblist by an earlier phase so that + U-Boot can read it. + config OF_BOARD bool "Provided by the board (e.g a previous loader) at runtime" default y if SANDBOX || OF_HAS_PRIOR_STAGE diff --git a/lib/fdtdec.c b/lib/fdtdec.c index f09c9926a7a..833f8aca3ce 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -1689,55 +1689,43 @@ void fdtdec_setup_embed(void) int fdtdec_setup(void) { - int ret = -ENOENT; + int ret; - /* - * If allowing a bloblist, check that first. There was discussion about - * adding an OF_BLOBLIST Kconfig, but this was rejected. - * - * The necessary test is whether the previous phase passed a bloblist, - * not whether this phase creates one. - */ - if (CONFIG_IS_ENABLED(BLOBLIST) && - (xpl_prev_phase() != PHASE_TPL || - IS_ENABLED(CONFIG_TPL_BLOBLIST))) { + if (CONFIG_IS_ENABLED(OF_BLOBLIST)) { ret = bloblist_maybe_init(); - if (!ret) { - gd->fdt_blob = bloblist_find(BLOBLISTT_CONTROL_FDT, 0); - if (gd->fdt_blob) { - gd->fdt_src = FDTSRC_BLOBLIST; - log_debug("Devicetree is in bloblist at %p\n", - gd->fdt_blob); - ret = 0; - } else { - log_debug("No FDT found in bloblist\n"); - ret = -ENOENT; - } + if (ret) + return ret; + gd->fdt_blob = bloblist_find(BLOBLISTT_CONTROL_FDT, 0); + if (!gd->fdt_blob) { + printf("Not FDT found in bloblist\n"); + bloblist_show_list(); + return -ENOENT; } - } - - /* Otherwise, the devicetree is typically appended to U-Boot */ - if (ret) { + gd->fdt_src = FDTSRC_BLOBLIST; + bloblist_show_list(); + log_debug("Devicetree is in bloblist at %p\n", gd->fdt_blob); + } else { if (IS_ENABLED(CONFIG_OF_SEPARATE)) { gd->fdt_blob = fdt_find_separate(); gd->fdt_src = FDTSRC_SEPARATE; } else { /* embed dtb in ELF file for testing / development */ - fdtdec_setup_embed(); + gd->fdt_blob = dtb_dt_embedded(); + gd->fdt_src = FDTSRC_EMBED; } - } - /* Allow the board to override the fdt address. */ - if (IS_ENABLED(CONFIG_OF_BOARD)) { - void *blob; + /* Allow the board to override the fdt address. */ + if (IS_ENABLED(CONFIG_OF_BOARD)) { + void *blob; - blob = (void *)gd->fdt_blob; - ret = board_fdt_blob_setup(&blob); - if (ret) { - if (ret != -EEXIST) - return ret; - } else { - gd->fdt_src = FDTSRC_BOARD; - gd->fdt_blob = blob; + blob = (void *)gd->fdt_blob; + ret = board_fdt_blob_setup(&blob); + if (ret) { + if (ret != -EEXIST) + return ret; + } else { + gd->fdt_src = FDTSRC_BOARD; + gd->fdt_blob = blob; + } } } -- 2.43.0