From patchwork Wed Dec 7 08:50:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1713116 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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: legolas.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=B6dmFOeT; 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 ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NRrpk10pNz23pB for ; Wed, 7 Dec 2022 20:00:30 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2112F85665; Wed, 7 Dec 2022 09:55: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=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="B6dmFOeT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7D6378560B; Wed, 7 Dec 2022 09:55:39 +0100 (CET) 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 autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) (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 B3E1385623 for ; Wed, 7 Dec 2022 09:55: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-pg1-x52f.google.com with SMTP id 82so15729566pgc.0 for ; Wed, 07 Dec 2022 00:55: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=LDpZjSTsGRor8JT+C6tM5L5Z0CN291tn5zP9IAS7tig=; b=B6dmFOeTndqsHio7ZRRmGZU30KxaHHwal9d6ob37M+ZlbzT/NId+YDWfSqcz2qaI06 FTuM1e3afzZE5W175iutbT8MNARmeaqFxDLlofXdl4Y1DaAVsKIPSXfvLQ2qLNaKvdbT DG7BQBTKl6vx8kvvZSuGBlcdN7yeQVdwiR6/E= 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=LDpZjSTsGRor8JT+C6tM5L5Z0CN291tn5zP9IAS7tig=; b=dpQxPv+SybwYxfznSX1vqooHsQtGxyohj/xqdaPS0BG+v8UGtJp35x1t+nyPIm4iNa A0yLcJ2AX0m+p+o34mlOiEeCIS8I+FPZdMIHYSsRqI0OX1b/pKsrRIu3FXb8FLUrydcH tM4lT1yh9qwoUReoBMqND4T6aYtOdBa+YTN5xxR6KpNlrdsr0f7DDRtSFiSJ1qvaljpp TVjoD0kCsnviNb3ilqcElGFPlpjlfKXYBVm3jcpubCFGP22J/xfKSrXkNAObNtVcKtj6 FUIF0zG1K2L/oHnSFk0TcpIwcZ+z6cPicW5U6HgzcbhLJoXq+qzixll8NlUFuU+VrOfS BKbQ== X-Gm-Message-State: ANoB5pml89O5rBKwTUrvTQrbsKKUvgjnwJm7ly+oREB4tTU5c4cwOQO0 LPEnGxGePxYAbTzzDvsDFvzPvZ5bYOMu4+w7 X-Google-Smtp-Source: AA0mqf5783ajPGP47pWyJAzlnCkXOX7ZxZF8FyRGpxEJtRjyJhx9Ow75bX0tjJPXl3UY7Ol9mlXUPQ== X-Received: by 2002:a63:d84c:0:b0:478:6bad:dc4 with SMTP id k12-20020a63d84c000000b004786bad0dc4mr27482699pgj.405.1670403331885; Wed, 07 Dec 2022 00:55:31 -0800 (PST) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id l16-20020a170903121000b0018157b415dbsm14145514plh.63.2022.12.07.00.55.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 00:55:31 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: U-Boot Custodians , Simon Glass , Jaehoon Chung , Peng Fan Subject: [PATCH 29/71] bootstd: Add an MMC hunter Date: Wed, 7 Dec 2022 21:50:55 +1300 Message-Id: <20221207085137.445249-30-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 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 Add a hunter for MMC. This doesn't do anything at present, since MMC is currently set up when U-Boot starts. If MMC moves to lazy init then we can add a hunter function. Signed-off-by: Simon Glass --- drivers/mmc/mmc_bootdev.c | 6 ++++++ test/boot/bootdev.c | 16 ++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/mmc_bootdev.c b/drivers/mmc/mmc_bootdev.c index 037b67bc0ff..300208f0c71 100644 --- a/drivers/mmc/mmc_bootdev.c +++ b/drivers/mmc/mmc_bootdev.c @@ -35,3 +35,9 @@ U_BOOT_DRIVER(mmc_bootdev) = { .bind = mmc_bootdev_bind, .of_match = mmc_bootdev_ids, }; + +BOOTDEV_HUNTER(mmc_bootdev_hunter) = { + .prio = BOOTDEVP_0_INTERNAL_FAST, + .uclass = UCLASS_MMC, + .drv = DM_DRIVER_REF(mmc_bootdev), +}; diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c index 7a0c5793890..78cb0ac628a 100644 --- a/test/boot/bootdev.c +++ b/test/boot/bootdev.c @@ -238,8 +238,9 @@ static int bootdev_test_hunter(struct unit_test_state *uts) bootdev_list_hunters(std); ut_assert_nextline("Prio Used Uclass Hunter"); ut_assert_nextlinen("----"); + ut_assert_nextline(" 10 mmc mmc_bootdev"); ut_assert_nextline(" 40 usb usb_bootdev"); - ut_assert_nextline("(total hunters: 1)"); + ut_assert_nextline("(total hunters: 2)"); ut_assert_console_end(); ut_assertok(bootdev_hunt("usb1", false)); @@ -247,7 +248,8 @@ static int bootdev_test_hunter(struct unit_test_state *uts) "Bus usb@1: scanning bus usb@1 for devices... 5 USB Device(s) found"); ut_assert_console_end(); - ut_asserteq(GENMASK(0, 0), std->hunters_used); + /* USB is second in the list, so bit 1 */ + ut_asserteq(BIT(1), std->hunters_used); return 0; } @@ -267,12 +269,12 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts) ut_assertok(run_command("bootdev hunt -l", 0)); ut_assert_nextline("Prio Used Uclass Hunter"); ut_assert_nextlinen("----"); - ut_assert_nextline(" 40 usb usb_bootdev"); - ut_assert_nextline("(total hunters: 1)"); + ut_assert_skip_to_line("(total hunters: 2)"); ut_assert_console_end(); /* Scan all hunters */ ut_assertok(run_command("bootdev hunt", 0)); + ut_assert_nextline("Hunting with: mmc"); ut_assert_nextline("Hunting with: usb"); ut_assert_nextline( "Bus usb@1: scanning bus usb@1 for devices... 5 USB Device(s) found"); @@ -282,11 +284,13 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts) ut_assertok(run_command("bootdev hunt -l", 0)); ut_assert_nextlinen("Prio"); ut_assert_nextlinen("----"); + ut_assert_nextline(" 10 * mmc mmc_bootdev"); ut_assert_nextline(" 40 * usb usb_bootdev"); - ut_assert_nextline("(total hunters: 1)"); + + ut_assert_nextline("(total hunters: 2)"); ut_assert_console_end(); - ut_asserteq(GENMASK(0, 0), std->hunters_used); + ut_asserteq(GENMASK(1, 0), std->hunters_used); return 0; }