From patchwork Tue Sep 28 09:05:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 514772 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp4931843jao; Tue, 28 Sep 2021 02:06:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvj7McIVaHZS9vNaA+veDwosrenIhZfR/6TzcwYDdvd0VxoOxThl7nMBbPHDKeGPaRFT7R X-Received: by 2002:a17:906:c05a:: with SMTP id bm26mr5400406ejb.498.1632819965364; Tue, 28 Sep 2021 02:06:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632819965; cv=none; d=google.com; s=arc-20160816; b=Ot8eM8ptVitvVQxauxnbGibrsKxG5PTnSczCM3GZEmDe6uBvvayj+j+YANqZdmmhe7 JcYe8UEJx4QEaqVoUWYSTLDCOirgTry0vjj9p0KFaSur8QZ89/p1mZcFEaLbJXGSrjQm 9AEKZ7+L6zr/tylRPJY5KECnZMjy8BeHe7Q0rqWo3Uc50MC62E72lUTAGE3g4aYA8yAi qpSr35Pu5k97VI4CR/uv8eaeCTvN2/iujA97WnG6aUWL9ryZTgpD9sqLo9hp1Fkoqp+4 2+zpyNpysfXjYaWR7mFEAjj8fkto04BoGypY+vFSF5jfXJul4u32OgJAjDVtyVEoR/zZ Zb5Q== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=/7hFdXfzgx1SW1UMfExBipuB9z7hqUXeCZd+xR4H3qg=; b=BnJGidQayNWYgYgn2NoWkxa8gmSD9qQIQ48bgwARM2YP2FVEO1fOU5+HwWpw3DokeQ oZ2qlh02bASAaKt50pcj1i45YcXbMn3+4UJSOqlx95F52aCFXV3ePcC2DgkkapvJ3dGY m1Xadsy4xSfjvHT2nzbGdBv/NvTcIY0kYE8zq+9M5lRrw8jrwdOaLxVv3Jx8u7zK4kAE NoZmtLAVEMXWi85OLYBEXtTg8Vb7cdvyZAnz6d8I7aJLnguxCsdxsEPpVJJUtDsY/bWB Ht8Uj4R2MDyYZkWfJFghu8Zzxbx7sUfqxipv6UfBFOq1LH6/0dbJIYqPxYUoYixCWaXL cbVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=puGMvdDv; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id oz42si283295ejc.412.2021.09.28.02.06.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 02:06:05 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=puGMvdDv; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 9F51B82E88; Tue, 28 Sep 2021 11:05:59 +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="puGMvdDv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5B70582E88; Tue, 28 Sep 2021 11:05:55 +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-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (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 661738022E for ; Tue, 28 Sep 2021 11:05:49 +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-x431.google.com with SMTP id s21so16689972wra.7 for ; Tue, 28 Sep 2021 02:05:49 -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:mime-version :content-transfer-encoding; bh=/7hFdXfzgx1SW1UMfExBipuB9z7hqUXeCZd+xR4H3qg=; b=puGMvdDv1qdY6+Yms3xWZLxg0COoykDEvBcT2CL5NVmS85vSFEUpm8VuQL14WjqHBL 5Yc04lc76WhZr8AXFlyIeAotzImRt6pugKqg+JDmY8PAMYc++KVQiFGc1AW6vYwu8eYr H8rFBR/KNYf/tlE5pZq/XVXY206dtN1T9r5PbFEOf4pRpmfD7Drw6OEgUURMuR2Owbq0 DHIbjhWPhWbM1MrjLipGi0H5ado0W1JdPnz6DdPj72s+ivgKp+yoM1vFjemPIHtj5Aex tn6D8VTsKGlAnWIKfn1lyBDy6TJQ0oxEgVbkpkyRGcplZJ+VZhIOAPUFYVe1bRIt03M0 jifA== 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:mime-version :content-transfer-encoding; bh=/7hFdXfzgx1SW1UMfExBipuB9z7hqUXeCZd+xR4H3qg=; b=YiZFo1WKoxu9WfzCuCdKPUxRbJEglx4Q+GiRRT848yn5SIo/qeNp+71kZ5rdbbf3q4 WDCY3YA/vkErqKFIo/hT7yIF5B4g8ywprt0KlkxsgA2CcDwQWhvthi8LSUe+2nXTDQLb n19e3KaTQeG90/ceUGIwcqPpLxUs11AGzQPy3rgwxb174D0WULinaH4/BOb7dATa48L9 kaSHFyeyEl1K1uoOcHPP+6Nu6aTwDmrw4wnp30gR8jBXVV8n950z/Mpsq2a1E5UAOZKX 69FsGNNLKwcg1c4j4NNAPEdCHNa7+fNmGjj7fUGfHGXAorJaGnlb8kvFkYS3sOT/IwDn /X5Q== X-Gm-Message-State: AOAM533C74nVxBshGDRkoB07iS+YdJ6pxqjxUJurmQ6b0f1CcMsTmEDs IMdAa2kpVZ+kTnwVyC7YDOslpg== X-Received: by 2002:a5d:648b:: with SMTP id o11mr5113595wri.315.1632819948822; Tue, 28 Sep 2021 02:05:48 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 02:05:48 -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 , Stefan Roese , Rasmus Villemoes , Nicolas Saenz Julienne , AKASHI Takahiro , Wasim Khan , Etienne Carriere , Nandor Han , Alexandru Gagniuc , Steffen Jaeckel , Matthias Brugger , Alper Nebi Yasak , Heiko Schocher , Asherah Connor , Andre Przywara , u-boot@lists.denx.de Subject: [PATCH] sandbox: Remove OF_HOSTFILE Date: Tue, 28 Sep 2021 12:05:40 +0300 Message-Id: <20210928090544.186489-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.33.0 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