From patchwork Thu Aug 19 03:40:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1518338 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=MtPGumDA; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GqrCT0lrTz9sW8 for ; Thu, 19 Aug 2021 13:41:08 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6230982E67; Thu, 19 Aug 2021 05:40:56 +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="MtPGumDA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1533782E85; Thu, 19 Aug 2021 05:40:50 +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.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) (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 F32D682DD7 for ; Thu, 19 Aug 2021 05:40:42 +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-x22c.google.com with SMTP id u10so6655918oiw.4 for ; Wed, 18 Aug 2021 20:40:42 -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=EQWi8kydank6unHCW/H7K1JJJnv6kVmLjtEPbxVn4s4=; b=MtPGumDAV3Lz1S5NbQtzj8u+PEpNIL1Puo2PzsMKXMZLvWksRYG3HeJ37IDPnKgDdl cgpnHAe5aT88xmWahtwxLvZESLJ/L5pHW9oTVgOVcZSD/BBGnW8QjHcLB+jZAqZ+8eMd 9tez0jWUmjshex1u6fIMKx6F0VaVnr8e3j3jE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EQWi8kydank6unHCW/H7K1JJJnv6kVmLjtEPbxVn4s4=; b=pwvHb2dheOxY+gQMjozAn0XI3YB8q0SDHyN00fgEtqbeS0Dig8YHwHT1JkGjnRur8A VKGaPAE8wvR3RRbaMj+YJhUCm44KLSxc/JQ+Dz+pcQbA3ze/xQu3KcX7NJk/7eMT6VU5 ypL42siwGdygzH+Ffmo2rBCcVEC6HFyCjJiyDSt8lPM+6VPI9xT5/QNPbnK//HcMv59y CfROiT5L7jTgMy3Ft8Ssus3t86cFS7vMQYHDxlqtz0Ga/4qsMRIaEzKWrNOc5WLJ67Md YBLDLL2jtHww3LhOBMRJkPOGhzPSF42pgIAVE3HDPet/lFZK3ytc4NXR8YeOXB0kHoNX vt4A== X-Gm-Message-State: AOAM532+V0XfSzoiRZ1nOo7FgbONH55qjdClfKDizJIcel18SpkG0/ed 3BbW5OODjSzbgxRlL0CXmc50I924caudFQ== X-Google-Smtp-Source: ABdhPJyPZWM3fsnTgItei0bKXOD/nROo6DfpmCHxF7+TUa4d3RmXJZmj0ma5q3ukHws3Os5Ek45V4g== X-Received: by 2002:aca:b656:: with SMTP id g83mr1134481oif.84.1629344441126; Wed, 18 Aug 2021 20:40:41 -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 q27sm415877oof.12.2021.08.18.20.40.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 20:40:40 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Walter Lozano Subject: [PATCH 01/11] dtoc: Further improve documentation about warnings Date: Wed, 18 Aug 2021 21:40:23 -0600 Message-Id: <20210819034033.1617201-2-sjg@chromium.org> X-Mailer: git-send-email 2.33.0.rc1.237.g0d66db33f3-goog In-Reply-To: <20210819034033.1617201-1-sjg@chromium.org> References: <20210819034033.1617201-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 Split this information into subsections and expand it. Signed-off-by: Simon Glass --- doc/develop/driver-model/of-plat.rst | 92 ++++++++++++++++++++++++++-- 1 file changed, 88 insertions(+), 4 deletions(-) diff --git a/doc/develop/driver-model/of-plat.rst b/doc/develop/driver-model/of-plat.rst index 8a8eaed4c11..0bd978759c7 100644 --- a/doc/develop/driver-model/of-plat.rst +++ b/doc/develop/driver-model/of-plat.rst @@ -600,6 +600,11 @@ as a macro included in the driver definition:: Problems -------- +This section shows some common problems and how to fix them. + +Driver not found +~~~~~~~~~~~~~~~~ + In some cases you will you see something like this:: WARNING: the driver rockchip_rk3188_grf was not found in the driver list @@ -633,6 +638,9 @@ the devicetree. For example, if the devicetree has:: then dtoc looks at the first compatible string ("rockchip,rk3188-grf"), converts that to a C identifier (rockchip_rk3188_grf) and then looks for that. +Missing .compatible or Missing .id +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Various things can cause dtoc to fail to find the driver and it tries to warn about these. For example: @@ -649,6 +657,82 @@ Checks are also made to confirm that the referenced driver has a .compatible member and a .id member. The first provides the array of compatible strings and the second provides the uclass ID. +Missing parent +~~~~~~~~~~~~~~ + +When a device is used, its parent must be present as well. If you see an error +like:: + + Node '/i2c@0/emul/emul0' requires parent node '/i2c@0/emul' but it is not in + the valid list + +it indicates that you are using a node whose parent is not present in the +devicetree. In this example, if you look at the device tree output +(e.g. fdtdump tpl/u-boot-tpl.dtb in your build directory), you may see something +like this:: + + emul { + emul0 { + compatible = "sandbox,i2c-rtc-emul"; + #emul-cells = <0x00000000>; + phandle = <0x00000003>; + }; + }; + +In this example, 'emul0' exists but its parent 'emul' has no properties. These +have been dropped by fdtgrep in an effort to reduce the devicetree size. This +indicates that the two nodes have different phase settings. Looking at the +source .dts:: + + i2c_emul: emul { + u-boot,dm-spl; + reg = <0xff>; + compatible = "sandbox,i2c-emul-parent"; + emul0: emul0 { + u-boot,dm-pre-reloc; + compatible = "sandbox,i2c-rtc-emul"; + #emul-cells = <0>; + }; + }; + +you can see that the child node 'emul0' usees 'u-boot,dm-pre-reloc', indicating +that the node is present in all SPL builds, but its parent uses 'u-boot,dm-spl' +indicating it is only present in SPL, not TPL. For a TPL build, this will fail +with the above message. The fix is to change 'emul0' to use the same +'u-boot,dm-spl' condition, so that it is not present in TPL, like its parent. + +Link errors / undefined reference +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Sometimes dtoc does not find the problem for you, but something is wrong and +you get a link error, e.g.:: + + :(.u_boot_list_2_udevice_2_spl_test5+0x0): undefined reference to + `_u_boot_list_2_driver_2_sandbox_spl_test' + /usr/bin/ld: dts/dt-uclass.o:(.u_boot_list_2_uclass_2_misc+0x8): + undefined reference to `_u_boot_list_2_uclass_driver_2_misc' + +The first one indicates that the device cannot find its driver. This means that +there is a driver 'sandbox_spl_test' but it is not compiled into the build. +Check your Kconfig settings to make sure it is. If you don't want that in the +build, adjust your phase settings, e.g. by using 'u-boot,dm-spl' in the node +to exclude it from the TPL build:: + + spl-test5 { + u-boot,dm-tpl; + compatible = "sandbox,spl-test"; + stringarray = "tpl"; + }; + +We can drop the 'u-boot,dm-tpl' line so this node won't appear in the TPL +devicetree and thus the driver won't be needed. + +The second error above indicates that the MISC uclass is needed by the driver +(since it is in the MISC uclass) but that uclass is not compiled in the build. +The fix above would fix this error too. But if you do want this uclass in the +build, check your Kconfig settings to make sure the uclass is being built +(CONFIG_MISC in this case). + Caveats ------- @@ -697,7 +781,7 @@ Internals --------- Generated files -``````````````` +~~~~~~~~~~~~~~~ When enabled, dtoc generates the following five files: @@ -738,7 +822,7 @@ spl/dt-plat.c. CONFIG options -`````````````` +~~~~~~~~~~~~~~ Several CONFIG options are used to control the behaviour of of-platdata, all available for both SPL and TPL: @@ -793,7 +877,7 @@ READ_ONLY the nodes cannot be updated, OF_PLATDATA_NO_BIND is enabled. Data structures -``````````````` +~~~~~~~~~~~~~~~ A few extra data structures are used with of-platdata: @@ -821,7 +905,7 @@ A few extra data structures are used with of-platdata: `device_get_by_ofplat_idx()`. Other changes -````````````` +~~~~~~~~~~~~~ Some other changes are made with of-platdata: From patchwork Thu Aug 19 03:40:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1518339 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=RuHrxTZe; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GqrCg2rtFz9sW8 for ; Thu, 19 Aug 2021 13:41:19 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3A7DF82D74; Thu, 19 Aug 2021 05:41:14 +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="RuHrxTZe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7DDAE82DD7; Thu, 19 Aug 2021 05:40:51 +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.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) (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 C745E82DE8 for ; Thu, 19 Aug 2021 05:40:43 +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-ot1-x32b.google.com with SMTP id 108-20020a9d01750000b029050e5cc11ae3so6984832otu.5 for ; Wed, 18 Aug 2021 20:40:43 -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=i+Lce8buIEtTh9OT5nOulz2ZLCTq+/RpDEbTPDoxC9c=; b=RuHrxTZeWLFCwcCn/sa5KcW1czPiYj+/lXcaYC/GfT8q3uO6xKbYvUuje9e8SN2fg8 B/Pub5qw4Wx1MZsHjCaRfGtb9yUTEnwPNkizeSMosQSOIAJ7e0gdBmVACSYRvz9HuEiu PGDtPyqSHmZcNSXUgoCu71llEQ8v7fU6w/k7A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i+Lce8buIEtTh9OT5nOulz2ZLCTq+/RpDEbTPDoxC9c=; b=Sb0twhB7IOuNMx0SkHuGACjbco0zz29HXx2m9tkX99zEbXKzRsBEs27ITUdWO4EIZa CiHPzdqwDHz696OCqk9pbN5fYC6vbrosjaHcn3TrlvxwnNz3m5sGsq9fJ5hXMtT5Nl5v OWoAXVNqSgjrCzlJcrTNCJBOeb0nXXK00BvA9AojoKlquynTzfkC3aP/hw4ANE6VJG3P Mi5lgF2Nuj6iE+GamY7uSWYK6iLJAdF77B05sw6J3iM7VoXhWj3C3SvmovzwPQBvT5Cj EU/NZW4YUuf8ooxZyvNm3d0BAC73crmZgiezq2jq5jereZKUUq3lP3X1PWbxjbp2oEFF fHOg== X-Gm-Message-State: AOAM5332yNEKbetwzVgtIo0GEYxqJmLVpOxBxL4X6usdiAUXyfR21xbh q/rUOxZr6a6nrWw+XTnOjDfHSlb2/E7bqA== X-Google-Smtp-Source: ABdhPJx2cKiWKHjNBn/FloyqIpeBZTYBJffdl/1XaLix78H53qohsIPDL/fH2edJ+Vsl74mDHfHICg== X-Received: by 2002:a9d:bf0:: with SMTP id 103mr6309290oth.212.1629344442315; Wed, 18 Aug 2021 20:40:42 -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 q27sm415877oof.12.2021.08.18.20.40.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 20:40:41 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Heinrich Schuchardt , =?utf-8?q?Marek_Beh=C3=BAn?= , Patrick Delaunay Subject: [PATCH 02/11] sandbox: Correct handling of --rm_memory Date: Wed, 18 Aug 2021 21:40:24 -0600 Message-Id: <20210819034033.1617201-3-sjg@chromium.org> X-Mailer: git-send-email 2.33.0.rc1.237.g0d66db33f3-goog In-Reply-To: <20210819034033.1617201-1-sjg@chromium.org> References: <20210819034033.1617201-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 This option has no argument so we should not trip to skip one. Fix it. Signed-off-by: Simon Glass --- arch/sandbox/cpu/os.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 1103530941b..151f42a5d6c 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -690,7 +690,6 @@ static int add_args(char ***argvp, char *add_args[], int count) continue; } } else if (!strcmp(arg, "--rm_memory")) { - ap++; continue; } argv[argc++] = arg; From patchwork Thu Aug 19 03:40:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1518341 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ORMx1umG; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GqrD54mtKz9sW8 for ; Thu, 19 Aug 2021 13:41:41 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 312C782EE5; Thu, 19 Aug 2021 05:41:21 +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="ORMx1umG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6F85982DF6; Thu, 19 Aug 2021 05:40: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.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-oo1-xc2e.google.com (mail-oo1-xc2e.google.com [IPv6:2607:f8b0:4864:20::c2e]) (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 42B2282E67 for ; Thu, 19 Aug 2021 05:40:45 +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-oo1-xc2e.google.com with SMTP id m11-20020a056820034b00b0028bb60b551fso1405277ooe.5 for ; Wed, 18 Aug 2021 20:40:45 -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=Rf+I7WJo/oXrsbWXMVqHe33N3WEMya+ZWdyFqnuEpyY=; b=ORMx1umGo3Ado2f3R2RsjDYlosIqX1Iif2hrJhjYfhWtVKn3ji/kauHs5LXLZQex3i lv1BSTSkLUGHR4GAfPu9MeUCwUNqYKpYPA2qqt/tcU8wpuOruUlBhCtpj7p24ZfaaWBh 2rff3Pga3VUuuHzQBqPsa+gjFQqR38rNWPSKM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Rf+I7WJo/oXrsbWXMVqHe33N3WEMya+ZWdyFqnuEpyY=; b=oiYHjfSr0OMbHK52Jkp2AuD7dCs1bYDVvsQHqjx+Sf4zCYWSfJUpxuuEL+SJoyDPhW CVr/h8+MRqsIDQbMPTg5R4VWBEjTUeU1ovwF7YOygwCBziBXruV3klxdhysZriZdv5Pk kBhQqt5hnqFcIVSWya1uzABAoWxrqD1ySQZC41fO82cdnos+1y/u/ZQMBPEvnGg/al3H holCorp3XWPfjEmvbyQ7aCWl4MPR+aS0JXGDvLIjcC3aU+S1ClEzrzgUOP8nPRfQEfYr xnVgYc76z0ahTCVz/E/zUqfHMVbTGHZYW4yehqJegtkbqvI/K/6HMRQIz/gjraU+4ai6 ALmg== X-Gm-Message-State: AOAM533HaXBD8sioYiv7InOC11h7sr8nBRwe4JyxKzoRYJdJFvEJhqsn Iud76g0qCt+w6yDqOID9BC/LyO+gbGRQAQ== X-Google-Smtp-Source: ABdhPJydwL7ptipJ8XvMP/xM0rov8hR4htQsHx0rg3+7d4r+JfInEzo4yWxehQE3n9lqDp9BIc4yzA== X-Received: by 2002:a4a:b04c:: with SMTP id g12mr9620818oon.3.1629344443562; Wed, 18 Aug 2021 20:40:43 -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 q27sm415877oof.12.2021.08.18.20.40.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 20:40:43 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Claudiu Manoil , Dario Binacchi , Etienne Carriere , Heiko Schocher , Heinrich Schuchardt , Jean-Jacques Hiblot , Kory Maincent , Michael Walle , Philippe Reynes , Sean Anderson , =?utf-8?q?Vincent_Stehl=C3=A9?= Subject: [PATCH 03/11] sandbox: Add license headers to the dts files Date: Wed, 18 Aug 2021 21:40:25 -0600 Message-Id: <20210818214022.3.Ifefc1daac800a7c9e3858de0bb26d4378fdc94ee@changeid> X-Mailer: git-send-email 2.33.0.rc1.237.g0d66db33f3-goog In-Reply-To: <20210819034033.1617201-1-sjg@chromium.org> References: <20210819034033.1617201-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 Many of these files are missing a header. Fix this. Signed-off-by: Simon Glass --- arch/sandbox/dts/overlay0.dts | 5 +++++ arch/sandbox/dts/overlay1.dts | 5 +++++ arch/sandbox/dts/sandbox.dts | 5 +++++ arch/sandbox/dts/sandbox.dtsi | 1 + arch/sandbox/dts/sandbox64.dts | 4 ++++ arch/sandbox/dts/test.dts | 9 +++++++++ 6 files changed, 29 insertions(+) diff --git a/arch/sandbox/dts/overlay0.dts b/arch/sandbox/dts/overlay0.dts index 70c6cf77aad..9e5f38962bc 100644 --- a/arch/sandbox/dts/overlay0.dts +++ b/arch/sandbox/dts/overlay0.dts @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Overlay test file + */ + /dts-v1/; /plugin/; diff --git a/arch/sandbox/dts/overlay1.dts b/arch/sandbox/dts/overlay1.dts index 51621b31105..303e713f336 100644 --- a/arch/sandbox/dts/overlay1.dts +++ b/arch/sandbox/dts/overlay1.dts @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Overlay test file + */ + /dts-v1/; /plugin/; diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts index a8938a3accb..127f168f022 100644 --- a/arch/sandbox/dts/sandbox.dts +++ b/arch/sandbox/dts/sandbox.dts @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Main sandbox devicetree + */ + /dts-v1/; #include diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi index 200fcab6a41..6cf5f14cd11 100644 --- a/arch/sandbox/dts/sandbox.dtsi +++ b/arch/sandbox/dts/sandbox.dtsi @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * This is the common sandbox device-tree nodes. This is shared between sandbox * and sandbox64 builds. diff --git a/arch/sandbox/dts/sandbox64.dts b/arch/sandbox/dts/sandbox64.dts index a39f94feec0..ec53106af9d 100644 --- a/arch/sandbox/dts/sandbox64.dts +++ b/arch/sandbox/dts/sandbox64.dts @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Main sandbox64 devicetree + */ /dts-v1/; #include diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index d5976318d1c..f1b54131e9c 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -1,3 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Devicetree file for running sandbox tests + * + * This includes lots of extra devices used by various tests. + * + * Note that SPL use the main sandbox.dts file + */ + /dts-v1/; #include From patchwork Thu Aug 19 03:40:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1518340 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=MPyJtXW9; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GqrCt0bqGz9sW8 for ; Thu, 19 Aug 2021 13:41:30 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F2C3282E85; Thu, 19 Aug 2021 05:41:17 +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="MPyJtXW9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2E22F82E4A; Thu, 19 Aug 2021 05:40:54 +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.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) (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 053B482D91 for ; Thu, 19 Aug 2021 05:40:46 +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-x233.google.com with SMTP id u25so6659612oiv.5 for ; Wed, 18 Aug 2021 20:40:45 -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=WWwjtPQYwNlKP935Iz/IKwxIbGdwRNeaHUJuTwGQO6Q=; b=MPyJtXW9RJHxHRLqegaPuMe9hgpVKTxpYZe+Cis7U18KZ19DPL/7nhVL/cXRSgLpik CETa1u0eJettPLNvxkUy0i2xGOsfSj5A2XOvMLUan5J6fSFfb+RoHSF9yqx5WuONvTW7 JLBNJhzZe5RG5RgeCI1Ez8XaMPYhUc2wAG9c8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WWwjtPQYwNlKP935Iz/IKwxIbGdwRNeaHUJuTwGQO6Q=; b=BBn08PLVCGJnq3hzpOce7Q5c4SwgcBcT20C6TuGQFmkOIatVc6n5Uvy0sJmzK24aIp L3Vsc8M77Bcah2IYDhfuqhPa+q0E7/wD8l6Zb2LctgJ6AM/ljtAfop5iAzGKrMawRLbe mhZJP/MZLo3R/dhUhrZNVxEScsu5kgscmEg7UYuIuA7djKRTm866izH/993nXTIHWTTp /6ITVb4svIuaIEWEcrPrMfkt3W1Xxxj7jCakrj4dibPRpzolk/CfQyLQOshyIDZlxTlX d2TH/VvEYdCUfl05cqWSnL0budsFEKt489DSiCPANHZSIYOipELjyPEBvsj3pTbCWpV+ +9cA== X-Gm-Message-State: AOAM531EvhE4CmSL6iloo2GDItlD7DaX00aVZrInTqXdATwHVghLsYcT BDoUFwkyJVwEIsT1CG8w6i4+fEyjmRHgDg== X-Google-Smtp-Source: ABdhPJwKdU45dUaH6F4Eys9KJrWAu0KFv4tnL+QqyAVD4oZLdKBy/fCwaQywmpPGiIMsGt0cUbu63g== X-Received: by 2002:aca:c005:: with SMTP id q5mr1099119oif.153.1629344444479; Wed, 18 Aug 2021 20:40:44 -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 q27sm415877oof.12.2021.08.18.20.40.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 20:40:44 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Marek Behun , Qu Wenruo , linux-btrfs@vger.kernel.org Subject: [PATCH 04/11] btrfs: Suppress the message about missing filesystem Date: Wed, 18 Aug 2021 21:40:26 -0600 Message-Id: <20210818214022.4.I3eb71025472bbb050bcf9a0a192dde1b6c07fa7f@changeid> X-Mailer: git-send-email 2.33.0.rc1.237.g0d66db33f3-goog In-Reply-To: <20210819034033.1617201-1-sjg@chromium.org> References: <20210819034033.1617201-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 This message comes up a lot when scanning filesystems. It suggests to the user that there is some sort of error, but in fact there is no reason to expect that a particular partition has a btrfs filesystem. Other filesystems don't print this error. Turn it into a debug message. Signed-off-by: Simon Glass Reviewed-by: Marek BehĂșn Reviewed-by: Qu Wenruo --- fs/btrfs/disk-io.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 349411c3ccd..1b69346e231 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -886,7 +886,11 @@ static int btrfs_scan_fs_devices(struct blk_desc *desc, ret = btrfs_scan_one_device(desc, part, fs_devices, &total_devs); if (ret) { - fprintf(stderr, "No valid Btrfs found\n"); + /* + * Avoid showing this when probing for a possible Btrfs + * + * fprintf(stderr, "No valid Btrfs found\n"); + */ return ret; } return 0; @@ -975,7 +979,7 @@ struct btrfs_fs_info *open_ctree_fs_info(struct blk_desc *desc, disk_super = fs_info->super_copy; ret = btrfs_read_dev_super(desc, part, disk_super); if (ret) { - printk("No valid btrfs found\n"); + debug("No valid btrfs found\n"); goto out_devices; } From patchwork Thu Aug 19 03:40:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1518342 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=fj6hItLP; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GqrDJ68Mwz9sW8 for ; Thu, 19 Aug 2021 13:41:52 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0DA9D82F2B; Thu, 19 Aug 2021 05:41:24 +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="fj6hItLP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E168C82DD7; Thu, 19 Aug 2021 05:40: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.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc29.google.com (mail-oo1-xc29.google.com [IPv6:2607:f8b0:4864:20::c29]) (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 0735E82DB3 for ; Thu, 19 Aug 2021 05:40:47 +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-oo1-xc29.google.com with SMTP id s21-20020a4ae5550000b02902667598672bso1397766oot.12 for ; Wed, 18 Aug 2021 20:40:46 -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=0lN+T72r8eqOYqcjtXpDc+6rFL1flrSMn6AQkbBdbIo=; b=fj6hItLPc5lsPfyTuLKaGkVbQr/BqOgswV0mu1cq9S8YmmtV3O6RCczd/2L3AGoeVl mpQi85wbmDB8JV9do46EbZpKPzGXcRQfs3qzkx0hPH5dDdDEUoci7w/MRChszFiLfsM7 5OXK3C0V9RZdmp/AGP5WwIdnx57pGVmDVjAt0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0lN+T72r8eqOYqcjtXpDc+6rFL1flrSMn6AQkbBdbIo=; b=efzOxcj1Pcyr57uGsPvaCAvJB9D6vLRUpGRj1TquFrINuIhIaAudk6Z0xOXDkpor4i j4Df/otosySF0Ut9DlAzcxy96kqhiSEZZ/idFPjD0ngUobbVie0JumGfFamiBRE3mDJG 2y3OxUSO27TbYnI2MBsHdeYHvVcEKQEOdmkeaul93lhJj0qNYW/ZnnEo3Wq5MAv9JMY1 /zxrCqduvRsKsI84/qzK171RBEbQNFDjFc4SLAuoxbqi9TYgbXsujgQLmRDUPZSw0y7r +QRyYbpL6ETXE8VUcTAK8+1AX/m6hfxaABgwjQ/KdqadtX6KpgQA5kA56bq91Rch3Qfx lOXQ== X-Gm-Message-State: AOAM531WIryQUEgxY1wjXBMQH+6MsJnf+cd7WXyhcT609ER5ueMagkWc /OsHFradHdvvaiptccpcBss3H0DRkA37Mg== X-Google-Smtp-Source: ABdhPJzI+OXNRuirnhiYkCeGCYKsCLNknfoNz0vWypmfj3uulEjW1jlUlVW0SKyVcGkjRXPU61/N2A== X-Received: by 2002:a05:6820:121:: with SMTP id i1mr9611132ood.57.1629344445443; Wed, 18 Aug 2021 20:40:45 -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 q27sm415877oof.12.2021.08.18.20.40.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 20:40:45 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Joao Marcos Costa , Miquel Raynal , Thomas Petazzoni Subject: [PATCH 05/11] sqfs: Suppress the message about missing filesystem Date: Wed, 18 Aug 2021 21:40:27 -0600 Message-Id: <20210818214022.5.I3eb71025472bbb050bcf9a0a192dde1b6c07fa7f@changeid> X-Mailer: git-send-email 2.33.0.rc1.237.g0d66db33f3-goog In-Reply-To: <20210819034033.1617201-1-sjg@chromium.org> References: <20210819034033.1617201-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 This message comes up a lot when scanning filesystems. It suggests to the user that there is some sort of error, but in fact there is no reason to expect that a particular partition has a sqfs filesystem. Other filesystems don't print this error. Turn it into a debug message. Signed-off-by: Simon Glass Reviewed-by: Miquel Raynal --- fs/squashfs/sqfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 92ab8ac6310..e2d91c654cd 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -1090,7 +1090,7 @@ int sqfs_probe(struct blk_desc *fs_dev_desc, struct disk_partition *fs_partition /* Make sure it has a valid SquashFS magic number*/ if (get_unaligned_le32(&sblk->s_magic) != SQFS_MAGIC_NUMBER) { - printf("Bad magic number for SquashFS image.\n"); + debug("Bad magic number for SquashFS image.\n"); ret = -EINVAL; goto error; } From patchwork Thu Aug 19 03:40:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1518346 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=RRLyOkPj; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GqrFC2fqDz9t0T for ; Thu, 19 Aug 2021 13:42:39 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 16EC483117; Thu, 19 Aug 2021 05:41:37 +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="RRLyOkPj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3F9BC82EBD; Thu, 19 Aug 2021 05:40:58 +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.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) (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 4540F82E05 for ; Thu, 19 Aug 2021 05:40:48 +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-x22c.google.com with SMTP id n27so6742906oij.0 for ; Wed, 18 Aug 2021 20:40:48 -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=MxiJ/Nqzun1axMpPqosW5ej48ZPk7NhoWBOrv8QmBh0=; b=RRLyOkPj9jha1bPkstl6+VwJLsP4ykrUxiPc2K0bQUNplDn/LBCoc1pbJYRHrvMk66 1NABBDDHs5hLrJg4W/FY4WyTHznBePDuJsIZbcyouwESAweZPJcXzYXnWPmBSj3TViRl AVfGc4P6KrY9Zc8HUiAch2AOxIDBa/g6uE24A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MxiJ/Nqzun1axMpPqosW5ej48ZPk7NhoWBOrv8QmBh0=; b=TuMkGxBRhri9SYySF3WB+v3oWw9Gaiqly0HmYqGcR37ytSuZ8EtIdYRM1jdq5DIe38 IGs9OSdOTRLuCvDpvJwtuV7U+jmY6SOjQWIWGqhumXT/paLQ4QHftiSY6bMrRqiS53wt OOMxv2teJvgQ9KRyGD5XViAfGAy+O62+2BgB9qw32vY1z6qmVVL7mhY5LoLvZjq2YY/G eohj6EW+AC+OrtkSoR/W4xhspROocxBv2gX5HE/bvwmoUtohIGhTm48QkEwgtefnwbIz 8JF0cZ8Yd0iOhM0dLR+1JSowdoAorN7XE/iwu1ctELUR2vlgQ7VJIVZIAyj4ilA19vCB jPMQ== X-Gm-Message-State: AOAM530pORLiyVwPujVYPzmkqvTmthPdXpx0vUR5DqFseXk32Ad+9XJb JNYWXyZbmoNInMoB8E4Jj3C+SZJSr/eZmg== X-Google-Smtp-Source: ABdhPJwbk8jhRjYLUd8F/GqpT1rikztuqPqbBrn14IfJMkSfj6k+zmlLW7NHz5cLjeC+DuXek53fEg== X-Received: by 2002:a05:6808:199a:: with SMTP id bj26mr1087641oib.125.1629344446295; Wed, 18 Aug 2021 20:40:46 -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 q27sm415877oof.12.2021.08.18.20.40.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 20:40:45 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH 06/11] test: Tidy a comment in the bloblist test Date: Wed, 18 Aug 2021 21:40:28 -0600 Message-Id: <20210818214022.6.I95e70ad9bf08b436798cc9d3cc1f2df3eba8af23@changeid> X-Mailer: git-send-email 2.33.0.rc1.237.g0d66db33f3-goog In-Reply-To: <20210819034033.1617201-1-sjg@chromium.org> References: <20210819034033.1617201-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 Fix up a copy error. Signed-off-by: Simon Glass --- test/bloblist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/bloblist.c b/test/bloblist.c index 4104e6a92f6..b48be38dc3e 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -14,7 +14,7 @@ DECLARE_GLOBAL_DATA_PTR; -/* Declare a new compression test */ +/* Declare a new bloblist test */ #define BLOBLIST_TEST(_name, _flags) \ UNIT_TEST(_name, _flags, bloblist_test) From patchwork Thu Aug 19 03:40:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1518343 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Qa1L1P1I; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GqrDX1yWVz9t0Y for ; Thu, 19 Aug 2021 13:42:04 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 513F382ECD; Thu, 19 Aug 2021 05:41:27 +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="Qa1L1P1I"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B227C82E05; Thu, 19 Aug 2021 05:40:58 +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.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) (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 AC1E382E88 for ; Thu, 19 Aug 2021 05:40:48 +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-ot1-x330.google.com with SMTP id r38-20020a05683044a600b0051a2c6dd421so7002003otv.3 for ; Wed, 18 Aug 2021 20:40:48 -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=d9piPnV9akhFxNuGQbEEbuq9F+vnYMjMhDV14fF2ZuE=; b=Qa1L1P1IM8nWFsaVhdIsdsIF4xi+Iu4z1sfmDNqPQCUcMCo7fcsgyKBwVR8YdHQTge swkCmvzakW9cx7dyR6gInJ0yCggV759iAUPiEHH/gXlp8X5bLBFXepgv28nQsTphFgj2 T8fsCpMAJLV5D91l3shzgCfAsAgQjeDoFc1cQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d9piPnV9akhFxNuGQbEEbuq9F+vnYMjMhDV14fF2ZuE=; b=LMnQiZGpL+6m92GJGz+YGLKIQDUyaUgp8H2WIp6gftO/3MmsQob/XPWcpl3Jf/8Ls/ exMdKk8tEtY+6IhfjmVwVNSTuX2lOPFvmT86bzGj8rb1YzDt7d+scYgqzX8T4aHldafL KusrtC9IdPyP8/Ha5pHKsPpun8OWyw+oopiP5iUA/uPXi9GJTgGt66rNgrPR5nvl88yM 4+OeSW2OovLyWi3cXcUzjQ2X4jvFiYUlh2aI4CCXIpbpUCiC3LCzyaOf+ycWPEmqQ5Ov G1wFrjIUAwvTirlwUE5aww6QGZV69qzX9/jRCpG8datTqH4pgS8XIxCvvQAoUdx2gHGo zH5A== X-Gm-Message-State: AOAM532XHWd/lhIyB/js+BW2llctRprFrov9NjSsyUzHECZqxk4xKmwB HzJOtvIriM2Di/T11u4edvNsf/KNhvJOEA== X-Google-Smtp-Source: ABdhPJxbeaa5hqpQSIecgktpZR+yWhgo1VUBJfzz1HOl2uClE9tPDgC9mY1pfjuFNEHa63sRna6XWg== X-Received: by 2002:a05:6830:20c2:: with SMTP id z2mr9841582otq.285.1629344447206; Wed, 18 Aug 2021 20:40:47 -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 q27sm415877oof.12.2021.08.18.20.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 20:40:46 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Marek Vasut , Pavel Herrmann Subject: [PATCH 07/11] dm: core: Fix a few incorrect comments on first/next functions Date: Wed, 18 Aug 2021 21:40:29 -0600 Message-Id: <20210818214022.7.I128cc26d18f84809505be42159326fdc7a8d5029@changeid> X-Mailer: git-send-email 2.33.0.rc1.237.g0d66db33f3-goog In-Reply-To: <20210819034033.1617201-1-sjg@chromium.org> References: <20210819034033.1617201-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 Tighten up these comments to make the behaviour clearer. Signed-off-by: Simon Glass --- include/dm/device.h | 4 ++-- include/dm/uclass.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/dm/device.h b/include/dm/device.h index 0a9718a5b81..ef6241bca8b 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -738,7 +738,7 @@ int device_find_next_child(struct udevice **devp); * * @parent: Parent device to search * @uclass_id: Uclass to look for - * @devp: Returns device found, if any + * @devp: Returns device found, if any, else NULL * @return 0 if found, else -ENODEV */ int device_find_first_inactive_child(const struct udevice *parent, @@ -750,7 +750,7 @@ int device_find_first_inactive_child(const struct udevice *parent, * * @parent: Parent device to search * @uclass_id: Uclass to look for - * @devp: Returns first child device in that uclass, if any + * @devp: Returns first child device in that uclass, if any, else NULL * @return 0 if found, else -ENODEV */ int device_find_first_child_by_uclass(const struct udevice *parent, diff --git a/include/dm/uclass.h b/include/dm/uclass.h index da0c1bfadb1..15e5f9ef5bc 100644 --- a/include/dm/uclass.h +++ b/include/dm/uclass.h @@ -354,7 +354,7 @@ int uclass_next_device(struct udevice **devp); * The device returned is probed if necessary, and ready for use * * @devp: On entry, pointer to device to lookup. On exit, returns pointer - * to the next device in the uclass if no error occurred, or -ENODEV if + * to the next device in the uclass if no error occurred, or NULL if * there is no next device. * @return 0 if found, -ENODEV if not found, other -ve on error */ From patchwork Thu Aug 19 03:40:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1518345 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Oa5xKg9N; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GqrDz4v44z9sW8 for ; Thu, 19 Aug 2021 13:42:27 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 751B08311A; Thu, 19 Aug 2021 05:41:34 +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="Oa5xKg9N"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A0BE882DD7; Thu, 19 Aug 2021 05:40:58 +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.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc2f.google.com (mail-oo1-xc2f.google.com [IPv6:2607:f8b0:4864:20::c2f]) (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 B71D382EBB for ; Thu, 19 Aug 2021 05:40:49 +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-oo1-xc2f.google.com with SMTP id t2-20020a4ae9a2000000b0028c7144f106so329480ood.6 for ; Wed, 18 Aug 2021 20:40:49 -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=eze9UiuYvuEaGl6gi9n5RWRC2arbwmfgAi07dFYxbPk=; b=Oa5xKg9NM9KGjJSnEHSOLeHoJwpy9Ie696+5U+p9trzVnUXZhIIwNSCkkCJzFuUXXu 3scrUjAY6devdYyZApc8dhiQnd1wph6VD1qY0Xn3aWcFlsnrnkba3KAe6O5DMlkg5oBy O7cCDvx6vtNf80P1VKv/wtYSea5MgUqH+j3uw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eze9UiuYvuEaGl6gi9n5RWRC2arbwmfgAi07dFYxbPk=; b=JuylxlZmRj6l/QaUaYxkSRU1H+qALAliP7PCi5cJoshlxF2gzFzPdfjNH2KUdIQNQ3 k4b+ofX0iGT/mVeLtJ/o8bBaUSUgR7eCQjISzma8JPYhWUcmkKRNkGs9Cw3oHzLlnjvs TCgy5fDZLRsl7CRq6v7xvsM66DvDvGX67ovpTKDsRRdp+vvehMljiUnjtCfsXAABb9pz ElJUvZaCjB8o/tSXBMIMC/WbrVAlv3WTVQ4XYtDgHKK3DyKb10m4RaaP18JGO7rcv/KC W9HwyZ6Vti3rJBA+Q8oZXEHFDZp8l+ZSczulHybft+QsScUmnurCf0v/bHPnWp0mDC3m Cd+A== X-Gm-Message-State: AOAM533Noj0vyUW69DHHYkqPhCx3LuhczgXR0ksA/8wHEZGi4Jy8mNvk WSifg0qxLbd2VTQeQnjH6jK+4+WQVjFrQw== X-Google-Smtp-Source: ABdhPJwRwFouJhtk9mWhlLlOIUpOs0Nvs2WZmiOAooCEkXq5pmtorzL6NPBN9/0WUd86T76R6tmjHg== X-Received: by 2002:a4a:d498:: with SMTP id o24mr9562963oos.23.1629344448191; Wed, 18 Aug 2021 20:40:48 -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 q27sm415877oof.12.2021.08.18.20.40.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 20:40:47 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Heinrich Schuchardt , =?utf-8?q?Marek_Beh=C3=BAn?= , Patrick Delaunay Subject: [PATCH 08/11] sandbox: Add a way to find the size of a file Date: Wed, 18 Aug 2021 21:40:30 -0600 Message-Id: <20210818214022.8.I474febf1cd7d0eece13bfe3345b3851b75faf3ee@changeid> X-Mailer: git-send-email 2.33.0.rc1.237.g0d66db33f3-goog In-Reply-To: <20210819034033.1617201-1-sjg@chromium.org> References: <20210819034033.1617201-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 Add a function to return the size of a file. This is useful in situations where we need to allocate memory for it before reading it. Signed-off-by: Simon Glass Reviewed-by: Marek BehĂșn --- arch/sandbox/cpu/os.c | 22 ++++++++++++++++------ include/os.h | 8 ++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 151f42a5d6c..a4262881c54 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -133,6 +133,19 @@ int os_write_file(const char *fname, const void *buf, int size) return 0; } +int os_filesize(int fd) +{ + off_t size; + + size = os_lseek(fd, 0, OS_SEEK_END); + if (size < 0) + return -errno; + if (os_lseek(fd, 0, OS_SEEK_SET) < 0) + return -errno; + + return size; +} + int os_read_file(const char *fname, void **bufp, int *sizep) { off_t size; @@ -144,15 +157,12 @@ int os_read_file(const char *fname, void **bufp, int *sizep) printf("Cannot open file '%s'\n", fname); goto err; } - size = os_lseek(fd, 0, OS_SEEK_END); + size = os_filesize(fd); if (size < 0) { - printf("Cannot seek to end of file '%s'\n", fname); - goto err; - } - if (os_lseek(fd, 0, OS_SEEK_SET) < 0) { - printf("Cannot seek to start of file '%s'\n", fname); + printf("Cannot get file size of '%s'\n", fname); goto err; } + *bufp = os_malloc(size); if (!*bufp) { printf("Not enough memory to read file '%s'\n", fname); diff --git a/include/os.h b/include/os.h index 7b20d606dd0..7661078d336 100644 --- a/include/os.h +++ b/include/os.h @@ -51,6 +51,14 @@ off_t os_lseek(int fd, off_t offset, int whence); #define OS_SEEK_CUR 1 #define OS_SEEK_END 2 +/** + * os_filesize() - Calculate the size of a file + * + * @fd: File descriptor as returned by os_open() + * Return: file size or negative error code + */ +int os_filesize(int fd); + /** * Access to the OS open() system call * From patchwork Thu Aug 19 03:40:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1518347 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=g33hlQJI; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GqrFP14cGz9t0T for ; Thu, 19 Aug 2021 13:42:49 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E4C8083128; Thu, 19 Aug 2021 05:41:38 +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="g33hlQJI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3068B82D74; Thu, 19 Aug 2021 05:41: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.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) (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 04F6982E85 for ; Thu, 19 Aug 2021 05:40:52 +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-x234.google.com with SMTP id n27so6743064oij.0 for ; Wed, 18 Aug 2021 20:40:51 -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=h3w2LZ9CztWcL2QQ/fr4tijJ5w1UvMN5gHnpz56chLs=; b=g33hlQJI7h2QBErLJNJPoUaMl71OMTfvZ9PQDaqcwvsWQq915UM/3kejU1cdpRq/xJ TzAUDXHKBGPuFJbkg+S9ddE7hLggkNZMgoU0h/MJArJAD2Ud+WnDgYuvByHaVnDEa1n+ 5RugXhBNp5A59l9U1RvNUZJ1ApQ0MBwliy44Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=h3w2LZ9CztWcL2QQ/fr4tijJ5w1UvMN5gHnpz56chLs=; b=ZtTzwwTezYUcmttEtfb/t8H3P+MxGblrnbxN5tAE71VaUD8r4piRqLKIW/h7T7VdOF ftHeKqO9+l3vTzPX+piu4nlWlcKkRNrnCuCcOECuXNDaVWDvkNYAHa68/aEZg2mW38fO RX4R6abPGz281+kHdOViSwfeQOS05ckHCadE7k8D3mHMAAnS3FI1DElwsoyc0FRuk+bk Vi9fpiPhkd2vfgN1PoS+diCnJ4Zwwl21v/x+sFEazvgs64av4ImvAPHTDBMwiEQXX1QB IRdjUuh0KZl3tHXQhHcbDnzT4QIj20dkoOOS6ECSw6jFHVfdft8Y0Z6iswoCcE91LQQL XgwQ== X-Gm-Message-State: AOAM533QT/s9kOchDVktZpMA4fJYkDQ96gPeHkddtblsOIA8ySLK4Jvv 3vX965WNfvp689eqXSc0HKyyFGJBtt68kQ== X-Google-Smtp-Source: ABdhPJyTbjhueaifkZpzL8npoOm3LYvTMgZH0L2A6Vw2O1urbdN8gVwphv4wPPUbv54fb7xdbeCYBA== X-Received: by 2002:aca:210d:: with SMTP id 13mr1101621oiz.47.1629344449139; Wed, 18 Aug 2021 20:40:49 -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 q27sm415877oof.12.2021.08.18.20.40.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 20:40:48 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Heinrich Schuchardt , =?utf-8?q?Marek_Beh=C3=BAn?= , Patrick Delaunay Subject: [PATCH 09/11] sandbox: Add a way to map a file into memory Date: Wed, 18 Aug 2021 21:40:31 -0600 Message-Id: <20210818214022.9.Ifb64a64e67b3777340ca034ed6d3a7a02143696c@changeid> X-Mailer: git-send-email 2.33.0.rc1.237.g0d66db33f3-goog In-Reply-To: <20210819034033.1617201-1-sjg@chromium.org> References: <20210819034033.1617201-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 It is useful to map a file into memory so that it can be accessed using simple pointers. Add a function to support this. Signed-off-by: Simon Glass --- arch/sandbox/cpu/os.c | 29 +++++++++++++++++++++++++++++ include/os.h | 13 +++++++++++++ 2 files changed, 42 insertions(+) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index a4262881c54..b72dafca2ba 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -182,6 +182,35 @@ err: return ret; } +int os_map_file(const char *pathname, int os_flags, void **bufp, int *sizep) +{ + void *ptr; + int size; + int ifd; + + ifd = os_open(pathname, os_flags); + if (ifd < 0) { + printf("Cannot open file '%s'\n", pathname); + return -EIO; + } + size = os_filesize(ifd); + if (size < 0) { + printf("Cannot get file size of '%s'\n", pathname); + return -EIO; + } + + ptr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, ifd, 0); + if (ptr == MAP_FAILED) { + printf("Can't map file '%s': %s\n", pathname, strerror(errno)); + return -EPERM; + } + + *bufp = ptr; + *sizep = size; + + return 0; +} + /* Restore tty state when we exit */ static struct termios orig_term; static bool term_setup; diff --git a/include/os.h b/include/os.h index 7661078d336..770d76e02f7 100644 --- a/include/os.h +++ b/include/os.h @@ -406,6 +406,19 @@ int os_write_file(const char *name, const void *buf, int size); */ int os_read_file(const char *name, void **bufp, int *sizep); +/** + * os_map_file() - Map a file from the host filesystem into memory + * + * This can be useful when to provide a backing store for an emulated device + * + * @pathname: File pathname to map + * @os_flags: Flags, like OS_O_RDONLY, OS_O_RDWR + * @bufp: Returns buffer containing the file + * @sizep: Returns size of data + * Return: 0 if OK, -ve on error + */ +int os_map_file(const char *pathname, int os_flags, void **bufp, int *sizep); + /* * os_find_text_base() - Find the text section in this running process * From patchwork Thu Aug 19 03:40:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1518344 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=av0CVi/J; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GqrDm2RXwz9sW8 for ; Thu, 19 Aug 2021 13:42:16 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7704582F34; Thu, 19 Aug 2021 05:41:30 +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="av0CVi/J"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9855782E7D; Thu, 19 Aug 2021 05:40:59 +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.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) (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 A8B4C82DBC for ; Thu, 19 Aug 2021 05:40:51 +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-x22d.google.com with SMTP id be20so6619129oib.8 for ; Wed, 18 Aug 2021 20:40:51 -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=Ux67w590QDVKr0FjTlpmQ37iUlVpFNNVk7OUug3mGZc=; b=av0CVi/JxKT08nCUI67JJYpeuU/xewBGo9hR0kMjYf8Iprwpt60vokXN1q3ITbjMjG m5tD904s0KFKfu8LiQzoJKT7nsXDjG36CHKAMTfzLZDITJPMcVbwZiTGuY3LeAoO3M+n wJQWOVNEI1wiHFqEi56M+JMQ7Jizz8SSMmUeA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ux67w590QDVKr0FjTlpmQ37iUlVpFNNVk7OUug3mGZc=; b=iwr5QzmpiqSuePyoXbee001knLTac2Efa552hl5Ll1srIVKAnTaCjSETD61yVwRhMW 3RTTjD5j/x47bCRGTN9Vr+M2FVp7rscf4eB07fb4+rCD1WJn1EM5fNJ88SwWr+bIEezJ mmiAKn2ajMohS8hOQrVEcVlI8m86kfnOwWopPgDmpMC38SWxVMY3fS/lLzv6u036Cz1d 2qBB4AYdYc57ijSvu5mEAQngYaDaRJfHIrVaXJOUyOwPD9LglXTjvPmSOmFL2QweEWee YSZ4FpTNw0AX3IeVPDh2X7d6hcambCpKT96TBL9zASTIdrilWVyo2dnqsC77zd9ohGgj 2Ueg== X-Gm-Message-State: AOAM5322yTPrpSXrv/tcqhtMN9AeY9aQ+dcsBGlAjcmSMCOtG+CcVSKx motlx2W/Ezrv18wqgZVV2ZRtW0WXzkBKng== X-Google-Smtp-Source: ABdhPJyesG0TuQ+Y696HankUJFutPuiK+i1Zz4hmZUi29wrXZYj62AiZJqT8cj3Sbv3NOV6h/DesrA== X-Received: by 2002:aca:e106:: with SMTP id y6mr1093124oig.62.1629344450061; Wed, 18 Aug 2021 20:40:50 -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 q27sm415877oof.12.2021.08.18.20.40.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 20:40:49 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Jaehoon Chung , Peng Fan Subject: [PATCH 10/11] sandbox: mmc: Support a backing file Date: Wed, 18 Aug 2021 21:40:32 -0600 Message-Id: <20210818214022.10.I42087e8088f8d9fb704821d73f17d7ae246a2e69@changeid> X-Mailer: git-send-email 2.33.0.rc1.237.g0d66db33f3-goog In-Reply-To: <20210819034033.1617201-1-sjg@chromium.org> References: <20210819034033.1617201-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 Provide a way for sandbox MMC to present data from a backing file. This allows a filesystem to be created on the host and easily served via an emulated mmc device. Signed-off-by: Simon Glass Reviewed-by: Jaehoon Chung --- doc/device-tree-bindings/mmc/sandbox,mmc.txt | 18 ++++++++ drivers/mmc/sandbox_mmc.c | 46 ++++++++++++++++---- 2 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 doc/device-tree-bindings/mmc/sandbox,mmc.txt diff --git a/doc/device-tree-bindings/mmc/sandbox,mmc.txt b/doc/device-tree-bindings/mmc/sandbox,mmc.txt new file mode 100644 index 00000000000..1170bcd6a00 --- /dev/null +++ b/doc/device-tree-bindings/mmc/sandbox,mmc.txt @@ -0,0 +1,18 @@ +Sandbox MMC +=========== + +Required properties: +- compatible : "sandbox,mmc" + +Optional properties: +- filename : Name of backing file, if any. This is mapped into the MMC device + so can be used to provide a filesystem or other test data + + +Example +------- + +mmc2 { + compatible = "sandbox,mmc"; + non-removable; +}; diff --git a/drivers/mmc/sandbox_mmc.c b/drivers/mmc/sandbox_mmc.c index 895fbffecfc..1139951c626 100644 --- a/drivers/mmc/sandbox_mmc.c +++ b/drivers/mmc/sandbox_mmc.c @@ -9,23 +9,26 @@ #include #include #include +#include #include +#include #include struct sandbox_mmc_plat { struct mmc_config cfg; struct mmc mmc; + const char *fname; }; -#define MMC_CSIZE 0 -#define MMC_CMULT 8 /* 8 because the card is high-capacity */ -#define MMC_BL_LEN_SHIFT 10 -#define MMC_BL_LEN BIT(MMC_BL_LEN_SHIFT) -#define MMC_CAPACITY (((MMC_CSIZE + 1) << (MMC_CMULT + 2)) \ - * MMC_BL_LEN) /* 1 MiB */ +#define MMC_CMULT 8 /* 8 because the card is high-capacity */ +#define MMC_BL_LEN_SHIFT 10 +#define MMC_BL_LEN BIT(MMC_BL_LEN_SHIFT) +#define SIZE_MULTIPLE ((1 << (MMC_CMULT + 2)) * MMC_BL_LEN) struct sandbox_mmc_priv { - u8 buf[MMC_CAPACITY]; + int csize; /* CSIZE value to report */ + char *buf; + int size; }; /** @@ -60,8 +63,8 @@ static int sandbox_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, case MMC_CMD_SEND_CSD: cmd->response[0] = 0; cmd->response[1] = (MMC_BL_LEN_SHIFT << 16) | - ((MMC_CSIZE >> 16) & 0x3f); - cmd->response[2] = (MMC_CSIZE & 0xffff) << 16; + ((priv->csize >> 16) & 0x3f); + cmd->response[2] = (priv->csize & 0xffff) << 16; cmd->response[3] = 0; break; case SD_CMD_SWITCH_FUNC: { @@ -143,6 +146,8 @@ static int sandbox_mmc_of_to_plat(struct udevice *dev) struct blk_desc *blk; int ret; + plat->fname = dev_read_string(dev, "filename"); + ret = mmc_of_parse(dev, cfg); if (ret) return ret; @@ -156,6 +161,29 @@ static int sandbox_mmc_of_to_plat(struct udevice *dev) static int sandbox_mmc_probe(struct udevice *dev) { struct sandbox_mmc_plat *plat = dev_get_plat(dev); + struct sandbox_mmc_priv *priv = dev_get_priv(dev); + int ret; + + if (plat->fname) { + ret = os_map_file(plat->fname, OS_O_RDWR | OS_O_CREAT, + (void **)&priv->buf, &priv->size); + if (ret) { + log_err("%s: Unable to map file '%s'\n", dev->name, + plat->fname); + return ret; + } + priv->csize = priv->size / SIZE_MULTIPLE - 1; + } else { + priv->csize = 0; + priv->size = (priv->csize + 1) * SIZE_MULTIPLE; /* 1 MiB */ + + priv->buf = malloc(priv->size); + if (!priv->buf) { + log_err("%s: Not enough memory (%x bytes)\n", + dev->name, priv->size); + return -ENOMEM; + } + } return mmc_init(&plat->mmc); } From patchwork Thu Aug 19 03:40:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1518348 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=i2STEuxz; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GqrFc0NTZz9t0T for ; Thu, 19 Aug 2021 13:42:59 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3C6A78312F; Thu, 19 Aug 2021 05:41:41 +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="i2STEuxz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DC7BC82DBC; Thu, 19 Aug 2021 05:41:04 +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.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) (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 6F9F782EA8 for ; Thu, 19 Aug 2021 05:40:52 +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-x230.google.com with SMTP id o185so6598652oih.13 for ; Wed, 18 Aug 2021 20:40:52 -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=Z7Rboy5aHimKQmmd59tpW+cawaA8UuuwvMePnolr75c=; b=i2STEuxzAWcTbQWRDK5E7ShzG/ENdeD3KO+fBn5QFwdVS48XEfrpkjGRth6g93OW4Q nDUgMfW3YBMWU+PRwMMOIKbP3zymVc01cFY7pzdmkouhg925gfis5NDNkHCN4jheffnz xKuq5DOK6t4StwIDP+Q0q+FudKlJqs3gq5ArM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z7Rboy5aHimKQmmd59tpW+cawaA8UuuwvMePnolr75c=; b=mE7IaJO1/WjKDJXxD8jSj5osKb8LBZpwgF57XqX+f+8DiZz7VgsMtZCG6/FVcak0Mh bVny53UnvfYTc+KZOmaucDr7kNw9KX1i882A3SVmw67dOXCRQRSshK/XpgT0YlrHV47v QsKkaCO70m5H1KrmVDemr3znvx1kCQBN5DIUSJYt3LtjnZoZfS11vyCXoBJnBSGj3C2r nBhW3NjgRpaGEB8ppB7fwRfUMKgk2GgaJlKe11FrQLRAGT62nPjXsOkwZ7R8TGZe319E INcqMTtn5J8x5X7JlrnjcLePTcgCqbNC/bBx24LxhMVE/MrlSHP/x+xPO0tpiIbQGS2p f0Fg== X-Gm-Message-State: AOAM532wXtkceXd6OBrLXpoMWcr2w1FxogvnzPMMpCJytIeLldfReeUF IBo76S1gldS7nyUSWHh4Shzjpabc1AALRw== X-Google-Smtp-Source: ABdhPJybadCRS4RH5aB9xf+0vG58tiAKW2iz43d5x+2SEwlfO2xUhZM3r4i8uDfR5rTVRrTyWs6iSw== X-Received: by 2002:a54:4614:: with SMTP id p20mr1174463oip.136.1629344450912; Wed, 18 Aug 2021 20:40:50 -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 q27sm415877oof.12.2021.08.18.20.40.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 20:40:50 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Heinrich Schuchardt , Sean Anderson Subject: [PATCH 11/11] test: Add a way to skip console checking until a string matches Date: Wed, 18 Aug 2021 21:40:33 -0600 Message-Id: <20210818214022.11.I44fcf34ce986e97cb281a70e4fc04caed4c26045@changeid> X-Mailer: git-send-email 2.33.0.rc1.237.g0d66db33f3-goog In-Reply-To: <20210819034033.1617201-1-sjg@chromium.org> References: <20210819034033.1617201-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 Some tests produce a lot of output that does not need to be individually checked by an assertion. Add a macro to handle this. Signed-off-by: Simon Glass --- include/test/ut.h | 24 ++++++++++++++++++++++++ test/ut.c | 26 ++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/include/test/ut.h b/include/test/ut.h index 656e25fe574..fb2e5fcff2c 100644 --- a/include/test/ut.h +++ b/include/test/ut.h @@ -82,6 +82,21 @@ int ut_check_console_linen(struct unit_test_state *uts, const char *fmt, ...) */ int ut_check_skipline(struct unit_test_state *uts); +/** + * ut_check_skip_to_line() - skip output until a line is found + * + * This creates a string and then checks it against the following lines of + * console output obtained with console_record_readline() until it is found. + * + * After the function returns, uts->expect_str holds the expected string and + * uts->actual_str holds the actual string read from the console. + * + * @uts: Test state + * @fmt: printf() format string to look for, followed by args + * @return 0 if OK, -ENOENT if not found, other value on error + */ +int ut_check_skip_to_line(struct unit_test_state *uts, const char *fmt, ...); + /** * ut_check_console_end() - Check there is no more console output * @@ -286,6 +301,15 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); return CMD_RET_FAILURE; \ } \ +/* Assert that a following console output line matches */ +#define ut_assert_skip_to_line(fmt, args...) \ + if (ut_check_skip_to_line(uts, fmt, ##args)) { \ + ut_failf(uts, __FILE__, __LINE__, __func__, \ + "console", "\nExpected '%s',\n got to '%s'", \ + uts->expect_str, uts->actual_str); \ + return CMD_RET_FAILURE; \ + } \ + /* Assert that there is no more console output */ #define ut_assert_console_end() \ if (ut_check_console_end(uts)) { \ diff --git a/test/ut.c b/test/ut.c index 1eec2a57dff..28da417686e 100644 --- a/test/ut.c +++ b/test/ut.c @@ -121,6 +121,32 @@ int ut_check_skipline(struct unit_test_state *uts) return 0; } +int ut_check_skip_to_line(struct unit_test_state *uts, const char *fmt, ...) +{ + va_list args; + int len; + int ret; + + va_start(args, fmt); + len = vsnprintf(uts->expect_str, sizeof(uts->expect_str), fmt, args); + va_end(args); + if (len >= sizeof(uts->expect_str)) { + ut_fail(uts, __FILE__, __LINE__, __func__, + "unit_test_state->expect_str too small"); + return -EOVERFLOW; + } + while (1) { + if (!console_record_avail()) + return -ENOENT; + ret = readline_check(uts); + if (ret < 0) + return ret; + + if (!strcmp(uts->expect_str, uts->actual_str)) + return 0; + } +} + int ut_check_console_end(struct unit_test_state *uts) { int ret;