From patchwork Tue Oct 26 00:23:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 516155 Delivered-To: patch@linaro.org Received: by 2002:ad5:4292:0:0:0:0:0 with SMTP id z18csp843858imn; Mon, 25 Oct 2021 17:24:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjqluo883wu8VJcdrWrSLDSXjgR+n40YC4TnxYuoGAdd+4LBangS6AT5VHemQonXitOQmC X-Received: by 2002:a05:6402:508:: with SMTP id m8mr31678214edv.364.1635207867151; Mon, 25 Oct 2021 17:24:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635207867; cv=none; d=google.com; s=arc-20160816; b=xySzxoLetcAcNxEg+MHlFcTlseoQ1+9swRWb5WiMce2AbkdQzeSvGFIrI8WZopdTMA f8wWRLANewodn1j/rxDdUjtk2XBTN9SPs/6XHMFMs2N9TScHtkpGmwANYdxpBZttuXWi qKBIaJfu3N5GBJZH+ubszGoW0/frY+9MtBJ5fE0NBQ+sDr5IbRCkJbQ5MKNVlqejIkLu 7QFir4eKM1TtGf6mjHz45dMBbra+obttjmc/NEXBWXzIC5Ezk3kpf0V7A8jo5eC57xrM ozHp2txma4OxFqZGeDS0WVmlNN0uXia2Q2hgcxRI+kSdhIFbBs4AAF9Vm1BpQufWXdzE 8N+A== 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=eGgRODbKJdzqkvyWJAABcMiRVCArfhs8jv+3zkgP8fQ=; b=gXZ30WykcV6Rw2K+q7o5yF+MqMa6atpDk5nuVB7cenvk48YO+RNF9/bJKsvWG4peVg HjSbol8Kj9w+99EJBKEEvyG8SiQEcs5PjHbj3JjHuH8NS4lbj93UGbhrPytDsN8t5Eld IwYg+AI1s8FtbrqUAsCR8c6vukf9dp78zm80ZZ0kaYkUjQjGM19CgY43oBs4OcM3JpsB JfbR2hDo9CbMGFYvw9jLO3vqF48ylvxVEb54/xfcQFxvStSZ/ja+dJiQ/QcSUFchkh2L QL/IZvDCCsHAuu6wimCPdrXP0zdpNq5AOi6JKmIRTTkGwjG+NdDZy5OlgAY8drJDur84 YgQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=muA0etmk; 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=chromium.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 21si24657069eji.148.2021.10.25.17.24.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 17:24:27 -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=@chromium.org header.s=google header.b=muA0etmk; 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=chromium.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5794D8356E; Tue, 26 Oct 2021 02:24:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="muA0etmk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6FAC38336D; Tue, 26 Oct 2021 02:24:00 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) (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 6B68182127 for ; Tue, 26 Oct 2021 02:23:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oi1-x22e.google.com with SMTP id t4so18003545oie.5 for ; Mon, 25 Oct 2021 17:23:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eGgRODbKJdzqkvyWJAABcMiRVCArfhs8jv+3zkgP8fQ=; b=muA0etmkFAWty1x0CaWpROUo7kud0XkTht3//kGMFYWwprEwqmnWuvVni7uFWWLMIJ s8einA3xCg7l7sLX7Tz0HhK9kP7zp6NBhwmjwZW1WBHtHyYNfMgeQklyBCXybU+JbS1p e2LNDS8usWvrRZ2Fy1PASsd5cO9TzwEeILB3o= 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=eGgRODbKJdzqkvyWJAABcMiRVCArfhs8jv+3zkgP8fQ=; b=DCo6csEaAVk4o8Z8CMXvcJeDoJtsl53PHB0akdQbm3dclIQzf7/ywwuJTeOI8belNj AcWQHwiTxQEdeSvZoVtZWW3e4aisLMKwvon3X3nYrViIwPZDl3T8TCrqCfOJZN/+9hKw QxYdhkIYAcKWzgqKl5KxVteVH9+HGMI90UCHMxmy37jloe5XFyGnro6U5SvQdk77rmb9 cPuxQmF7BYMaoNO96gp7y46FzFpqowxXdsUG98waezNzP93Q+OX5lQUCA6NPiQAMs4VG N2l0bkGzfIwSObs1DOGWXYplGmpYmsv/DtXWR5Y+3tC5O61Y7H8DFskMqz1UCmw31L6D XmuA== X-Gm-Message-State: AOAM5312oknUFjL1AuGqtq9My2AWXXshWlu4WVSDvJGAh9OBPP+VUjXv CsknhFwECBQDgWx1jpRAxO3i3vMmOK0= X-Received: by 2002:a05:6808:f0e:: with SMTP id m14mr14948559oiw.67.1635207833636; Mon, 25 Oct 2021 17:23:53 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id v24sm3331926oou.45.2021.10.25.17.23.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 17:23:53 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mark Kettenis , Heinrich Schuchardt , Ilias Apalodimas , Tom Rini , Sean Anderson , Simon Glass Subject: [PATCH v5 01/26] sandbox: Remove OF_HOSTFILE Date: Mon, 25 Oct 2021 18:23:19 -0600 Message-Id: <20211026002344.405160-2-sjg@chromium.org> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog In-Reply-To: <20211026002344.405160-1-sjg@chromium.org> References: <20211026002344.405160-1-sjg@chromium.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 From: Ilias Apalodimas 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 Signed-off-by: Simon Glass --- (no changes since v1) 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.1079.g6e70778dc9-goog diff --git a/Makefile b/Makefile index 5194e4dc782..c0ea933cb63 100644 --- a/Makefile +++ b/Makefile @@ -947,7 +947,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 @@ -1407,7 +1407,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) @@ -1421,7 +1421,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 48636ab6391..bc67a5a5a10 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 73b1897191d..56dc13c3eb1 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 df9633d762a..931d7a88ff6 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -88,7 +88,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 9a462cb57c4..4c53dbdd5bc 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -113,7 +113,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 11015744e7a..4ddb39147e9 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -69,7 +69,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 b3584563d24..2902492060e 100644 --- a/configs/sandbox_noinst_defconfig +++ b/configs/sandbox_noinst_defconfig @@ -88,7 +88,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 73cf5dd2b04..2f8d297cedf 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -89,7 +89,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 d0e34cb7fa8..da4f5901f07 100644 --- a/configs/tools-only_defconfig +++ b/configs/tools-only_defconfig @@ -16,7 +16,7 @@ CONFIG_AVB_BUF_SIZE=0x8192 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 e84dfb6677a..0e6f85d5af1 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 90c7a1c5f49..99a7a8b0338 100644 --- a/dts/Kconfig +++ b/dts/Kconfig @@ -115,20 +115,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 959b337cdc8..688741108c7 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -1608,11 +1608,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 6f26eb1fa1f..9f93c178943 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -297,10 +297,10 @@ endif # Build the .dtb file if needed # - OF_REAL is enabled -# - we have either OF_SEPARATE or OF_HOSTFILE +# - we have OF_SEPARATE build_dtb := ifneq ($(CONFIG_$(SPL_TPL_)OF_REAL),) -ifeq ($(CONFIG_OF_SEPARATE)$(CONFIG_OF_HOSTFILE),y) +ifeq ($(CONFIG_OF_SEPARATE),y) build_dtb := y endif endif