Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D409BC54EBC for ; Sun, 8 Jan 2023 03:07:01 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A129385691; Sun, 8 Jan 2023 04:04:41 +0100 (CET) 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="SHT2LXAk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 82E0E85624; Sun, 8 Jan 2023 04:04:24 +0100 (CET) Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) (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 20BF685684 for ; Sun, 8 Jan 2023 03:51:33 +0100 (CET) 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-il1-x134.google.com with SMTP id u8so3320962ilg.0 for ; Sat, 07 Jan 2023 18:51:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z0zSHNQU7GDhwaP6Zx8QT+AwR5BqJXHZ7E4niMvaxM0=; b=SHT2LXAkL3cNj6RapgPcDJMIGzqPrpRIVLEotQG3iixrFhjUSi+GyUKnp+yYlznam7 fZKtOGuN9ByWedTc1DlzPeLFBUW14AzoIYDGylbdNkRX/7LpiCkYp/p1oiApNmsbhPhd JZ77A58o4FBuvFeN9513OrhnuOGzYm/nopYm8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z0zSHNQU7GDhwaP6Zx8QT+AwR5BqJXHZ7E4niMvaxM0=; b=6Gz5BrLNhX1Yi8rGr5+zbVEe2QSNfh+nts6kRlYqrJtqx69ltK1BCAojahCE5FFumi dW+DZeKNxA+PXKyFFlSPkz/qZ6bsuAHwe+Yk8A1iJZr+TJanUP4UQO84gKAu+tqV24Hm RBfFikYUTUoF3BWfaZW9wQefvEIHPLc3wILgjnJAibk3hDehBELI8Ecd2lA2qCEm23rJ 7xl9qPQB3/LswpJu5haXlz6bM/X73kY3ju0O4rPekTOhlJfl3vz20rdmdH5dRyCQzS6J N/Mij/LtVIsdRT+qv0KK24YyYk3aRlr0bQAO68N49Xr+vdyGZHJHhwUdl6z6VYPr3vqE ZmmA== X-Gm-Message-State: AFqh2kp7bthVBVMejdBbXrmsOS/HSP3b73MrKKJK6RcfoddDhjRu/CNB cAr/MAA4pqCovT4CPhi+uefPlTNcI/hmwL8f X-Google-Smtp-Source: AMrXdXsXXYMSC1m6Lshqof43x8qjhVOOADnstPgT8c5bhT7YJLCWwRZfApbXuVTUWSxwBp4cNYNEpQ== X-Received: by 2002:a05:6e02:1a02:b0:30c:67cb:3b32 with SMTP id s2-20020a056e021a0200b0030c67cb3b32mr12913733ild.19.1673146292616; Sat, 07 Jan 2023 18:51:32 -0800 (PST) Received: from sjg1.roam.corp.google.com (c-71-56-217-229.hsd1.co.comcast.net. [71.56.217.229]) by smtp.gmail.com with ESMTPSA id c17-20020a92bd11000000b00302a00aaefasm1622174ile.26.2023.01.07.18.51.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Jan 2023 18:51:32 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: U-Boot Custodians , Simon Glass Subject: [PATCH v2 53/71] sandbox: Allow SPI flash bootdevs to be disabled for tests Date: Sat, 7 Jan 2023 19:50:29 -0700 Message-Id: <20230108025047.522240-54-sjg@chromium.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230108025047.522240-1-sjg@chromium.org> References: <20230108025047.522240-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean Most tests don't want these and they can create a lot of noise. Add a way to disable them. Use that in tests, with a flag provided to enable them for tests that need this feature. Signed-off-by: Simon Glass --- (no changes since v1) arch/sandbox/cpu/state.c | 14 ++++++++++++++ arch/sandbox/include/asm/state.h | 1 + arch/sandbox/include/asm/test.h | 14 ++++++++++++++ include/test/test.h | 19 +++++++++++++++++++ test/test-main.c | 1 + 5 files changed, 49 insertions(+) diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index 76e65741424..4105fd5366e 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -460,6 +460,20 @@ bool sandbox_eth_enabled(void) return !state->disable_eth; } +void sandbox_sf_set_enable_bootdevs(bool enable) +{ + struct sandbox_state *state = state_get_current(); + + state->disable_sf_bootdevs = !enable; +} + +bool sandbox_sf_bootdev_enabled(void) +{ + struct sandbox_state *state = state_get_current(); + + return !state->disable_sf_bootdevs; +} + int state_init(void) { state = &main_state; diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index f125fb87af7..59a20595f51 100644 --- a/arch/sandbox/include/asm/state.h +++ b/arch/sandbox/include/asm/state.h @@ -97,6 +97,7 @@ struct sandbox_state { bool handle_signals; /* Handle signals within sandbox */ bool autoboot_keyed; /* Use keyed-autoboot feature */ bool disable_eth; /* Disable Ethernet devices */ + bool disable_sf_bootdevs; /* Don't bind SPI flash bootdevs */ /* Pointer to information for each SPI bus/cs */ struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS] diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h index 1c522e38f3d..4853dc948f3 100644 --- a/arch/sandbox/include/asm/test.h +++ b/arch/sandbox/include/asm/test.h @@ -360,4 +360,18 @@ void sandbox_set_eth_enable(bool enable); */ bool sandbox_eth_enabled(void); +/** + * sandbox_sf_bootdev_enabled() - Check if SPI flash bootdevs should be bound + * + * Returns: true if sandbox should bind bootdevs for SPI flash, false if not + */ +bool sandbox_sf_bootdev_enabled(void); + +/** + * sandbox_sf_set_enable_bootdevs() - Enable / disable the SPI flash bootdevs + * + * @enable: true to bind the SPI flash bootdevs, false to skip + */ +void sandbox_sf_set_enable_bootdevs(bool enable); + #endif diff --git a/include/test/test.h b/include/test/test.h index 752897cf06f..838e3ce8a8f 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -72,6 +72,7 @@ enum { */ UT_TESTF_MANUAL = BIT(8), UT_TESTF_ETH_BOOTDEV = BIT(9), /* enable Ethernet bootdevs */ + UT_TESTF_SF_BOOTDEV = BIT(10), /* enable SPI flash bootdevs */ }; /** @@ -222,4 +223,22 @@ static inline bool test_eth_bootdev_enabled(void) return enabled; } +/* Allow SPI flash bootdev to be ignored for testing purposes */ +static inline bool test_sf_bootdev_enabled(void) +{ + bool enabled = true; + +#ifdef CONFIG_SANDBOX + enabled = sandbox_sf_bootdev_enabled(); +#endif + return enabled; +} + +static inline void test_sf_set_enable_bootdevs(bool enable) +{ +#ifdef CONFIG_SANDBOX + sandbox_sf_set_enable_bootdevs(enable); +#endif +} + #endif /* __TEST_TEST_H */ diff --git a/test/test-main.c b/test/test-main.c index 9d0f6643d5e..ea959f4e859 100644 --- a/test/test-main.c +++ b/test/test-main.c @@ -309,6 +309,7 @@ static int test_pre_run(struct unit_test_state *uts, struct unit_test *test) * only set this if we know the ethernet uclass will be created */ eth_set_enable_bootdevs(test->flags & UT_TESTF_ETH_BOOTDEV); + test_sf_set_enable_bootdevs(test->flags & UT_TESTF_SF_BOOTDEV); ut_assertok(dm_extended_scan(false)); } -- 2.39.0.314.g84b9a713c41-goog