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 11B53C352A1 for ; Wed, 7 Dec 2022 09:06:52 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 69AC085715; Wed, 7 Dec 2022 09:57:07 +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="RMftu5tO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2CA5C8570F; Wed, 7 Dec 2022 09:57:03 +0100 (CET) Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) (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 F16BD856E1 for ; Wed, 7 Dec 2022 09:56:57 +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-pf1-x430.google.com with SMTP id 21so16963196pfw.4 for ; Wed, 07 Dec 2022 00:56:57 -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=xfMYGN5er9/yt/OTiFKiD0fedBpTmtJAydfAjcJnmSQ=; b=RMftu5tOU0oXZklIzfHBV1/l7QIQ0ZB0ngX1D3Mb3rJBimJp0U97nflBCUEx1Jzyq1 mndexfqYu+v3z4eId2nlWONbe+OAGPq4GudyfrwmSL6uB6+d1xsymh1db5J4CCcUygyr uCgjgjCKN2bTpBlXI+gipFd7sy5QwKmA8vRLM= 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=xfMYGN5er9/yt/OTiFKiD0fedBpTmtJAydfAjcJnmSQ=; b=i4vsCswjTGJW7OtW9QMG4sRlun4yW0unp3MYeYAPU/ivhm7WJAcH2h4ewlCT6O3chg c1MMtvjvQqAIrbtiFnzZ900ZePqhvlX+XPUhDlnSoTuVE9NGXkHa1KhANIEIYcPwSl9F qSl5YB7Bz6ILXOC6/SedprE5pLK/hs0LuG9zOnvajMdacmOMQzX9AD2G6Yy5fAZZ9Rki WIJrAyS1QJLnpx8xu6vjPass405sT9/R3daIxYLnAoGACzzQTQ9OZk0q4Y1BxPv8wQ+Z zcYdtSBx8YQUm5IA3dAY7Wg5xSMJ12v9xdUdJeygGebBQ7zNDNMQV8ZNCPbSMLdnvGi3 g+xg== X-Gm-Message-State: ANoB5pm0u5rnzJl6JMet5LeCECV70LpaPwNtHe0WnrLEqSwNd0yo2ojM UeC4uVew5ckiDpPLLjnggWVqayVVGMCkmpiu X-Google-Smtp-Source: AA0mqf5pjjTfKzzuEieUSFOamQ7nI6BSkj2skhRdzPR22Obbel060drfjSihJOcdDefy1KAgzj/ByA== X-Received: by 2002:a63:1812:0:b0:476:85ee:aee2 with SMTP id y18-20020a631812000000b0047685eeaee2mr63831106pgl.582.1670403416117; Wed, 07 Dec 2022 00:56:56 -0800 (PST) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id l16-20020a170903121000b0018157b415dbsm14145514plh.63.2022.12.07.00.56.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 00:56:55 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: U-Boot Custodians , Simon Glass , Heinrich Schuchardt , Michal Suchanek , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Stefan Roese Subject: [PATCH 53/71] sandbox: Allow SPI flash bootdevs to be disabled for tests Date: Wed, 7 Dec 2022 21:51:19 +1300 Message-Id: <20221207085137.445249-54-sjg@chromium.org> X-Mailer: git-send-email 2.39.0.rc0.267.gcb52ba06e7-goog In-Reply-To: <20221207085137.445249-1-sjg@chromium.org> References: <20221207085137.445249-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 --- 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.rc0.267.gcb52ba06e7-goog