From patchwork Tue Sep 28 09:05:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 514773 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp4931976jao; Tue, 28 Sep 2021 02:06:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9xDwMmZSo9DnwUgPJsstdGOgvnp+NgmGzkuKd3gJ7PTgLjDHSPf7tHs9X1bfLQ8Z2/s4j X-Received: by 2002:a50:bf05:: with SMTP id f5mr6222279edk.156.1632819977185; Tue, 28 Sep 2021 02:06:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632819977; cv=none; d=google.com; s=arc-20160816; b=p2bKXhRXeYYDELmMIKwfbis56nGHuHOG0B3n3kI6bO+9hMjw5KSDv6WhzWizrfzIPa eMMrVbfrbPgreE2OC+EJxVw1zz7oB67r//K3wQvMORPY28/8dA+14L9n3BmxM2k39wzP 2EOn2rPZVpke8cI17lOplZ1c8zSIXF+3mHy+ZK9gfUC3woGYGm5CqRXRtrVZnzDaJ1yC kqFyvkH1BMVCV/ftvh8ZzSLKTOcAGF24a1QMpOUm3J8O/3TmEoxB6g1yej0TvkaVDQjN bzzKgUcPVMtDHGgZDyuAOor01HPWJtiRFCg1PE8qi+Crld3N6PVF5BuS242rTJ0dNWs2 JJnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/7hFdXfzgx1SW1UMfExBipuB9z7hqUXeCZd+xR4H3qg=; b=g6rpuDPUm+KcxhRHV4E/yto0CWTag19sbFWWUaKi6f9ChcAQc2cVa6mthKVKuGRgAS AARM+TfXFflbfYjO72pVD6mcY+uDJUJz1+Ylzn3OJawX0d9aHWLdSOf0hv0uybV4wJdW KpJ07W1zBQVpRtWGHsQ5OTCANg+3HSmEdbqjAm6sNNpetgC0JJFq7lOA6mUgqbv5djmD jaY/V5f+9JeQNYGUi/NwDuNrVeGUZH3uwi4BqPJ12nYndvSULuvTM/+LOmcNlrMQienJ mRFSvO4jgkHRFIYv0k9TKgp67tiyCtAljQlxZbE1nSeL55a8disSa60WapZjcsVn43ry Cmaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vLFCTDO1; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id d17si19923660edy.412.2021.09.28.02.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 02:06:17 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vLFCTDO1; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 122CD82FC0; Tue, 28 Sep 2021 11:06:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="vLFCTDO1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4D83A82E8E; Tue, 28 Sep 2021 11:06:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_FILL_THIS_FORM_SHORT autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E0BE182EE0 for ; Tue, 28 Sep 2021 11:05:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wr1-x429.google.com with SMTP id r23so31382687wra.6 for ; Tue, 28 Sep 2021 02:05:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/7hFdXfzgx1SW1UMfExBipuB9z7hqUXeCZd+xR4H3qg=; b=vLFCTDO1I6LGlGsmsDZT/p1zphvINfExen8bSBZEgTpI5HDYtJGTHH6pS4SE9brZO5 R87nlgF9Eq0+14ZqhOnwWeojfwH+KehW4aPnXNKv1xMaKBQkmDce/IkQ4Muvhu5xNg9e LYRLDulCQQDvv7feUndWtLB7K8XUa+PetzLTDrZ+YcThP+B7Lg+jYFU5siv6IVJb93+R r54HCFDZASA7rIty3XhnN77SUQygPWp7GhBt+HFVzlcgMstEKi6zAItqqp3v571ycetg cb0+GlqkTf9SaM42xUHHGjgg/z46i/XKfbUhsXd/E5uLQaDlCUWwlhLw4pwA5o6S67KN zIZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/7hFdXfzgx1SW1UMfExBipuB9z7hqUXeCZd+xR4H3qg=; b=LjVJXxgTY76DeipMGhxiV5BJa5FW02RpOc9ZUTuxSDEHPDk96D0SKqJ7SLcxmMYuBF wFT1ykfsiCKuUsRCzO4ihZn8pXVjfzOJ0ev6ui3dUy33nXYLOWxeYTwS6PeiMuaipr5w 64RJUq941qqTL5FSBbKz6wt/0SSG3Wja2/hFD+ingwONl8OtVVsRcWOBAIsfX+OklY2i LwJj0RCy06l0cpQUUz+LPunoVrCQMQe+22AfhNEdm0IMtlWp7JVcN8xyM8v9rSDIUoTg HVwDWzo0AscxEelsSWyclJ89h9vOQH/tATCQekL5pm2Z2SjrDT35siStBTixyDWWwiPX 8t6w== X-Gm-Message-State: AOAM5302gTqoAMiWiUJcY0dy03Amew7Di87XvGohixY4f41oE28lrlvD 044SGUPmdkdLjzddwAcB/81LHg== X-Received: by 2002:a5d:4e47:: with SMTP id r7mr5071197wrt.417.1632819953426; Tue, 28 Sep 2021 02:05:53 -0700 (PDT) Received: from apalos.home ([2a02:587:4672:866:2e56:dcff:fe9a:8f06]) by smtp.gmail.com with ESMTPSA id y197sm2432299wmc.18.2021.09.28.02.05.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 02:05:53 -0700 (PDT) From: Ilias Apalodimas To: trini@konsulko.com Cc: Ilias Apalodimas , Simon Glass , =?utf-8?q?Pali_Roh=C3=A1r?= , =?utf-8?q?Marek_Beh=C3=BAn?= , Bin Meng , Chee Hong Ang , Heinrich Schuchardt , Sean Anderson , Patrick Delaunay , Joe Hershberger , Nicolas Saenz Julienne , Wasim Khan , AKASHI Takahiro , Etienne Carriere , Alexandru Gagniuc , Nandor Han , Steffen Jaeckel , Heiko Schocher , Asherah Connor , Andre Przywara , u-boot@lists.denx.de Subject: [PATCH] sandbox: Remove OF_HOSTFILE Date: Tue, 28 Sep 2021 12:05:41 +0300 Message-Id: <20210928090544.186489-2-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210928090544.186489-1-ilias.apalodimas@linaro.org> References: <20210928090544.186489-1-ilias.apalodimas@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean OF_HOSTFILE is used on sandbox configs only. Although it's pretty unique not a source of any confusions, we are better of having simple config options for the DTB. So let's replace that with the existing OF_BOARD. This will make U-Boot have only three different config options for the DTB origin. - OF_SEPARATE, build separately from U-Boot - OF_BOARD, board specific way of providing the DTB - OF_EMBED embedded in the u-boot binary, but discouraged from being used in production Signed-off-by: Ilias Apalodimas --- Makefile | 6 +++--- arch/sandbox/cpu/cpu.c | 21 ++++++++++++--------- arch/sandbox/include/asm/u-boot-sandbox.h | 8 -------- configs/sandbox64_defconfig | 2 +- configs/sandbox_defconfig | 2 +- configs/sandbox_flattree_defconfig | 2 +- configs/sandbox_noinst_defconfig | 2 +- configs/sandbox_spl_defconfig | 2 +- configs/tools-only_defconfig | 2 +- doc/develop/devicetree/control.rst | 7 +++---- dts/Kconfig | 9 --------- lib/fdtdec.c | 5 ----- scripts/Makefile.spl | 4 ++-- 13 files changed, 26 insertions(+), 46 deletions(-) -- 2.33.0 diff --git a/Makefile b/Makefile index 3014788e14e8..cf3d98d00a62 100644 --- a/Makefile +++ b/Makefile @@ -957,7 +957,7 @@ INPUTS-$(CONFIG_BINMAN_STANDALONE_FDT) += u-boot.dtb ifeq ($(CONFIG_SPL_FRAMEWORK),y) INPUTS-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img endif -INPUTS-$(CONFIG_OF_HOSTFILE) += u-boot.dtb +INPUTS-$(CONFIG_SANDBOX) += u-boot.dtb ifneq ($(CONFIG_SPL_TARGET),) INPUTS-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%) endif @@ -1423,7 +1423,7 @@ u-boot-lzma.img: u-boot.bin.lzma FORCE u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \ $(if $(CONFIG_SPL_LOAD_FIT),u-boot-nodtb.bin \ - $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_OF_HOSTFILE)$(CONFIG_BINMAN_STANDALONE_FDT),dts/dt.dtb) \ + $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SANDBOX)$(CONFIG_BINMAN_STANDALONE_FDT),dts/dt.dtb) \ ,$(UBOOT_BIN)) FORCE $(call if_changed,mkimage) $(BOARD_SIZE_CHECK) @@ -1437,7 +1437,7 @@ MKIMAGEFLAGS_u-boot.itb += -B 0x8 ifdef U_BOOT_ITS u-boot.itb: u-boot-nodtb.bin \ - $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_OF_HOSTFILE),dts/dt.dtb) \ + $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SANDBOX),dts/dt.dtb) \ $(U_BOOT_ITS) FORCE $(call if_changed,mkfitimage) $(BOARD_SIZE_CHECK) diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index 48636ab63919..bc67a5a5a10b 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -291,44 +291,47 @@ void invalidate_dcache_range(unsigned long start, unsigned long stop) { } -int sandbox_read_fdt_from_file(void) +void *board_fdt_blob_setup(void) { struct sandbox_state *state = state_get_current(); const char *fname = state->fdt_fname; - void *blob; + void *blob = NULL; loff_t size; int err; int fd; + printf("SETUP BLOB\n"); blob = map_sysmem(CONFIG_SYS_FDT_LOAD_ADDR, 0); if (!state->fdt_fname) { err = fdt_create_empty_tree(blob, 256); if (!err) goto done; printf("Unable to create empty FDT: %s\n", fdt_strerror(err)); - return -EINVAL; + goto fail; } err = os_get_filesize(fname, &size); if (err < 0) { printf("Failed to file FDT file '%s'\n", fname); - return err; + goto fail; } fd = os_open(fname, OS_O_RDONLY); if (fd < 0) { printf("Failed to open FDT file '%s'\n", fname); - return -EACCES; + goto fail; } + if (os_read(fd, blob, size) != size) { os_close(fd); - return -EIO; + printf("Failed to read file '%s'\n", fname); + goto fail; } os_close(fd); done: - gd->fdt_blob = blob; - - return 0; + return blob; +fail: + return NULL; } ulong timer_get_boot_us(void) diff --git a/arch/sandbox/include/asm/u-boot-sandbox.h b/arch/sandbox/include/asm/u-boot-sandbox.h index 73b1897191d5..56dc13c3eb11 100644 --- a/arch/sandbox/include/asm/u-boot-sandbox.h +++ b/arch/sandbox/include/asm/u-boot-sandbox.h @@ -76,14 +76,6 @@ int pci_unmap_physmem(const void *addr, unsigned long len, */ void sandbox_set_enable_pci_map(int enable); -/** - * sandbox_read_fdt_from_file() - Read a device tree from a file - * - * Read a device tree file from a host file and set it up for use as the - * control FDT. - */ -int sandbox_read_fdt_from_file(void); - /** * sandbox_reset() - reset sandbox * diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index f7098b496983..358a6c168259 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -86,7 +86,7 @@ CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y CONFIG_OF_LIVE=y -CONFIG_OF_HOSTFILE=y +CONFIG_OF_BOARD=y CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_EXT4=y CONFIG_ENV_EXT4_INTERFACE="host" diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index ea08a9e5bd18..b8f8d8cf4454 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -110,7 +110,7 @@ CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y CONFIG_OF_LIVE=y -CONFIG_OF_HOSTFILE=y +CONFIG_OF_BOARD=y CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_EXT4=y CONFIG_ENV_EXT4_INTERFACE="host" diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index a6e2544dc138..7aceaf5ad05b 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -67,7 +67,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y -CONFIG_OF_HOSTFILE=y +CONFIG_OF_BOARD=y CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_EXT4=y CONFIG_ENV_EXT4_INTERFACE="host" diff --git a/configs/sandbox_noinst_defconfig b/configs/sandbox_noinst_defconfig index 88443f5ab274..8aec5df6f11b 100644 --- a/configs/sandbox_noinst_defconfig +++ b/configs/sandbox_noinst_defconfig @@ -85,7 +85,7 @@ CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y -CONFIG_OF_HOSTFILE=y +CONFIG_OF_BOARD=y CONFIG_SPL_OF_PLATDATA=y CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_EXT4=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index 77dd83cf6fdd..c889049c9132 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -86,7 +86,7 @@ CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y -CONFIG_OF_HOSTFILE=y +CONFIG_OF_BOARD=y CONFIG_SPL_OF_PLATDATA=y CONFIG_SPL_OF_PLATDATA_INST=y CONFIG_ENV_IS_NOWHERE=y diff --git a/configs/tools-only_defconfig b/configs/tools-only_defconfig index f54bc1802ca7..ea38ef15532b 100644 --- a/configs/tools-only_defconfig +++ b/configs/tools-only_defconfig @@ -12,7 +12,7 @@ CONFIG_MISC_INIT_F=y CONFIG_BOOTP_DNS2=y # CONFIG_CMD_DATE is not set CONFIG_OF_CONTROL=y -CONFIG_OF_HOSTFILE=y +CONFIG_OF_BOARD=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_IP_DEFRAG=y diff --git a/doc/develop/devicetree/control.rst b/doc/develop/devicetree/control.rst index e84dfb6677a6..0e6f85d5af11 100644 --- a/doc/develop/devicetree/control.rst +++ b/doc/develop/devicetree/control.rst @@ -108,10 +108,9 @@ If CONFIG_OF_BOARD is defined, 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 CONFIG_OF_HOSTFILE is defined, then it will be read from a file on -startup. This is only useful for sandbox. Use the -d flag to U-Boot to -specify the file to read, -D for the default and -T for the test devicetree, -used to run sandbox unit tests. +If CONFIG_SANDBOX is defined, then it will be read from a file on +startup. Use the -d flag to U-Boot to specify the file to read, -D for the +default and -T for the test devicetree, used to run sandbox unit tests. You cannot use more than one of these options at the same time. diff --git a/dts/Kconfig b/dts/Kconfig index 100769017e12..60d56cf6a907 100644 --- a/dts/Kconfig +++ b/dts/Kconfig @@ -108,20 +108,11 @@ config OF_EMBED config OF_BOARD bool "Provided by the board (e.g a previous loader) at runtime" - depends on !SANDBOX help If this option is enabled, the device tree will be provided by the board at runtime if the board supports it, instead of being bundled with the image. -config OF_HOSTFILE - bool "Host filed DTB for DT control" - depends on SANDBOX - help - If this option is enabled, DTB will be read from a file on startup. - This is only useful for Sandbox. Use the -d flag to U-Boot to - specify the file to read. - endchoice config DEFAULT_DEVICE_TREE diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 7b379564600d..e84472dc2e59 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -1575,11 +1575,6 @@ int fdtdec_setup(void) # elif defined(CONFIG_OF_BOARD) || defined(CONFIG_OF_SEPARATE) /* Allow the board to override the fdt address. */ gd->fdt_blob = board_fdt_blob_setup(); -# elif defined(CONFIG_OF_HOSTFILE) - if (sandbox_read_fdt_from_file()) { - puts("Failed to read control FDT\n"); - return -1; - } # endif # ifndef CONFIG_SPL_BUILD /* Allow the early environment to override the fdt address */ diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 25a3e7fa52e9..fa362495e1b4 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -298,11 +298,11 @@ endif # Build the .dtb file if: # - we are not using OF_PLATDATA # - we are using OF_CONTROL -# - we have either OF_SEPARATE or OF_HOSTFILE +# - we have either OF_SEPARATE or we are compiling for sandbox build_dtb := ifeq ($(CONFIG_$(SPL_TPL_)OF_PLATDATA),) ifneq ($(CONFIG_$(SPL_TPL_)OF_CONTROL),) -ifeq ($(CONFIG_OF_SEPARATE)$(CONFIG_OF_HOSTFILE),y) +ifeq ($(CONFIG_OF_SEPARATE)$(CONFIG_SANDBOX_SPL),y) build_dtb := y endif endif